[Libvirt-cim] [PATCH] (#2) Return migration job status in CIM_ConcreteJob.ErrorCode

Sharad Mishra snmishra at us.ibm.com
Thu Sep 22 19:54:27 UTC 2011


# HG changeset patch
# User Sharad Mishra <snmishra at us.ibm.com>
# Date 1316721127 25200
# Node ID 859a175208e057acfe6980332abbfa8ca6075f67
# Parent  db809376d763493849c2a19f587969eaec619b75
(#2) Return migration job status in CIM_ConcreteJob.ErrorCode

This patch returns migration job status using the ErrorCode
property. A successful migration returns 0 and a non-zero
value  is returned on failed migration.

#2: Changed success return from CMPI_RC_OK to 0.

Signed-off-by:  Sharad Mishra <snmishra at us.ibm.com>

diff -r db809376d763 -r 859a175208e0 src/Virt_VSMigrationService.c
--- a/src/Virt_VSMigrationService.c	Thu Jul 28 13:56:00 2011 -0300
+++ b/src/Virt_VSMigrationService.c	Thu Sep 22 12:52:07 2011 -0700
@@ -930,6 +930,7 @@
 
 static void migrate_job_set_state(struct migration_job *job,
                                   uint16_t state,
+                                  int error_code,
                                   const char *status)
 {
         CMPIInstance *inst;
@@ -953,10 +954,13 @@
 
         CMSetProperty(inst, "JobState",
                       (CMPIValue *)&state, CMPI_uint16);
+        CMSetProperty(inst, "ErrorCode",
+                      (CMPIValue *)&error_code, CMPI_uint16);
         CMSetProperty(inst, "Status",
                       (CMPIValue *)status, CMPI_chars);
 
-        CU_DEBUG("Modifying job %s (%i:%s)", job->uuid, state, status);
+        CU_DEBUG("Modifying job %s (%i:%s) Error Code is  %i", 
+                  job->uuid, state, status, error_code);
 
         s = CBModifyInstance(_BROKER, job->context, op, inst, NULL);
         if (s.rc != CMPI_RC_OK)
@@ -1279,7 +1283,7 @@
         CBAttachThread(_BROKER, job->context);
 
         CU_DEBUG("Migration Job %s started", job->uuid);
-        migrate_job_set_state(job, CIM_JOBSTATE_RUNNING, "Running");
+        migrate_job_set_state(job, CIM_JOBSTATE_RUNNING, 0, "Running");
 
         s = migrate_vs(job);
 
@@ -1287,10 +1291,12 @@
         if (s.rc != CMPI_RC_OK)
                 migrate_job_set_state(job,
                                       CIM_JOBSTATE_COMPLETE,
+                                      s.rc,
                                       CMGetCharPtr(s.msg));
         else
                 migrate_job_set_state(job,
                                       CIM_JOBSTATE_COMPLETE,
+                                      0,
                                       "Completed");
 
         raise_deleted_ind(job);




More information about the Libvirt-cim mailing list