From 992d8fee540fcdeba1a8b1cb9568fb981d210b08 Mon Sep 17 00:00:00 2001
Message-Id: <992d8fee540fcdeba1a8b1cb9568fb981d210b08@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Thu, 26 May 2016 12:54:52 +0200
Subject: [PATCH] qemu: driver: Remove unnecessary flag in
qemuDomainGetStatsBlock
https://bugzilla.redhat.com/show_bug.cgi?id=1339963
'abbreviated' was true if 'stats' were NULL
(cherry picked from commit 5d2b0e6f12b4e57d75ed1047ab1c36443b7a54b3)
---
src/qemu/qemu_driver.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index bdebf13..e403103 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -19340,7 +19340,6 @@ qemuDomainGetStatsOneBlock(virQEMUDriverPtr driver,
virStorageSourcePtr src,
size_t block_idx,
unsigned int backing_idx,
- bool abbreviated,
virHashTablePtr stats)
{
qemuBlockStats *entry;
@@ -19359,7 +19358,7 @@ qemuDomainGetStatsOneBlock(virQEMUDriverPtr driver,
QEMU_ADD_BLOCK_PARAM_UI(record, maxparams, block_idx, "backingIndex",
backing_idx);
- if (abbreviated || !alias || !(entry = virHashLookup(stats, alias))) {
+ if (!stats || !alias || !(entry = virHashLookup(stats, alias))) {
if (virStorageSourceIsEmpty(src)) {
ret = 0;
goto cleanup;
@@ -19436,15 +19435,12 @@ qemuDomainGetStatsBlock(virQEMUDriverPtr driver,
int rc;
virHashTablePtr stats = NULL;
qemuDomainObjPrivatePtr priv = dom->privateData;
- bool abbreviated = false;
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
int count_index = -1;
size_t visited = 0;
bool visitBacking = !!(privflags & QEMU_DOMAIN_STATS_BACKING);
- if (!HAVE_JOB(privflags) || !virDomainObjIsActive(dom)) {
- abbreviated = true; /* it's ok, just go ahead silently */
- } else {
+ if (HAVE_JOB(privflags) && virDomainObjIsActive(dom)) {
qemuDomainObjEnterMonitor(driver, dom);
rc = qemuMonitorGetAllBlockStatsInfo(priv->mon, &stats,
visitBacking);
@@ -19454,10 +19450,9 @@ qemuDomainGetStatsBlock(virQEMUDriverPtr driver,
if (qemuDomainObjExitMonitor(driver, dom) < 0)
goto cleanup;
- if (rc < 0) {
+ /* failure to retrieve stats is fine at this point */
+ if (rc < 0)
virResetLastError();
- abbreviated = true; /* still ok, again go ahead silently */
- }
}
/* When listing backing chains, it's easier to fix up the count
@@ -19474,7 +19469,7 @@ qemuDomainGetStatsBlock(virQEMUDriverPtr driver,
while (src && (backing_idx == 0 || visitBacking)) {
if (qemuDomainGetStatsOneBlock(driver, cfg, dom, record, maxparams,
disk, src, visited, backing_idx,
- abbreviated, stats) < 0)
+ stats) < 0)
goto cleanup;
visited++;
backing_idx++;
--
2.8.3