Refactor the function to use the new helpers.
---
src/qemu/qemu_driver.c | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index becf415..6a2b58d 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -16457,7 +16457,6 @@ qemuDomainGetBlockJobInfo(virDomainPtr dom, const char *path,
virDomainBlockJobInfoPtr info, unsigned int flags)
{
virQEMUDriverPtr driver = dom->conn->privateData;
- qemuDomainObjPrivatePtr priv;
virDomainObjPtr vm;
char *device = NULL;
int idx;
@@ -16470,18 +16469,11 @@ qemuDomainGetBlockJobInfo(virDomainPtr dom, const char *path,
if (!(vm = qemuDomObjFromDomain(dom)))
return -1;
- if (virDomainGetBlockJobInfoEnsureACL(dom->conn, vm->def) < 0) {
- qemuDomObjEndAPI(&vm);
- return -1;
- }
+ if (virDomainGetBlockJobInfoEnsureACL(dom->conn, vm->def) < 0)
+ goto cleanup;
- priv = vm->privateData;
- if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKJOB_ASYNC) &&
- !virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKJOB_SYNC)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("block jobs not supported with this QEMU binary"));
+ if (qemuDomainSupportsBlockJobs(vm, NULL) < 0)
goto cleanup;
- }
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0)
goto cleanup;
@@ -16492,13 +16484,13 @@ qemuDomainGetBlockJobInfo(virDomainPtr dom, const char *path,
goto endjob;
}
- device = qemuDiskPathToAlias(vm, path, &idx);
- if (!device)
+ if (!(device = qemuDiskPathToAlias(vm, path, &idx)))
goto endjob;
disk = vm->def->disks[idx];
qemuDomainObjEnterMonitor(driver, vm);
- ret = qemuMonitorBlockJobInfo(priv->mon, device, info, &bandwidth);
+ ret = qemuMonitorBlockJobInfo(qemuDomainGetMonitor(vm), device, info,
+ &bandwidth);
if (qemuDomainObjExitMonitor(driver, vm) < 0)
ret = -1;
if (ret < 0)
--
2.2.2