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

Sascha Silbe silbe at linux.vnet.ibm.com
Fri Jul 15 16:30:32 UTC 2016


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.

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 at linux.vnet.ibm.com>
Signed-off-by: Sascha Silbe <silbe at linux.vnet.ibm.com>
Tested-by: Marc Hartmayer <mhartmay at linux.vnet.ibm.com>
Reviewed-by: Marc Hartmayer <mhartmay at linux.vnet.ibm.com>
---
 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:
-- 
1.9.1




More information about the libvir-list mailing list