[Libvirt-cim] [PATCH] (#2) Set SourceInstance{Host, ModelPath} in migration indications

Dan Smith danms at us.ibm.com
Wed Jul 2 15:57:11 UTC 2008


# HG changeset patch
# User Dan Smith <danms at us.ibm.com>
# Date 1215014224 25200
# Node ID 35d00def6476eb4e21b3a26837682362917f9915
# Parent  cb343a986592c25c487c53042ad889fa24ea9d97
(#2) Set SourceInstance{Host,ModelPath} in migration indications

This is a total hack at the moment, because we don't persist any
platform details in the job (since only Xen is supported at the moment).
When we do, this can be cleaned up.  However, it works for now and would
be good to get in place.

Changes:
 - Add SourceInstanceModelPath as well

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

diff -r cb343a986592 -r 35d00def6476 src/Virt_VSMigrationService.c
--- a/src/Virt_VSMigrationService.c	Tue Jul 01 12:47:31 2008 -0700
+++ b/src/Virt_VSMigrationService.c	Wed Jul 02 08:57:04 2008 -0700
@@ -712,12 +712,47 @@
 {
         char *type;
         CMPIStatus s;
+        CMPIObjectPath *ref;
         const char *ind_name = NULL;
+        const char *host = NULL;
+        const char *ccname = NULL;
 
         if (ind == NULL)
                 return false;
 
         ind_name = ind_type_to_name(ind_type);
+
+        /* FIXME: This is a hack until we un-Xenify this provider */
+        ref = CMNewObjectPath(_BROKER, ns, "Xen_Foo", &s);
+        if ((ref == NULL) || (s.rc != CMPI_RC_OK)) {
+                CU_DEBUG("Failed to get job reference");
+        } else {
+                s = get_host_system_properties(&host, &ccname, ref, _BROKER);
+                if (s.rc == CMPI_RC_OK) {
+                        CMSetProperty(ind, "SourceInstanceHost",
+                                      (CMPIValue *)host, CMPI_chars);
+                } else {
+                        CU_DEBUG("Unable to get HostSystem properties");
+                }
+        }
+
+        /* FIXME: This should be merged with above once the job path is
+         *        properly typed
+         */
+        ref = CMGetObjectPath(inst, &s);
+        if ((ref == NULL) || (s.rc != CMPI_RC_OK)) {
+                CU_DEBUG("Failed to get job reference");
+        } else {
+                CMPIString *str;
+
+                str = CMObjectPathToString(ref, &s);
+                if ((str == NULL) || (s.rc != CMPI_RC_OK)) {
+                        CU_DEBUG("Failed to get path string");
+                } else {
+                        CMSetProperty(ind, "SourceInstanceModelPath",
+                                      (CMPIValue *)&str, CMPI_string);
+                }
+        }
 
         CU_DEBUG("Setting SourceInstance");
         CMSetProperty(ind, "SourceInstance",




More information about the Libvirt-cim mailing list