qemuHotplugPrepareDiskAccess can be used to tear down disk access so we
can replace the open-coded version collecting the same function calls.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_hotplug.c | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 2b6633a998..ee26fb4f52 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -3830,17 +3830,8 @@ qemuDomainRemoveDiskDevice(virQEMUDriverPtr driver,
qemuDomainReleaseDeviceAddress(vm, &disk->info, src);
- if (qemuSecurityRestoreDiskLabel(driver, vm, disk) < 0)
- VIR_WARN("Unable to restore security label on %s", src);
-
- if (qemuTeardownDiskCgroup(vm, disk) < 0)
- VIR_WARN("Failed to tear down cgroup for disk path %s", src);
-
- if (virDomainLockDiskDetach(driver->lockManager, vm, disk) < 0)
- VIR_WARN("Unable to release lock on %s", src);
-
- if (qemuDomainNamespaceTeardownDisk(vm, disk->src) < 0)
- VIR_WARN("Unable to remove /dev entry for %s", src);
+ /* tear down disk security access */
+ qemuHotplugPrepareDiskAccess(driver, vm, disk, NULL, true);
dev.type = VIR_DOMAIN_DEVICE_DISK;
dev.data.disk = disk;
--
2.16.2