[libvirt] [PATCH] bhyve: bhyveDomainDefineXML fixes

Roman Bogorodskiy bogorodskiy at gmail.com
Wed Apr 23 12:02:13 UTC 2014


  Daniel P. Berrange wrote:

> On Mon, Apr 21, 2014 at 08:22:23PM +0400, Roman Bogorodskiy wrote:
> > - do not loose new definition for an active domain
> > - do not leak oldDef
> > - do not set dom->id if virDomainSaveConfig() fails
> > - do not call virObjectUnlock(vm) if vm is NULL
> > ---
> >  src/bhyve/bhyve_driver.c | 14 ++++++++++----
> >  1 file changed, 10 insertions(+), 4 deletions(-)
> > 
> > diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
> > index 0cafe4c..6d681fd 100644
> > --- a/src/bhyve/bhyve_driver.c
> > +++ b/src/bhyve/bhyve_driver.c
> > @@ -472,17 +472,23 @@ bhyveDomainDefineXML(virConnectPtr conn, const char *xml)
> >      def = NULL;
> >      vm->persistent = 1;
> >  
> > +    if (virDomainSaveConfig(BHYVE_CONFIG_DIR,
> > +                            vm->newDef ? vm->newDef : vm->def) < 0) {
> > +        virDomainObjListRemove(privconn->domains, vm);
> > +        vm = NULL;
> > +        goto cleanup;
> > +    }
> > +
> >      dom = virGetDomain(conn, vm->def->name, vm->def->uuid);
> >      if (dom)
> >          dom->id = vm->def->id;
> >  
> > -    if (virDomainSaveConfig(BHYVE_CONFIG_DIR, vm->def) < 0)
> > -        goto cleanup;
> > -
> >   cleanup:
> >      virObjectUnref(caps);
> >      virDomainDefFree(def);
> > -    virObjectUnlock(vm);
> > +    virDomainDefFree(oldDef);
> > +    if (vm)
> > +        virObjectUnlock(vm);
> >  
> >      return dom;
> >  }
> 
> ACK

Pushed, thanks!

Roman Bogorodskiy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140423/7e0a2bcd/attachment-0001.sig>


More information about the libvir-list mailing list