]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
storage: Introduce virStoragePoolObjFindPoolByUUID
authorJohn Ferlan <jferlan@redhat.com>
Mon, 2 Nov 2015 22:15:41 +0000 (17:15 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 12 Nov 2015 11:30:32 +0000 (06:30 -0500)
Add a new API to search the currently defined pool list for a pool with
a matching UUID and return the locked pool object pointer.

src/storage/storage_driver.c
src/storage/storage_driver.h

index aeb67a715b7b8c9a0f77cd8a582d2d3b92308ff6..bbf21f684f8d5c80f8f75969c67d445855093bc9 100644 (file)
@@ -3370,3 +3370,24 @@ virStorageTranslateDiskSourcePool(virConnectPtr conn,
     virStoragePoolDefFree(pooldef);
     return ret;
 }
+
+
+/*
+ * virStoragePoolObjFindPoolByUUID
+ * @uuid: The uuid to lookup
+ *
+ * Using the passed @uuid, search the driver pools for a matching uuid.
+ * If found, then lock the pool
+ *
+ * Returns NULL if pool is not found or a locked pool object pointer
+ */
+virStoragePoolObjPtr
+virStoragePoolObjFindPoolByUUID(const unsigned char *uuid)
+{
+    virStoragePoolObjPtr pool;
+
+    storageDriverLock();
+    pool = virStoragePoolObjFindByUUID(&driver->pools, uuid);
+    storageDriverUnlock();
+    return pool;
+}
index 4f28dc155d9388be974a2f483f8b74dee474f0c9..912c232c38076119e96ff295581ae4da682cd1dd 100644 (file)
@@ -57,6 +57,9 @@ int virStorageFileGetMetadata(virStorageSourcePtr src,
 int virStorageTranslateDiskSourcePool(virConnectPtr conn,
                                       virDomainDiskDefPtr def);
 
+virStoragePoolObjPtr virStoragePoolObjFindPoolByUUID(const unsigned char *uuid)
+    ATTRIBUTE_NONNULL(1);
+
 virStoragePoolPtr
 storagePoolLookupByTargetPath(virConnectPtr conn,
                               const char *path)