mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 22:25:25 +00:00
qemu: driver: Remove unnecessary flag in qemuDomainGetStatsBlock
'abbreviated' was true if 'stats' were NULL
This commit is contained in:
parent
90b9995d1d
commit
5d2b0e6f12
@ -19321,7 +19321,6 @@ qemuDomainGetStatsOneBlock(virQEMUDriverPtr driver,
|
|||||||
virStorageSourcePtr src,
|
virStorageSourcePtr src,
|
||||||
size_t block_idx,
|
size_t block_idx,
|
||||||
unsigned int backing_idx,
|
unsigned int backing_idx,
|
||||||
bool abbreviated,
|
|
||||||
virHashTablePtr stats)
|
virHashTablePtr stats)
|
||||||
{
|
{
|
||||||
qemuBlockStats *entry;
|
qemuBlockStats *entry;
|
||||||
@ -19340,7 +19339,7 @@ qemuDomainGetStatsOneBlock(virQEMUDriverPtr driver,
|
|||||||
QEMU_ADD_BLOCK_PARAM_UI(record, maxparams, block_idx, "backingIndex",
|
QEMU_ADD_BLOCK_PARAM_UI(record, maxparams, block_idx, "backingIndex",
|
||||||
backing_idx);
|
backing_idx);
|
||||||
|
|
||||||
if (abbreviated || !alias || !(entry = virHashLookup(stats, alias))) {
|
if (!stats || !alias || !(entry = virHashLookup(stats, alias))) {
|
||||||
if (virStorageSourceIsEmpty(src)) {
|
if (virStorageSourceIsEmpty(src)) {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -19417,15 +19416,12 @@ qemuDomainGetStatsBlock(virQEMUDriverPtr driver,
|
|||||||
int rc;
|
int rc;
|
||||||
virHashTablePtr stats = NULL;
|
virHashTablePtr stats = NULL;
|
||||||
qemuDomainObjPrivatePtr priv = dom->privateData;
|
qemuDomainObjPrivatePtr priv = dom->privateData;
|
||||||
bool abbreviated = false;
|
|
||||||
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
|
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
|
||||||
int count_index = -1;
|
int count_index = -1;
|
||||||
size_t visited = 0;
|
size_t visited = 0;
|
||||||
bool visitBacking = !!(privflags & QEMU_DOMAIN_STATS_BACKING);
|
bool visitBacking = !!(privflags & QEMU_DOMAIN_STATS_BACKING);
|
||||||
|
|
||||||
if (!HAVE_JOB(privflags) || !virDomainObjIsActive(dom)) {
|
if (HAVE_JOB(privflags) && virDomainObjIsActive(dom)) {
|
||||||
abbreviated = true; /* it's ok, just go ahead silently */
|
|
||||||
} else {
|
|
||||||
qemuDomainObjEnterMonitor(driver, dom);
|
qemuDomainObjEnterMonitor(driver, dom);
|
||||||
rc = qemuMonitorGetAllBlockStatsInfo(priv->mon, &stats,
|
rc = qemuMonitorGetAllBlockStatsInfo(priv->mon, &stats,
|
||||||
visitBacking);
|
visitBacking);
|
||||||
@ -19435,10 +19431,9 @@ qemuDomainGetStatsBlock(virQEMUDriverPtr driver,
|
|||||||
if (qemuDomainObjExitMonitor(driver, dom) < 0)
|
if (qemuDomainObjExitMonitor(driver, dom) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (rc < 0) {
|
/* failure to retrieve stats is fine at this point */
|
||||||
|
if (rc < 0)
|
||||||
virResetLastError();
|
virResetLastError();
|
||||||
abbreviated = true; /* still ok, again go ahead silently */
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* When listing backing chains, it's easier to fix up the count
|
/* When listing backing chains, it's easier to fix up the count
|
||||||
@ -19455,7 +19450,7 @@ qemuDomainGetStatsBlock(virQEMUDriverPtr driver,
|
|||||||
while (src && (backing_idx == 0 || visitBacking)) {
|
while (src && (backing_idx == 0 || visitBacking)) {
|
||||||
if (qemuDomainGetStatsOneBlock(driver, cfg, dom, record, maxparams,
|
if (qemuDomainGetStatsOneBlock(driver, cfg, dom, record, maxparams,
|
||||||
disk, src, visited, backing_idx,
|
disk, src, visited, backing_idx,
|
||||||
abbreviated, stats) < 0)
|
stats) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
visited++;
|
visited++;
|
||||||
backing_idx++;
|
backing_idx++;
|
||||||
|
Loading…
Reference in New Issue
Block a user