thnx for the fast turnaround on this!!
minor comment:
migrate_job_set_state(job,
CIM_JOBSTATE_COMPLETE,
+ s.rc,
CMGetCharPtr(s.msg));
The fact we're using CMPIStatus return codes to set the CIM_Job's
ErrorCode property should probably be documented somewhere explicitly;
there is otherwise no actual correlation between this CIM property and
CMPI's internal status definitions... In particular, it is just a
cooincidence that CMPI_RC_OK=0, so probably below is perhaps a little
better; change:
else
migrate_job_set_state(job,
CIM_JOBSTATE_COMPLETE,
+ s.rc,
"Completed");
to:
else
migrate_job_set_state(job,
CIM_JOBSTATE_COMPLETE,
+ 0,
"Completed");
Because the CIM_Job mof is very explicit about this:
[Description (
"A vendor-specific error code. The value must be set to "
"zero if the Job completed without error. Note that this "
"property is also present in the JobProcessingStatistics "
"class. This class is necessary to capture the processing "
"information for recurring Jobs, because only the \'last\' "
"run error can be stored in this single-valued property." ),
ModelCorrespondence { "CIM_Job.ErrorDescription" }]
uint16 ErrorCode;
Otherwise +1
- G
Dr. Gareth S. Bestor
IBM Senior Software Engineer
Systems & Technology Group - Systems Management Standards
971-285-6375 (mobile)
bestor(a)us.ibm.com
[Libvirt-cim] [PATCH] Return migration job status in
CIM_ConcreteJob.ErrorCode
Sharad Mishra
to:
libvirt-cim
09/22/11 02:23 PM
Sent by:
libvirt-cim-bounces(a)redhat.com
Please respond to List for discussion and development of libvirt CIM
# HG changeset patch
# User Sharad Mishra <snmishra(a)us.ibm.com>
# Date 1316716303 25200
# Node ID 5a025903b3dec8d8d5f35e7117be67f095d5fe21
# Parent fb09136deb494008eb3aacee420ad74da7d7c294
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.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r fb09136deb49 -r 5a025903b3de src/Virt_VSMigrationService.c
--- a/src/Virt_VSMigrationService.c Tue Aug 30 08:48:36 2011
-0700
+++ b/src/Virt_VSMigrationService.c Thu Sep 22 11:31:43 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,
+ s.rc,
"Completed");
raise_deleted_ind(job);
_______________________________________________
Libvirt-cim mailing list
Libvirt-cim(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvirt-cim