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

Heidi Eckhart heidieck at linux.vnet.ibm.com
Thu Feb 21 12:09:10 UTC 2008


# HG changeset patch
# User Heidi Eckhart <heidieck at linux.vnet.ibm.com>
# Date 1203595620 -3600
# Node ID 3c39412cd297e3ea3d152f6a2ca2119236290093
# Parent  6fffc34df9c9b5cd1915f1fdd9f196b1f12a2477
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 6fffc34df9c9 -r 3c39412cd297 libxkutil/misc_util.c
--- a/libxkutil/misc_util.c	Thu Feb 21 12:55:13 2008 +0100
+++ b/libxkutil/misc_util.c	Thu Feb 21 13:07:00 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