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