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

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


# HG changeset patch
# User Heidi Eckhart <heidieck at linux.vnet.ibm.com>
# Date 1196339009 -3600
# Node ID 36e16117e8b18e85a4898879091b919074dc44dc
# Parent  38068b513857c8cb64a3f5c808f0bd42e272dfb9
ESD: 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 38068b513857 -r 36e16117e8b1 src/Virt_ElementSettingData.c
--- a/src/Virt_ElementSettingData.c	Thu Nov 29 13:11:04 2007 +0100
+++ b/src/Virt_ElementSettingData.c	Thu Nov 29 13:23:29 2007 +0100
@@ -129,17 +129,18 @@ static CMPIInstance *make_ref(const CMPI
                               struct std_assoc_info *info,
                               struct std_assoc *assoc)
 {
+        CMPIStatus s = {CMPI_RC_OK, NULL};
         CMPIInstance *refinst = NULL;
-        char *base;
+        virConnectPtr conn = NULL;
         uint16_t prop_value = 1;
 
-        base = class_base_name(assoc->assoc_class);
-        if (base == NULL)
-                goto out;
+        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),
+                                     "ElementSettingData",
                                      NAMESPACE(ref));
 
         if (refinst != NULL) {
@@ -165,33 +166,55 @@ static CMPIInstance *make_ref(const CMPI
                         (CMPIValue *)&prop_value, CMPI_uint16);
         }
 
-out:
-        free(base);
+        virConnectClose(conn);
 
         return refinst;
 }
 
+char* virtual_system_setting_data[] = {
+        "Xen_VirtualSystemSettingData",
+        "KVM_VirtualSystemSettingData",        
+        NULL
+};
+
+char* resource_allocation_setting_data[] = {
+        "Xen_ResourceAllocationSettingData",
+        "KVM_ResourceAllocationSettingData",        
+        NULL
+};
+
+char* managed_element[] = {
+        "CIM_ManagedElement",
+        NULL
+};
+
+char* assoc_classname[] = {
+        "Xen_ElementSettingData",
+        "KVM_ElementSettingData",        
+        NULL
+};
+
 static struct std_assoc _vssd_to_vssd = {
-        .source_class = "CIM_VirtualSystemSettingData",
+        .source_class = (char**)&virtual_system_setting_data,
         .source_prop = "ManagedElement",
 
-        .target_class = "CIM_ManagedElement",
+        .target_class = (char**)&managed_element,
         .target_prop = "SettingData",
 
-        .assoc_class = "CIM_ElementSettingData",
+        .assoc_class = (char**)&assoc_classname,
 
         .handler = vssd_to_vssd,
         .make_ref = make_ref
 };
 
 static struct std_assoc _rasd_to_rasd = {
-        .source_class = "CIM_ResourceAllocationSettingData",
+        .source_class = (char**)&resource_allocation_setting_data,
         .source_prop = "ManagedElement",
 
-        .target_class = "CIM_ManagedElement",
+        .target_class = (char**)&managed_element,
         .target_prop = "SettingData",
 
-        .assoc_class = "CIM_ElementSettingData",
+        .assoc_class = (char**)&assoc_classname,
 
         .handler = rasd_to_rasd,
         .make_ref = make_ref




More information about the Libvirt-cim mailing list