[libvirt] [PATCH 04/11] qemu: blockjob: Use the new helpers in qemuDomainGetBlockJobInfo

John Ferlan jferlan at redhat.com
Wed Apr 8 15:05:45 UTC 2015



On 04/01/2015 01:20 PM, Peter Krempa wrote:
> Refactor the function to use the new helpers.
> ---
>  src/qemu/qemu_driver.c | 20 ++++++--------------
>  1 file changed, 6 insertions(+), 14 deletions(-)
> 

It seems git am -3 is having issues for this patch with recent commit
 'cfcdf5ff0'


> 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)

Commit id 'cfcdf5ff0' moves this check to after BeginJob and of course
goto endjob...

ACK - with the adjustment

John
>          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)
> 




More information about the libvir-list mailing list