mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
qemu: driver: Stop using QEMU_ADD_BLOCK_PARAM_ULL in qemuDomainGetStatsOneBlock
Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
bb722855ca
commit
585e260395
@ -21436,42 +21436,42 @@ qemuDomainGetStatsOneBlock(virQEMUDriverPtr driver,
|
|||||||
virHashTablePtr stats)
|
virHashTablePtr stats)
|
||||||
{
|
{
|
||||||
qemuBlockStats *entry;
|
qemuBlockStats *entry;
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
/* the VM is offline so we have to go and load the stast from the disk by
|
/* the VM is offline so we have to go and load the stast from the disk by
|
||||||
* ourselves */
|
* ourselves */
|
||||||
if (!virDomainObjIsActive(dom)) {
|
if (!virDomainObjIsActive(dom)) {
|
||||||
ret = qemuDomainGetStatsOneBlockFallback(driver, cfg, dom, params,
|
return qemuDomainGetStatsOneBlockFallback(driver, cfg, dom, params,
|
||||||
src, block_idx);
|
src, block_idx);
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* In case where qemu didn't provide the stats we stop here rather than
|
/* In case where qemu didn't provide the stats we stop here rather than
|
||||||
* trying to refresh the stats from the disk. Inability to provide stats is
|
* trying to refresh the stats from the disk. Inability to provide stats is
|
||||||
* usually caused by blocked storage so this would make libvirtd hang */
|
* usually caused by blocked storage so this would make libvirtd hang */
|
||||||
if (!stats || !entryname || !(entry = virHashLookup(stats, entryname))) {
|
if (!stats || !entryname || !(entry = virHashLookup(stats, entryname)))
|
||||||
ret = 0;
|
return 0;
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
QEMU_ADD_BLOCK_PARAM_ULL(params, block_idx,
|
if (virTypedParamListAddULLong(params, entry->wr_highest_offset,
|
||||||
"allocation", entry->wr_highest_offset);
|
"block.%zu.allocation", block_idx) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (entry->capacity &&
|
||||||
|
virTypedParamListAddULLong(params, entry->capacity,
|
||||||
|
"block.%zu.capacity", block_idx) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
if (entry->capacity)
|
|
||||||
QEMU_ADD_BLOCK_PARAM_ULL(params, block_idx,
|
|
||||||
"capacity", entry->capacity);
|
|
||||||
if (entry->physical) {
|
if (entry->physical) {
|
||||||
QEMU_ADD_BLOCK_PARAM_ULL(params, block_idx,
|
if (virTypedParamListAddULLong(params, entry->physical,
|
||||||
"physical", entry->physical);
|
"block.%zu.physical", block_idx) < 0)
|
||||||
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
if (qemuDomainStorageUpdatePhysical(driver, cfg, dom, src) == 0)
|
if (qemuDomainStorageUpdatePhysical(driver, cfg, dom, src) == 0) {
|
||||||
QEMU_ADD_BLOCK_PARAM_ULL(params, block_idx,
|
if (virTypedParamListAddULLong(params, src->physical,
|
||||||
"physical", src->physical);
|
"block.%zu.physical", block_idx) < 0)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user