[Libvirt-cim] [PATCH] Add domain UUID and timestamp ComputerSystem and MigrationJob indications

Chip Vincent cvincent at linux.vnet.ibm.com
Wed Dec 8 18:32:17 UTC 2010


# HG changeset patch
# User Chip Vincent <cvincent at us.ibm.com>
# Date 1291832982 18000
# Node ID 00c3b5396d9cd7c4396b8b72fdb09257a0328116
# Parent  e82f482d4bd2eae19970f9b9a42caecaf46ebeab
Add domain UUID and timestamp to ComputerSystem and MigrationJob Indications

This patch allows clients to better correlate indications by domain and 
enables
sequencing using the indication datetime.

Signed-off-by: Chip Vincent <cvincent at us.ibm.com>

diff -r e82f482d4bd2 -r 00c3b5396d9c src/Virt_ComputerSystemIndication.c
--- a/src/Virt_ComputerSystemIndication.c       Tue Nov 30 13:33:45 2010 
-0500
+++ b/src/Virt_ComputerSystemIndication.c       Wed Dec 08 13:29:42 2010 
-0500
@@ -232,6 +232,8 @@
         CMPIObjectPath *affected_op;
         CMPIObjectPath *ind_op;
         CMPIInstance *ind;
+       CMPIData uuid;
+       CMPIDateTime *timestamp;
         CMPIStatus s;
         bool ret = true;
 
@@ -278,7 +280,15 @@
         }
         CMSetNameSpace(affected_op, args->ns);
 
-        if (ind_type == CS_MODIFIED) {
+        uuid = CMGetProperty(affected_inst, "UUID", &s);
+       CMSetProperty(ind, "IndicationIdentifier",
+               (CMPIValue *)&uuid, CMPI_string);
+
+       timestamp =  CMNewDateTime(broker, &s);
+       CMSetProperty(ind, "IndicationTime",
+               (CMPIValue *)timestamp, CMPI_dateTime);
+
+       if (ind_type == CS_MODIFIED) {
                 CMSetProperty(ind, "PreviousInstance",
                               (CMPIValue *)&prev_inst, CMPI_instance);
         }
diff -r e82f482d4bd2 -r 00c3b5396d9c src/Virt_VSMigrationService.c
--- a/src/Virt_VSMigrationService.c     Tue Nov 30 13:33:45 2010 -0500
+++ b/src/Virt_VSMigrationService.c     Wed Dec 08 13:29:42 2010 -0500
@@ -811,8 +811,11 @@
         CMPIInstance *ind = NULL;
         CMPIInstance *prev_inst = NULL;
         const char *pfx = NULL;
-
-        ind_name = ind_type_to_name(ind_type);
+       virDomainPtr dom = NULL;
+        char uuid[VIR_UUID_STRING_BUFLEN];
+       CMPIDateTime *timestamp = NULL;
+       
+       ind_name = ind_type_to_name(ind_type);
 
         CU_DEBUG("Creating indication.");
 
@@ -827,6 +830,24 @@
                          job->ref_ns, pfx, ind_name);
                 goto out;
         }
+
+       dom = virDomainLookupByName(job->conn, job->domain);
+       if(dom == NULL) {
+               CU_DEBUG("Failed to connect to domain %s", job->domain);
+               goto out;
+       }
+
+       if(virDomainGetUUIDString(dom, uuid) != 0) {
+               CU_DEBUG("Failed to get UUID from domain name");
+               goto out;
+       }
+
+       CMSetProperty(ind, "IndicationIdentifier",
+               (CMPIValue *)uuid, CMPI_chars);
+
+       timestamp = CMNewDateTime(broker, s);
+       CMSetProperty(ind, "IndicationTime",
+               (CMPIValue *)timestamp, CMPI_dateTime);
 
         if (ind_type == MIG_MODIFIED) {
                 /* Need to copy job inst before attaching as 
PreviousInstance
@@ -844,6 +865,7 @@
         }
 
  out:
+       virDomainFree(dom);
         return ind;
 }
 

-- 
Chip Vincent
Open Virtualization, Linux Technology Center
IBM Systems & Technology Group
phone: 919-254-4482, T/L 444-4482
email: cvincent at us.ibm.com




More information about the Libvirt-cim mailing list