mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemu: hotplug: Add/remove managed PR objects on media change
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> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
83fe11e950
commit
4fbe2295db
@ -595,6 +595,9 @@ qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver,
|
|||||||
if (qemuHotplugPrepareDiskAccess(driver, vm, disk, newsrc, false) < 0)
|
if (qemuHotplugPrepareDiskAccess(driver, vm, disk, newsrc, false) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
if (qemuHotplugAttachManagedPR(driver, vm, newsrc, QEMU_ASYNC_JOB_NONE) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
rc = qemuDomainChangeMediaLegacy(driver, vm, disk, newsrc, force);
|
rc = qemuDomainChangeMediaLegacy(driver, vm, disk, newsrc, force);
|
||||||
|
|
||||||
virDomainAuditDisk(vm, disk->src, newsrc, "update", rc >= 0);
|
virDomainAuditDisk(vm, disk->src, newsrc, "update", rc >= 0);
|
||||||
@ -610,6 +613,9 @@ qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver,
|
|||||||
|
|
||||||
virStorageSourceFree(disk->src);
|
virStorageSourceFree(disk->src);
|
||||||
VIR_STEAL_PTR(disk->src, newsrc);
|
VIR_STEAL_PTR(disk->src, newsrc);
|
||||||
|
|
||||||
|
ignore_value(qemuHotplugRemoveManagedPR(driver, vm, QEMU_ASYNC_JOB_NONE));
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user