[Libvirt-cim] [PATCH] Add TypesSupported[] to VirtualSystemManagementCapabilities

Dan Smith danms at us.ibm.com
Wed Feb 27 22:09:19 UTC 2008


# HG changeset patch
# User Dan Smith <danms at us.ibm.com>
# Date 1204150157 28800
# Node ID 534a933e0202dc425f3f27ba55dfa42e7c42db5f
# Parent  224ad7217cef6235bccb3377b9b86114ed61d6ae
Add TypesSupported[] to VirtualSystemManagementCapabilities

Signed-off-by: Dan Smith <danms at us.ibm.com>

diff -r 224ad7217cef -r 534a933e0202 src/Virt_VirtualSystemManagementCapabilities.c
--- a/src/Virt_VirtualSystemManagementCapabilities.c	Wed Feb 27 13:49:31 2008 -0800
+++ b/src/Virt_VirtualSystemManagementCapabilities.c	Wed Feb 27 14:09:17 2008 -0800
@@ -46,11 +46,14 @@ enum {ADD_RESOURCES = 1,
                          
 
 static CMPIStatus set_inst_properties(const CMPIBroker *broker,
+                                      const CMPIObjectPath *ref,
                                       CMPIInstance *inst)
 {
         CMPIStatus s = {CMPI_RC_OK, NULL};
         CMPIArray *array;
         uint16_t element;
+        char *prefix = NULL;
+        CMPIString *str;
 
         CMSetProperty(inst, "InstanceID",
                       (CMPIValue *)"ManagementCapabilities", CMPI_chars);
@@ -73,7 +76,29 @@ static CMPIStatus set_inst_properties(co
 
         CMSetProperty(inst, "SynchronousMethodsSupported",
                       (CMPIValue *)&array, CMPI_uint16A);
- out:
+
+        prefix = class_prefix_name(CLASSNAME(ref));
+        if (prefix == NULL) {
+                CU_DEBUG("Prefix of %s was NULL", CLASSNAME(ref));
+                goto out;
+        }
+
+        str = CMNewString(broker, prefix, &s);
+        if ((str == NULL) || (s.rc != CMPI_RC_OK))
+                goto out;
+
+        array = CMNewArray(broker, 1, CMPI_string, &s);
+        if ((s.rc != CMPI_RC_OK) || (CMIsNullObject(array)))
+                goto out;
+
+        CMSetArrayElementAt(array, 0, (CMPIValue *)&str, CMPI_string);
+
+        CMSetProperty(inst, "TypesSupported",
+                      (CMPIValue *)&array, CMPI_charsA);
+
+ out:
+        free(prefix);
+
         return s;
 }
 
@@ -106,7 +131,7 @@ CMPIStatus get_vsm_cap(const CMPIBroker 
                 goto out;
         }
 
-        s = set_inst_properties(broker, inst);
+        s = set_inst_properties(broker, ref, inst);
 
         if (is_get_inst) {
                 s = cu_validate_ref(broker, ref, inst);




More information about the Libvirt-cim mailing list