提交 e6f38fdb 编写于 作者: P Peter Krempa

qemu: driver: blockdevize qemuDomainGetBlockJobInfo

Use the stored job name rather than passing in the disk alias when
referring to the job which allows the same code to work also when
-blockdev will be used.

Note that this API does not require the change to use 'query-job' as it
will ever only work with blockjobs bound to disks due to the arguments
which allow only referring to a disk. For the disk-less jobs we'll need
to add a separate API later.

The change to qemuMonitorGetBlockJobInfo is required as the API was
stripping the 'drive-' prefix when returning the data which is not
desired any more.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 759bf903
...@@ -17289,6 +17289,7 @@ qemuDomainGetBlockJobInfo(virDomainPtr dom, ...@@ -17289,6 +17289,7 @@ qemuDomainGetBlockJobInfo(virDomainPtr dom,
virDomainDiskDefPtr disk; virDomainDiskDefPtr disk;
int ret = -1; int ret = -1;
qemuMonitorBlockJobInfo rawInfo; qemuMonitorBlockJobInfo rawInfo;
VIR_AUTOUNREF(qemuBlockJobDataPtr) job = NULL;
virCheckFlags(VIR_DOMAIN_BLOCK_JOB_INFO_BANDWIDTH_BYTES, -1); virCheckFlags(VIR_DOMAIN_BLOCK_JOB_INFO_BANDWIDTH_BYTES, -1);
...@@ -17311,9 +17312,13 @@ qemuDomainGetBlockJobInfo(virDomainPtr dom, ...@@ -17311,9 +17312,13 @@ qemuDomainGetBlockJobInfo(virDomainPtr dom,
goto endjob; goto endjob;
} }
if (!(job = qemuBlockJobDiskGetJob(disk))) {
ret = 0;
goto endjob;
}
qemuDomainObjEnterMonitor(driver, vm); qemuDomainObjEnterMonitor(driver, vm);
ret = qemuMonitorGetBlockJobInfo(qemuDomainGetMonitor(vm), ret = qemuMonitorGetBlockJobInfo(qemuDomainGetMonitor(vm), job->name, &rawInfo);
disk->info.alias, &rawInfo);
if (qemuDomainObjExitMonitor(driver, vm) < 0) if (qemuDomainObjExitMonitor(driver, vm) < 0)
ret = -1; ret = -1;
if (ret <= 0) if (ret <= 0)
......
...@@ -3463,7 +3463,7 @@ qemuMonitorGetBlockJobInfo(qemuMonitorPtr mon, ...@@ -3463,7 +3463,7 @@ qemuMonitorGetBlockJobInfo(qemuMonitorPtr mon,
VIR_DEBUG("alias=%s, info=%p", alias, info); VIR_DEBUG("alias=%s, info=%p", alias, info);
if (!(all = qemuMonitorGetAllBlockJobInfo(mon, false))) if (!(all = qemuMonitorGetAllBlockJobInfo(mon, true)))
return -1; return -1;
if ((data = virHashLookup(all, alias))) { if ((data = virHashLookup(all, alias))) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册