mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
qemuDomainGetBlockJobInfo: Use qemuMonitorGetAllBlockJobInfo
Replace qemuMonitorGetBlockJobInfo by qemuMonitorGetAllBlockJobInfo and hash table lookup. This basically open-codes qemuMonitorGetBlockJobInfo, but it will be removed in next patch. Signed-off-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
b643bf3954
commit
9b44cab25a
@ -14695,8 +14695,9 @@ qemuDomainGetBlockJobInfo(virDomainPtr dom,
|
||||
virDomainObjPtr vm;
|
||||
virDomainDiskDefPtr disk;
|
||||
int ret = -1;
|
||||
qemuMonitorBlockJobInfo rawInfo;
|
||||
qemuMonitorBlockJobInfoPtr rawInfo;
|
||||
g_autoptr(qemuBlockJobData) job = NULL;
|
||||
g_autoptr(GHashTable) blockjobstats = NULL;
|
||||
|
||||
virCheckFlags(VIR_DOMAIN_BLOCK_JOB_INFO_BANDWIDTH_BYTES, -1);
|
||||
|
||||
@ -14722,18 +14723,21 @@ qemuDomainGetBlockJobInfo(virDomainPtr dom,
|
||||
}
|
||||
|
||||
qemuDomainObjEnterMonitor(driver, vm);
|
||||
ret = qemuMonitorGetBlockJobInfo(qemuDomainGetMonitor(vm), job->name, &rawInfo);
|
||||
if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
||||
ret = -1;
|
||||
if (ret <= 0)
|
||||
blockjobstats = qemuMonitorGetAllBlockJobInfo(qemuDomainGetMonitor(vm), true);
|
||||
if (qemuDomainObjExitMonitor(driver, vm) < 0 || !blockjobstats)
|
||||
goto endjob;
|
||||
|
||||
if (qemuBlockJobInfoTranslate(&rawInfo, info, disk,
|
||||
flags & VIR_DOMAIN_BLOCK_JOB_INFO_BANDWIDTH_BYTES) < 0) {
|
||||
ret = -1;
|
||||
if (!(rawInfo = g_hash_table_lookup(blockjobstats, job->name))) {
|
||||
ret = 0;
|
||||
goto endjob;
|
||||
}
|
||||
|
||||
if (qemuBlockJobInfoTranslate(rawInfo, info, disk,
|
||||
flags & VIR_DOMAIN_BLOCK_JOB_INFO_BANDWIDTH_BYTES) < 0)
|
||||
goto endjob;
|
||||
|
||||
ret = 1;
|
||||
|
||||
endjob:
|
||||
qemuDomainObjEndJob(driver, vm);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user