[Libvirt-cim] [PATCH 09 of 12] SDC: Adoption of changes to std_assoc struct in std_association

Heidi Eckhart heidieck at linux.vnet.ibm.com
Fri Nov 30 09:03:08 UTC 2007


# HG changeset patch
# User Heidi Eckhart <heidieck at linux.vnet.ibm.com>
# Date 1196416068 -3600
# Node ID 2c0219a348890f647293a75b2c62fb2a7074f8f9
# Parent  e6c901ef8a7f82d8bec41a646d0faf87d1d5ee81
SDC: Adoption of changes to std_assoc struct in std_association

This is the follow up patch to the API changes made in
std_association. The struct std_assoc does now take lists
for source, target and assoc classnames.
Signed-off-by: Heidi Eckhart <heidieck at linux.vnet.ibm.com>

diff -r e6c901ef8a7f -r 2c0219a34889 src/Virt_SettingsDefineCapabilities.c
--- a/src/Virt_SettingsDefineCapabilities.c	Fri Nov 30 10:47:46 2007 +0100
+++ b/src/Virt_SettingsDefineCapabilities.c	Fri Nov 30 10:47:48 2007 +0100
@@ -782,7 +782,7 @@ static CMPIStatus alloc_cap_to_rasd(cons
         CU_DEBUG("Getting ResourceType.");
 
         ret = cu_get_u16_path(ref, "ResourceType", &type);
-        if (ret != 1) {
+        if (ret != CMPI_RC_OK) {
                 CMSetStatusWithChars(_BROKER, &s, CMPI_RC_ERR_FAILED,
                                      "Could not get ResourceType.");
                 goto out;
@@ -811,16 +811,17 @@ static CMPIInstance *make_ref(const CMPI
                               struct std_assoc_info *info,
                               struct std_assoc *assoc)
 {
-        CMPIInstance *refinst;
-        char *base;
-
-        base = class_base_name(assoc->assoc_class);
-        if (base == NULL)
+        CMPIStatus s = {CMPI_RC_OK, NULL};
+        CMPIInstance *refinst = NULL;
+        virConnectPtr conn = NULL;
+
+        conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s);
+        if (conn == NULL)
                 return NULL;
 
         refinst = get_typed_instance(_BROKER,
-                                     CLASSNAME(ref),
-                                     base,
+                                     pfx_from_conn(conn),
+                                     "SettingsDefineCapabilities",
                                      NAMESPACE(ref));
 
         if (refinst != NULL) {
@@ -834,32 +835,50 @@ static CMPIInstance *make_ref(const CMPI
                               (CMPIValue *)&instop, CMPI_ref);
         }
 
-        free(base);
+        virConnectClose(conn);
 
         return refinst;
 }
 
+char* group_component[] = {
+        "Xen_AllocationCapabilities",
+        "KVM_AllocationCapabilities",
+        NULL
+};
+
+char* part_component[] = {
+        "Xen_ResourceAllocationSettingData",
+        "KVM_ResourceAllocationSettingData",
+        NULL
+};
+
+char* assoc_classname[] = {
+        "Xen_SettingsDefineCapabilities",
+        "KVM_SettingsDefineCapabilities",        
+        NULL
+};
+
 struct std_assoc _alloc_cap_to_rasd = {
-        .source_class = "CIM_AllocationCapabilities",
+        .source_class = (char**)&group_component,
         .source_prop = "GroupComponent",
 
-        .target_class = "CIM_ResourceAllocationSettingData",
+        .target_class = (char**)&part_component,
         .target_prop = "PartComponent",
 
-        .assoc_class = "CIM_SettingsDefineCapabilities",
+        .assoc_class = (char**)&assoc_classname,
 
         .handler = alloc_cap_to_rasd,
         .make_ref = make_ref
 };
 
 struct std_assoc _rasd_to_alloc_cap = {
-        .source_class = "CIM_ResourceAllocationSettingData",
+        .source_class = (char**)&part_component,
         .source_prop = "PartComponent",
 
-        .target_class = "CIM_AllocationCapabilities",
+        .target_class = (char**)&group_component,
         .target_prop = "GroupComponent",
 
-        .assoc_class = "CIM_SettingsDefineCapabilities",
+        .assoc_class = (char**)&assoc_classname,
 
         .handler = rasd_to_alloc_cap,
         .make_ref = make_ref




More information about the Libvirt-cim mailing list