[Libvirt-cim] [PATCH] Enhance default setting of property CreationClassName

Heidi Eckhart heidieck at linux.vnet.ibm.com
Fri Feb 22 09:52:44 UTC 2008


# HG changeset patch
# User Heidi Eckhart <heidieck at linux.vnet.ibm.com>
# Date 1203673820 -3600
# Node ID e6f0c8edd6bf2fff9681195e3edc8c1d601fe78f
# Parent  b9cbac659a845feda6f170fe23663ea7f187bf21
Enhance default setting of property CreationClassName

Not all CIM classes define the property CreationClassName.
This patch adds a check if CreationClassName is property of
the class and sets it only if there.
Signed-off-by: Heidi Eckhart <heidieck at linux.vnet.ibm.com>

diff -r b9cbac659a84 -r e6f0c8edd6bf libxkutil/misc_util.c
--- a/libxkutil/misc_util.c	Fri Feb 22 10:34:21 2008 +0100
+++ b/libxkutil/misc_util.c	Fri Feb 22 10:50:20 2008 +0100
@@ -236,6 +236,7 @@ CMPIInstance *get_typed_instance(const C
         CMPIObjectPath *op;
         CMPIInstance *inst = NULL;
         CMPIStatus s;
+        CMPIData data;
 
         new_cn = get_typed_class(refcn, base);
         if (new_cn == NULL)
@@ -248,9 +249,11 @@ CMPIInstance *get_typed_instance(const C
         inst = CMNewInstance(broker, op, &s);
         if ((s.rc != CMPI_RC_OK) || CMIsNullObject(inst))
                 goto out;
-
-        CMSetProperty(inst, "CreationClassName",
-                      (CMPIValue *)new_cn, CMPI_chars);
+        
+        data = CMGetProperty(inst, "CreationClassName", &s);
+        if (s.rc == CMPI_RC_OK)
+                CMSetProperty(inst, "CreationClassName",
+                              (CMPIValue *)new_cn, CMPI_chars);
 
  out:
         free(new_cn);




More information about the Libvirt-cim mailing list