Re: [PATCH v2 2/8] bhyve: stop opening & passing connection to bhyveProcessStart

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 12, 2025 at 17:43:50 +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.

Never-mind this ..

> 
> >  {
> > -    /* 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);

... as it is used here.

> 
> I'm not sure what the idea is but you could pass the driver as private data still.
> 
> Reviewed-by: Peter Krempa <pkrempa@xxxxxxxxxx>
> 




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux