From 083b74cd201820beedb24eb906a5355562520bf5 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Wed, 23 Jan 2019 13:58:46 +0100 Subject: [PATCH] locking: Use virDomainLockImage[Attach|Detach] instead of *Disk Use the functions designed to deal with single images as the *Disk functions were just wrappers. Signed-off-by: Peter Krempa Reviewed-by: John Ferlan --- src/libvirt_private.syms | 2 -- src/libxl/libxl_driver.c | 14 +++++++------- src/locking/domain_lock.c | 17 ----------------- src/locking/domain_lock.h | 8 -------- src/qemu/qemu_hotplug.c | 6 +++--- 5 files changed, 10 insertions(+), 37 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index f4abd0307e..c9252b448e 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1294,8 +1294,6 @@ virStreamInData; # locking/domain_lock.h -virDomainLockDiskAttach; -virDomainLockDiskDetach; virDomainLockImageAttach; virDomainLockImageDetach; virDomainLockLeaseAttach; diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index f11597b0d7..7981ccaf21 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -3051,9 +3051,9 @@ libxlDomainAttachDeviceDiskLive(virDomainObjPtr vm, virDomainDeviceDefPtr dev) if (libxlMakeDisk(l_disk, &x_disk) < 0) goto cleanup; - if (virDomainLockDiskAttach(libxl_driver->lockManager, - "xen:///system", - vm, l_disk) < 0) + if (virDomainLockImageAttach(libxl_driver->lockManager, + "xen:///system", + vm, l_disk->src) < 0) goto cleanup; if ((ret = libxl_device_disk_add(cfg->ctx, vm->def->id, @@ -3061,8 +3061,8 @@ libxlDomainAttachDeviceDiskLive(virDomainObjPtr vm, virDomainDeviceDefPtr dev) virReportError(VIR_ERR_INTERNAL_ERROR, _("libxenlight failed to attach disk '%s'"), l_disk->dst); - if (virDomainLockDiskDetach(libxl_driver->lockManager, - vm, l_disk) < 0) { + if (virDomainLockImageDetach(libxl_driver->lockManager, + vm, l_disk->src) < 0) { VIR_WARN("Unable to release lock on %s", virDomainDiskGetSource(l_disk)); } @@ -3350,8 +3350,8 @@ libxlDomainDetachDeviceDiskLive(virDomainObjPtr vm, virDomainDeviceDefPtr dev) goto cleanup; } - if (virDomainLockDiskDetach(libxl_driver->lockManager, - vm, l_disk) < 0) + if (virDomainLockImageDetach(libxl_driver->lockManager, + vm, l_disk->src) < 0) VIR_WARN("Unable to release lock on %s", virDomainDiskGetSource(l_disk)); diff --git a/src/locking/domain_lock.c b/src/locking/domain_lock.c index 705b132457..d91ac83c45 100644 --- a/src/locking/domain_lock.c +++ b/src/locking/domain_lock.c @@ -281,15 +281,6 @@ int virDomainLockImageAttach(virLockManagerPluginPtr plugin, } -int virDomainLockDiskAttach(virLockManagerPluginPtr plugin, - const char *uri, - virDomainObjPtr dom, - virDomainDiskDefPtr disk) -{ - return virDomainLockImageAttach(plugin, uri, dom, disk->src); -} - - int virDomainLockImageDetach(virLockManagerPluginPtr plugin, virDomainObjPtr dom, virStorageSourcePtr src) @@ -317,14 +308,6 @@ int virDomainLockImageDetach(virLockManagerPluginPtr plugin, } -int virDomainLockDiskDetach(virLockManagerPluginPtr plugin, - virDomainObjPtr dom, - virDomainDiskDefPtr disk) -{ - return virDomainLockImageDetach(plugin, dom, disk->src); -} - - int virDomainLockLeaseAttach(virLockManagerPluginPtr plugin, const char *uri, virDomainObjPtr dom, diff --git a/src/locking/domain_lock.h b/src/locking/domain_lock.h index 027e93271a..02417b471b 100644 --- a/src/locking/domain_lock.h +++ b/src/locking/domain_lock.h @@ -42,14 +42,6 @@ int virDomainLockProcessInquire(virLockManagerPluginPtr plugin, virDomainObjPtr dom, char **state); -int virDomainLockDiskAttach(virLockManagerPluginPtr plugin, - const char *uri, - virDomainObjPtr dom, - virDomainDiskDefPtr disk); -int virDomainLockDiskDetach(virLockManagerPluginPtr plugin, - virDomainObjPtr dom, - virDomainDiskDefPtr disk); - int virDomainLockImageAttach(virLockManagerPluginPtr plugin, const char *uri, virDomainObjPtr dom, diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index cf088632dc..e37caf46b5 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -106,8 +106,8 @@ qemuHotplugPrepareDiskAccess(virQEMUDriverPtr driver, goto rollback_cgroup; } - if (virDomainLockDiskAttach(driver->lockManager, cfg->uri, - vm, disk) < 0) + if (virDomainLockImageAttach(driver->lockManager, cfg->uri, + vm, disk->src) < 0) goto cleanup; if (qemuDomainNamespaceSetupDisk(vm, disk->src) < 0) @@ -137,7 +137,7 @@ qemuHotplugPrepareDiskAccess(virQEMUDriverPtr driver, NULLSTR(virDomainDiskGetSource(disk))); rollback_lock: - if (virDomainLockDiskDetach(driver->lockManager, vm, disk) < 0) + if (virDomainLockImageDetach(driver->lockManager, vm, disk->src) < 0) VIR_WARN("Unable to release lock on %s", NULLSTR(virDomainDiskGetSource(disk)));