[Libvirt-cim] [PATCH] Move get_disk_pool() to SDC

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Thu Aug 6 23:56:28 UTC 2009


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1249602804 25200
# Node ID 2cb7c25bb35e7cb7b532ed78a43a3f27cb9fcf4f
# Parent  af509ca0e7f25db4e7ce96dff8bc77df6289e9b3
Move get_disk_pool() to SDC...

libvirt-cim won't build with versions of libvirt that don't have disk pool
support.  Since only the SDC provider needs this function, move it there and
place it under a #if VIR_USE_LIBVIRT_STORAGE tag to ensure it doesn't get built
with older versions of libvirt.

Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>

diff -r af509ca0e7f2 -r 2cb7c25bb35e libxkutil/pool_parsing.c
--- a/libxkutil/pool_parsing.c	Thu Aug 06 14:59:23 2009 -0700
+++ b/libxkutil/pool_parsing.c	Thu Aug 06 16:53:24 2009 -0700
@@ -230,26 +230,6 @@
         return ret;
 }
 
-int get_disk_pool(virStoragePoolPtr poolptr, struct virt_pool **pool)
-{
-        char *xml;
-        int ret;
-
-        xml = virStoragePoolGetXMLDesc(poolptr, 0);
-        if (xml == NULL)
-                return 0;
-
-        *pool = malloc(sizeof(**pool));
-        if (*pool == NULL)
-                return 0;
-
-        ret = get_pool_from_xml(xml, *pool, CIM_RES_TYPE_DISK);
-
-        free(xml);
-
-        return ret;
-}
-
 int define_pool(virConnectPtr conn, const char *xml, int res_type)
 {
         int ret = 1;
diff -r af509ca0e7f2 -r 2cb7c25bb35e libxkutil/pool_parsing.h
--- a/libxkutil/pool_parsing.h	Thu Aug 06 14:59:23 2009 -0700
+++ b/libxkutil/pool_parsing.h	Thu Aug 06 16:53:24 2009 -0700
@@ -67,7 +67,6 @@
 void cleanup_virt_pool(struct virt_pool **pool);
 
 int get_pool_from_xml(const char *xml, struct virt_pool *pool, int type);
-int get_disk_pool(virStoragePoolPtr poolptr, struct virt_pool **pool);
 
 int define_pool(virConnectPtr conn, const char *xml, int res_type);
 int destroy_pool(virConnectPtr conn, const char *name, int res_type);
diff -r af509ca0e7f2 -r 2cb7c25bb35e src/Virt_SettingsDefineCapabilities.c
--- a/src/Virt_SettingsDefineCapabilities.c	Thu Aug 06 14:59:23 2009 -0700
+++ b/src/Virt_SettingsDefineCapabilities.c	Thu Aug 06 16:53:24 2009 -0700
@@ -1027,6 +1027,26 @@
 }
 
 #if VIR_USE_LIBVIRT_STORAGE
+static int get_disk_pool(virStoragePoolPtr poolptr, struct virt_pool **pool)
+{
+        char *xml;
+        int ret;
+
+        xml = virStoragePoolGetXMLDesc(poolptr, 0);
+        if (xml == NULL)
+                return 0;
+
+        *pool = malloc(sizeof(**pool));
+        if (*pool == NULL)
+                return 0;
+
+        ret = get_pool_from_xml(xml, *pool, CIM_RES_TYPE_DISK);
+
+        free(xml);
+
+        return ret;
+}
+
 static CMPIStatus new_volume_template(const CMPIObjectPath *ref,
                                       int template_type,
                                       virStoragePoolPtr poolptr,




More information about the Libvirt-cim mailing list