[Libvirt-cim] [PATCH 2 of 4] Fix VSMigrationService NULL key attributes

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Mon Dec 17 18:25:21 UTC 2007


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1197915794 28800
# Node ID 77463a23a25e77b2dafc4f0a6723366ebd6961e1
# Parent  e147f8dd86aa3422d81610b5d9e659f7f5aada70
Fix VSMigrationService NULL key attributes.

The SystemCreationClassName and SystemName keys are NULL, these should be set. These values can be retrieved using get_host_system_properties().

Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>

diff -r e147f8dd86aa -r 77463a23a25e src/Virt_VSMigrationService.c
--- a/src/Virt_VSMigrationService.c	Mon Dec 17 10:23:09 2007 -0800
+++ b/src/Virt_VSMigrationService.c	Mon Dec 17 10:23:14 2007 -0800
@@ -36,6 +36,7 @@
 #include <libcmpiutil/std_invokemethod.h>
 
 #include "Virt_VSMigrationService.h"
+#include "Virt_HostSystem.h"
 
 #define CIM_JOBSTATE_STARTING 3
 #define CIM_JOBSTATE_RUNNING 4
@@ -639,6 +640,8 @@ CMPIStatus get_migration_service(const C
 {
         CMPIInstance *inst;
         CMPIStatus s = {CMPI_RC_OK, NULL};
+        const char *name = NULL;
+        const char *ccname = NULL;
 
         inst = get_typed_instance(broker,
                                   CLASSNAME(ref),
@@ -648,14 +651,34 @@ CMPIStatus get_migration_service(const C
                 cu_statusf(broker, &s,
                            CMPI_RC_ERR_FAILED,
                            "Unable to get instance for %s", CLASSNAME(ref));
-                return s;
+                goto out;
+        }
+
+        s = get_host_system_properties(&name, 
+                                       &ccname, 
+                                       ref, 
+                                       broker);
+        if (s.rc != CMPI_RC_OK) {
+                cu_statusf(broker, &s,
+                           CMPI_RC_ERR_FAILED,
+                           "Unable to get host attributes");
+                goto out;
         }
 
         CMSetProperty(inst, "Name",
                       (CMPIValue *)"MigrationService", CMPI_chars);
 
+        CMSetProperty(inst, "SystemName",
+                      (CMPIValue *)name, CMPI_chars);
+
+        CMSetProperty(inst, "SystemCreationClassName",
+                      (CMPIValue *)ccname, CMPI_chars);
+
+        CMSetStatus(&s, CMPI_RC_OK);
+ 
         *_inst = inst;
 
+ out:
         return s;
 }
 




More information about the Libvirt-cim mailing list