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

Dan Smith danms at us.ibm.com
Thu Feb 28 18:07:47 UTC 2008


# HG changeset patch
# User Dan Smith <danms at us.ibm.com>
# Date 1204222059 28800
# Node ID 7dccdf33b9b102e8c1a2ffb2ae34292a61ec512e
# Parent  ab774ea93302e6173b0749a27d7d951469eccc62
Add TypesSupported[] to VirtualSystemManagementCapabilities

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

diff -r ab774ea93302 -r 7dccdf33b9b1 src/Virt_VirtualSystemManagementCapabilities.c
--- a/src/Virt_VirtualSystemManagementCapabilities.c	Thu Feb 28 10:02:10 2008 -0800
+++ b/src/Virt_VirtualSystemManagementCapabilities.c	Thu Feb 28 10:07:39 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_stringA);
+
+ 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