[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 09/11] 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 <pkrempa redhat com>
---
 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 599b97569a..ffabb66867 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1291,8 +1291,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 e30c9891d2..0d8c5aec3a 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -3050,9 +3050,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,
@@ -3060,8 +3060,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));
                     }
@@ -3349,8 +3349,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 015f1837ab..b08f443fbc 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)));

-- 
2.20.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]