Re: [PATCH] qemu: fix domain id after domainCreate(), domainCreateWithFlags()

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

 



On Fri, Jul 15, 2016 at 06:30:32PM +0200, Sascha Silbe wrote:
> Ever since a041de15 [Update to comply with internal driver API]
> changed the code to use virDomain.id instead of _virDomainObj.id
> (qemud_vm.id back then) directly, the domain ID retrieved with
> virDomainGetID() is incorrect after virDomainCreate() or
> virDomainCreateWithFlags() was called. The API consumer has to look up
> the domain anew to retrieve the correct ID.

Err no. The src/remote_driver.c remoteDomainCreate method will
call virDomainLookupByUUID to fetch the updated id. The dom->id
value in the QEMU driver is never used because that virDomainPtr
instance only exists for the life of the virDomainCreate API
call on the server side and is never seen by the client.

> 
> Copy over the ID in qemuDomainCreateWithFlags() so it's correct for
> the existing domain instance, too.
> 
> Fixes: a041de15 ("Update to comply with internal driver API")
> Reported-by: Marc Hartmayer <mhartmay@xxxxxxxxxxxxxxxxxx>
> Signed-off-by: Sascha Silbe <silbe@xxxxxxxxxxxxxxxxxx>
> Tested-by: Marc Hartmayer <mhartmay@xxxxxxxxxxxxxxxxxx>
> Reviewed-by: Marc Hartmayer <mhartmay@xxxxxxxxxxxxxxxxxx>
> ---
>  src/qemu/qemu_driver.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index cda85f6..6929b23 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -7100,6 +7100,7 @@ qemuDomainCreateWithFlags(virDomainPtr dom, unsigned int flags)
>                             QEMU_ASYNC_JOB_START) < 0)
>          goto endjob;
>  
> +    dom->id = vm->def->id;
>      ret = 0;
>  
>   endjob:
> -- 

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]