mirror of https://gitee.com/openkylin/libvirt.git
qemuBlockJobInfoTranslate: Take job type from qemuBlockJobDataPtr
Commit f5e8715a8b
added logic which adds some fake job info when qemu
didn't return anything but in such case the job type would not be set.
Since we already have the proper job type recorded in qemuBlockJobDataPtr
which the caller fetched, we can use this it and also remove the lookup
from the disk which was necessary prior to the conversion to
qemuBlockJobDataPtr.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
5c004dd16f
commit
0b927156bc
|
@ -14638,9 +14638,11 @@ qemuDomainBlockJobAbort(virDomainPtr dom,
|
|||
static int
|
||||
qemuBlockJobInfoTranslate(qemuMonitorBlockJobInfoPtr rawInfo,
|
||||
virDomainBlockJobInfoPtr info,
|
||||
virDomainDiskDefPtr disk,
|
||||
qemuBlockJobDataPtr job,
|
||||
bool reportBytes)
|
||||
{
|
||||
info->type = job->type;
|
||||
|
||||
/* If the job data is no longer present this means that the job already
|
||||
* disappeared in qemu (pre-blockdev) but libvirt didn't process the
|
||||
* finishing yet. Fake a incomplete job. */
|
||||
|
@ -14674,11 +14676,6 @@ qemuBlockJobInfoTranslate(qemuMonitorBlockJobInfoPtr rawInfo,
|
|||
info->cur > 0)
|
||||
info->cur -= 1;
|
||||
|
||||
info->type = rawInfo->type;
|
||||
if (info->type == VIR_DOMAIN_BLOCK_JOB_TYPE_COMMIT &&
|
||||
disk->mirrorJob == VIR_DOMAIN_BLOCK_JOB_TYPE_ACTIVE_COMMIT)
|
||||
info->type = disk->mirrorJob;
|
||||
|
||||
if (rawInfo->bandwidth && !reportBytes)
|
||||
rawInfo->bandwidth = VIR_DIV_UP(rawInfo->bandwidth, 1024 * 1024);
|
||||
info->bandwidth = rawInfo->bandwidth;
|
||||
|
@ -14737,7 +14734,7 @@ qemuDomainGetBlockJobInfo(virDomainPtr dom,
|
|||
|
||||
rawInfo = g_hash_table_lookup(blockjobstats, job->name);
|
||||
|
||||
if (qemuBlockJobInfoTranslate(rawInfo, info, disk,
|
||||
if (qemuBlockJobInfoTranslate(rawInfo, info, job,
|
||||
flags & VIR_DOMAIN_BLOCK_JOB_INFO_BANDWIDTH_BYTES) < 0)
|
||||
goto endjob;
|
||||
|
||||
|
|
Loading…
Reference in New Issue