]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: bulk stats: Fix logic in monitor handling
authorFrancesco Romani <fromani@redhat.com>
Thu, 11 Dec 2014 07:44:09 +0000 (08:44 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 11 Dec 2014 10:02:05 +0000 (11:02 +0100)
A logic bug in qemuConnectGetAllDomainStats makes the code mark the
monitor as available when qemuDomainObjBeginJob fails, instead of when
it succeeds, as the correct flow requires.

This patch fixes the check and updates the code documentation
accordingly.

Broken by commit 57023c0a3af4af1c547189c1f6712ed5edeb0c0b.

Signed-off-by: Francesco Romani <fromani@redhat.com>
src/qemu/qemu_driver.c

index 830fca737bcc7a8ffdb27b5ca7a090c21d3d0710..df3ba6dc6af28671fec0948e04924e3205f91692 100644 (file)
@@ -18745,9 +18745,9 @@ qemuConnectGetAllDomainStats(virConnectPtr conn,
         }
 
         if (HAVE_JOB(privflags) &&
-            qemuDomainObjBeginJob(driver, dom, QEMU_JOB_QUERY) < 0)
-            /* As it was never requested. Gather as much as possible anyway. */
+            qemuDomainObjBeginJob(driver, dom, QEMU_JOB_QUERY) == 0)
             domflags |= QEMU_DOMAIN_STATS_HAVE_JOB;
+        /* else: without a job it's still possible to gather some data */
 
         if (qemuDomainGetStats(conn, dom, stats, &tmp, domflags) < 0)
             goto endjob;