diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 08eb9c3d470a1fc5a041dfce8276f7ca79c3c3bf..7e9c1a164957ee8fe2f81f701f2d2002b4baa2d6 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -694,7 +694,9 @@ qemuDomainAttachDiskGeneric(virQEMUDriverPtr driver, if (qemuDomainObjExitMonitor(driver, vm) < 0) ret = -2; - if (qemuHotplugRemoveManagedPR(driver, vm, QEMU_ASYNC_JOB_NONE) < 0) + + if (virStorageSourceChainHasManagedPR(disk->src) && + qemuHotplugRemoveManagedPR(driver, vm, QEMU_ASYNC_JOB_NONE) < 0) ret = -2; virDomainAuditDisk(vm, NULL, disk->src, "attach", false); @@ -4266,7 +4268,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) + if (virStorageSourceChainHasManagedPR(disk->src) && + qemuHotplugRemoveManagedPR(driver, vm, QEMU_ASYNC_JOB_NONE) < 0) goto cleanup; ret = 0;