[Libvirt-cim] [PATCH] Return migration job status in CIM_ConcreteJob.ErrorCode

Eduardo Lima (Etrunko) eblima at linux.vnet.ibm.com
Thu Sep 22 21:30:45 UTC 2011


On 09/22/2011 03:33 PM, Sharad Mishra wrote:
> # HG changeset patch
> # User Sharad Mishra <snmishra at 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 at 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);
> 

Yay for setting the properties as expected. ;)

+1

-- 
Eduardo de Barros Lima
Software Engineer, Open Virtualization
Linux Technology Center - IBM/Brazil
eblima at br.ibm.com




More information about the Libvirt-cim mailing list