]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: hotplug: Reuse qemuHotplugPrepareDiskAccess in qemuDomainRemoveDiskDevice
authorPeter Krempa <pkrempa@redhat.com>
Wed, 11 Jul 2018 15:21:36 +0000 (17:21 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 20 Jul 2018 12:23:08 +0000 (14:23 +0200)
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@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_hotplug.c

index 978dd8af729ef27c3e1c83ab3eab8ac4fb860d1f..1a8ef8bbac95cd6f9e2c7a61d2b716d59e9c9a95 100644 (file)
@@ -3831,17 +3831,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;