[Libvirt-cim] [PATCH 5 of 5] RAFP: adopt RASD interface changes

Heidi Eckhart heidieck at linux.vnet.ibm.com
Thu Mar 6 12:38:16 UTC 2008


# HG changeset patch
# User Heidi Eckhart <heidieck at linux.vnet.ibm.com>
# Date 1204806485 -3600
# Node ID 0b7289fc81a8965c8376d69f0b0d43ff37e76de0
# Parent  c52aea6200a31e7f7dcb367124f036980f5beb36
RAFP: adopt RASD interface changes
Signed-off-by: Heidi Eckhart <heidieck at linux.vnet.ibm.com>

diff -r c52aea6200a3 -r 0b7289fc81a8 src/Virt_ResourceAllocationFromPool.c
--- a/src/Virt_ResourceAllocationFromPool.c	Thu Mar 06 13:28:04 2008 +0100
+++ b/src/Virt_ResourceAllocationFromPool.c	Thu Mar 06 13:28:05 2008 +0100
@@ -51,7 +51,7 @@ static CMPIStatus rasd_to_pool(const CMP
         if (!match_hypervisor_prefix(ref, info))
                 return s;
 
-        if (rasd_type_from_classname(CLASSNAME(ref), &type) != CMPI_RC_OK) {
+        if (res_type_from_rasd_classname(CLASSNAME(ref), &type) != CMPI_RC_OK) {
                 cu_statusf(_BROKER, &s,
                            CMPI_RC_ERR_FAILED,
                            "Unable to determine RASD type");
@@ -77,10 +77,7 @@ static CMPIStatus rasd_to_pool(const CMP
                 goto out;
         }
 
-        s = get_pool_by_name(_BROKER,
-                             ref,
-                             poolid,
-                             &pool);
+        s = get_pool_by_name(_BROKER, ref, poolid, &pool);
         if (s.rc != CMPI_RC_OK)
                 goto out;
 
@@ -109,7 +106,7 @@ static int filter_by_pool(struct inst_li
                 if (op == NULL)
                         continue;
 
-                if (rasd_type_from_classname(CLASSNAME(op), &type) !=
+                if (res_type_from_rasd_classname(CLASSNAME(op), &type) !=
                     CMPI_RC_OK)
                         continue;
 
@@ -123,52 +120,6 @@ static int filter_by_pool(struct inst_li
         return dest->cur;
 }
 
-static int rasds_from_pool(uint16_t type,
-                           const CMPIObjectPath *ref,
-                           const char *poolid,
-                           const char **properties,
-                           struct inst_list *list)
-{
-        CMPIStatus s;
-        virConnectPtr conn = NULL;
-        virDomainPtr *doms = NULL;
-        int count;
-        int i;
-
-        conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s);
-        if (conn == NULL)
-                return 0;
-
-        count = get_domain_list(conn, &doms);
-
-        for (i = 0; i < count; i++) {
-                const char *name;
-                struct inst_list tmp;
-
-                inst_list_init(&tmp);
-
-                name = virDomainGetName(doms[i]);
-
-                rasds_for_domain(_BROKER,
-                                 name,
-                                 type,
-                                 ref,
-                                 properties,
-                                 &tmp);
-
-                filter_by_pool(list, &tmp, poolid);
-
-                inst_list_free(&tmp);
-
-                virDomainFree(doms[i]);
-        }
-
-        free(doms);
-        virConnectClose(conn);
-
-        return count;
-}
-
 static CMPIStatus pool_to_rasd(const CMPIObjectPath *ref,
                                struct std_assoc_info *info,
                                struct inst_list *list)
@@ -176,7 +127,8 @@ static CMPIStatus pool_to_rasd(const CMP
         CMPIStatus s = {CMPI_RC_OK, NULL};
         const char *poolid;
         uint16_t type;
-        CMPIInstance *inst;
+        CMPIInstance *inst = NULL;
+        struct inst_list tmp_list;
 
         if (!match_hypervisor_prefix(ref, info))
                 goto out;
@@ -200,11 +152,12 @@ static CMPIStatus pool_to_rasd(const CMP
                 goto out;
         }
 
-        rasds_from_pool(type, 
-                        ref,
-                        poolid,
-                        info->properties,
-                        list);
+        inst_list_init(&tmp_list);
+
+        s = enum_rasds(_BROKER, ref, NULL, type,
+                       info->properties, &tmp_list);
+
+        filter_by_pool(list, &tmp_list, poolid);
 
  out:
         return s;




More information about the Libvirt-cim mailing list