[libvirt] [PATCH 11/10] qemu: hotplug: Add/remove managed PR objects on media change

Peter Krempa posted 10 patches 7 years, 6 months ago
[libvirt] [PATCH 11/10] qemu: hotplug: Add/remove managed PR objects on media change
Posted by Peter Krempa 7 years, 6 months ago
When changing cdrom media we did not handle the managed PR objects thus
we'd either have a stale PR object left behind or the media change would
fail.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---

Opps this one was also left behind in the blockdev-add series but
belongs to this posting.

 src/qemu/qemu_hotplug.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index f416db2c60..a1e523013d 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -595,6 +595,9 @@ qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver,
     if (qemuHotplugPrepareDiskAccess(driver, vm, disk, newsrc, false) < 0)
         goto cleanup;

+    if (qemuHotplugAttachManagedPR(driver, vm, newsrc, QEMU_ASYNC_JOB_NONE) < 0)
+        goto cleanup;
+
     rc = qemuDomainChangeMediaLegacy(driver, vm, disk, newsrc, force);

     virDomainAuditDisk(vm, disk->src, newsrc, "update", rc >= 0);
@@ -610,6 +613,9 @@ qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver,

     virStorageSourceFree(disk->src);
     VIR_STEAL_PTR(disk->src, newsrc);
+
+    ignore_value(qemuHotplugRemoveManagedPR(driver, vm, QEMU_ASYNC_JOB_NONE));
+
     ret = 0;

  cleanup:
-- 
2.16.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 11/10] qemu: hotplug: Add/remove managed PR objects on media change
Posted by Ján Tomko 7 years, 6 months ago
On Wed, Jul 18, 2018 at 01:36:54PM +0200, Peter Krempa wrote:
>When changing cdrom media we did not handle the managed PR objects thus
>we'd either have a stale PR object left behind or the media change would
>fail.
>
>Signed-off-by: Peter Krempa <pkrempa@redhat.com>
>---
>
>Opps this one was also left behind in the blockdev-add series but
>belongs to this posting.
>
> src/qemu/qemu_hotplug.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list