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

Peter Krempa pkrempa at redhat.com
Wed Jul 18 11:36:54 UTC 2018


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




More information about the libvir-list mailing list