[Libvirt-cim] [PATCH 1 of 2] Add get_all_pools to Virt_DevicePool, which gets every pool it can find, per Dan's suggestion

Jay Gagnon grendel at linux.vnet.ibm.com
Tue Nov 20 18:57:37 UTC 2007


# HG changeset patch
# User Jay Gagnon <grendel at linux.vnet.ibm.com>
# Date 1195588594 18000
# Node ID 2e1dc075f0a9996bfdd2f437928d261081c1f9d6
# Parent  97e1dd20b2d02b5b542ec830093954f265ae844f
Add get_all_pools to Virt_DevicePool, which gets every pool it can find, per Dan's suggestion.

Signed-off-by: Jay Gagnon <grendel at linux.vnet.ibm.com>

diff -r 97e1dd20b2d0 -r 2e1dc075f0a9 src/Virt_DevicePool.c
--- a/src/Virt_DevicePool.c	Tue Nov 20 06:41:27 2007 -0800
+++ b/src/Virt_DevicePool.c	Tue Nov 20 14:56:34 2007 -0500
@@ -624,6 +624,28 @@ CMPIInstance *get_pool_by_id(const CMPIB
         return inst;
 }
 
+CMPIStatus get_all_pools(const CMPIBroker *broker,
+                         virConnectPtr conn,
+                         const char *ns,
+                         struct inst_list *list)
+{
+        int i;
+        CMPIStatus s = {CMPI_RC_OK};
+
+        for (i = 0; device_pool_names[i]; i++) {
+                s = get_pool_by_type(broker,
+                                     conn,
+                                     device_pool_names[i],
+                                     ns,
+                                     list);
+                if (s.rc != CMPI_RC_OK)
+                        goto out;
+        }
+
+ out:
+        return s;
+}
+
 static void __return_pool(const CMPIResult *results,
                           struct inst_list *list,
                           bool name_only)
diff -r 97e1dd20b2d0 -r 2e1dc075f0a9 src/Virt_DevicePool.h
--- a/src/Virt_DevicePool.h	Tue Nov 20 06:41:27 2007 -0800
+++ b/src/Virt_DevicePool.h	Tue Nov 20 14:56:34 2007 -0500
@@ -55,6 +55,18 @@ char *pool_member_of(const CMPIBroker *b
                      uint16_t type,
                      const char *id);
 
+/**
+ * Get all device pools on the system for the given connection
+ *
+ * @param broker The current Broker
+ * @param conn The libvirt connection to use
+ * @param ns Namespace for the pools
+ * @param list Return instances in this struct
+ */
+CMPIStatus get_all_pools(const CMPIBroker *broker,
+                         virConnectPtr conn,
+                         const char *ns,
+                         struct inst_list *list);
 #endif
 
 /*




More information about the Libvirt-cim mailing list