[libvirt] [PATCH] qemu: distinguish pr disk before qemuHotplugRemoveManagedPR

Peter Krempa pkrempa at redhat.com
Wed Jun 19 06:16:56 UTC 2019


On Tue, Jun 18, 2019 at 21:28:26 +0800, Jie Wang wrote:
> when a disk without PR perform attach or detach operation,
> need not call qemuHotplugRemoveManagedPR, otherwise, it will
> print err log about PR, let us fix it.

Could you please elaborate which error log?

> 
> Signed-off-by: Jie Wang <wangjie88 at huawei.com>
> ---
>  src/qemu/qemu_hotplug.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
> index efda539..7ef92d0 100644
> --- a/src/qemu/qemu_hotplug.c
> +++ b/src/qemu/qemu_hotplug.c
> @@ -928,7 +928,9 @@ qemuDomainAttachDiskGeneric(virQEMUDriverPtr driver,
>  
>      if (qemuDomainObjExitMonitor(driver, vm) < 0)
>          ret = -2;
> -    if (qemuHotplugRemoveManagedPR(driver, vm, QEMU_ASYNC_JOB_NONE) < 0)a
> +
> +    if (virStorageSourceChainHasManagedPR(disk->src) &&
> +        qemuHotplugRemoveManagedPR(driver, vm, QEMU_ASYNC_JOB_NONE) < 0)

So is this a regression from your last patch? This function was supposed
to remove the PR daemon only when it was added.

At any rate, a better fix will be to remember if this function added the
managed PR daemon and remove only in such case.

>          ret = -2;
>  
>      virDomainAuditDisk(vm, NULL, disk->src, "attach", false);
> @@ -4481,7 +4483,8 @@ qemuDomainRemoveDiskDevice(virQEMUDriverPtr driver,
>      dev.data.disk = disk;
>      ignore_value(qemuRemoveSharedDevice(driver, &dev, vm->def->name));
>  
> -    if (qemuHotplugRemoveManagedPR(driver, vm, QEMU_ASYNC_JOB_NONE) < 0)

This function already checks that the VM is using the PR daemon and thus
does nothing in such case. So I don't see a point in this change.

> +    if (virStorageSourceChainHasManagedPR(disk->src) &&
> +        qemuHotplugRemoveManagedPR(driver, vm, QEMU_ASYNC_JOB_NONE) < 0)
>          goto cleanup;
>  
>      ret = 0;
> -- 
> 1.8.3.1
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190619/94708095/attachment-0001.sig>


More information about the libvir-list mailing list