Re: [PATCH] bhyve: bhyveDomainDefineXML fixes

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

 



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

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[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]