From 9186d0bb6d56bdf61836bc0e425252346ea16b6a Mon Sep 17 00:00:00 2001 Message-Id: <9186d0bb6d56bdf61836bc0e425252346ea16b6a@dist-git> From: Francesco Romani Date: Sat, 13 Dec 2014 10:10:02 +0100 Subject: [PATCH] qemu: bulk stats: Fix logic in monitor handling https://bugzilla.redhat.com/show_bug.cgi?id=1172570 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 (cherry picked from commit cb104ef734dfea12cb8826dba7e2c98912c4b7e1) Signed-off-by: Martin Kletzander Signed-off-by: Jiri Denemark --- src/qemu/qemu_driver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 1625ddd..4498194 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -18264,9 +18264,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; -- 2.2.0