[libvirt] [PATCH 1/2] qemuDomainGetStats: Copy domain ID too

Michal Privoznik mprivozn at redhat.com
Tue Mar 28 15:15:07 UTC 2017


One of the problems with our virGetDomain function is that it
copies just domain name and domain UUID. Therefore it's very
easy to forget aboud domain ID. This can cause some bugs, like
virConnectGetAllDomainStats not reporting proper domain IDs.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/qemu/qemu_driver.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index d5fc00e..40c2eab 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -19556,6 +19556,9 @@ qemuDomainGetStats(virConnectPtr conn,
     if (!(tmp->dom = virGetDomain(conn, dom->def->name, dom->def->uuid)))
         goto cleanup;
 
+    /* We have to copy the domain ID by hand */
+    tmp->dom->id = dom->def->id;
+
     *record = tmp;
     tmp = NULL;
     ret = 0;
-- 
2.10.2




More information about the libvir-list mailing list