On Wed, Feb 12, 2025 at 05:43:50PM +0100, Peter Krempa wrote: > On Wed, Feb 12, 2025 at 15:46:40 +0000, Daniel P. Berrangé wrote: > > A connection object is not required because autostarted domains are > > never marked for autodestroy. > > > > The comment about needing a connection for the network driver is > > obsolete since we can auto-open a connection on demand. > > > > Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx> > > --- > > src/bhyve/bhyve_driver.c | 19 +++---------------- > > 1 file changed, 3 insertions(+), 16 deletions(-) > > > > > > diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c > > index ea5a9be4fb..f6b0417014 100644 > > --- a/src/bhyve/bhyve_driver.c > > +++ b/src/bhyve/bhyve_driver.c > > @@ -71,15 +71,14 @@ VIR_LOG_INIT("bhyve.bhyve_driver"); > > struct _bhyveConn *bhyve_driver = NULL; > > > > static int > > -bhyveAutostartDomain(virDomainObj *vm, void *opaque) > > +bhyveAutostartDomain(virDomainObj *vm, void *opaque G_GNUC_UNUSED) > > { > > - const struct bhyveAutostartData *data = opaque; > > Re 1/8: Ah I see. > > > int ret = 0; > > VIR_LOCK_GUARD lock = virObjectLockGuard(vm); > > > > if (vm->autostart && !virDomainObjIsActive(vm)) { > > virResetLastError(); > > - ret = virBhyveProcessStart(bhyve_driver, data->conn, vm, > > + ret = virBhyveProcessStart(bhyve_driver, NULL, vm, > > VIR_DOMAIN_RUNNING_BOOTED, 0); > > if (ret < 0) { > > virReportError(VIR_ERR_INTERNAL_ERROR, > > @@ -93,19 +92,7 @@ bhyveAutostartDomain(virDomainObj *vm, void *opaque) > > static void > > bhyveAutostartDomains(struct _bhyveConn *driver) > > This argument will be unused now. > > > { > > - /* XXX: Figure out a better way todo this. The domain > > - * startup code needs a connection handle in order > > - * to lookup the bridge associated with a virtual > > - * network > > - */ > > - virConnectPtr conn = virConnectOpen("bhyve:///system"); > > - /* Ignoring NULL conn which is mostly harmless here */ > > - > > - struct bhyveAutostartData data = { driver, conn }; > > - > > - virDomainObjListForEach(driver->domains, false, bhyveAutostartDomain, &data); > > - > > - virObjectUnref(conn); > > + virDomainObjListForEach(driver->domains, false, bhyveAutostartDomain, NULL); > > I'm not sure what the idea is but you could pass the driver as private data still. That was an oversight from retrofitting this at the start of the series before this code gets changed again by later patch > > Reviewed-by: Peter Krempa <pkrempa@xxxxxxxxxx> > With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|