zhmcGetJobStatus
status | A string containing the value 'running' or 'complete' |
job_status_code | A number containing the HTTP status code of the operation if the status contains the value 'complete.' A value greater or equal to 200 and less than 300 indicates a successful completion. |
job_reason_code | The job completion reason code if the status is set to 'Complete' and an error occurred. |
job_results | A nested object containing the results of the job when the status is set to 'complete.' The contents of the object depend on the operation performed. |
Parameters:
hmcname | The HMC session name |
jobInfo | The job information as returned by a zhmc operation function |
Returns:
A job status object.
Example:
lpar = findLpar("IOC2")
if lpar != false then
jobInfo = zhmcActivateLpar("HMC4", lpar, "IOC2", false)
if jobInfo == false then
trace("Error: ActivateLpar failed: " & hmcGetLastError(), RED)
else
trace("ActivateLpar for lpar IOC2 returned " & jobInfo, GREEN)
jobStatus = zhmcGetJobStatus("HMC4", jobInfo)
if jobStatus.status == "running" then
trace("Activation has started", GREEN)
endif
endif
else
trace("Error: lpar IOC2 not found", RED)
endif
Messages are also produced when a job completes. Below is an example of receiving a job complete message and checking the status:
trigger on message.job_uri != false
jobStatus = zhmcGetJobStatus(message.SESSION_NAME, message)
if jobStatus != false then
if jobStatus.job_status_code >= 200 && jobStatus.job_status_code < 300 then
trace("Job completed successfully", GREEN)
else
trace("Job completed with error " & jobStatus.job_results, RED)
endif
else
trace("Error querying job status: " & hmcGetLastError(), RED)
endif
if lpar != false then
jobInfo = zhmcActivateLpar("HMC4", lpar, "IOC2", false)
if jobInfo == false then
trace("Error: ActivateLpar failed: " & hmcGetLastError(), RED)
else
trace("ActivateLpar for lpar IOC2 returned " & jobInfo, GREEN)
jobStatus = zhmcGetJobStatus("HMC4", jobInfo)
if jobStatus.status == "running" then
trace("Activation has started", GREEN)
endif
endif
else
trace("Error: lpar IOC2 not found", RED)
endif
Messages are also produced when a job completes. Below is an example of receiving a job complete message and checking the status:
trigger on message.job_uri != false
jobStatus = zhmcGetJobStatus(message.SESSION_NAME, message)
if jobStatus != false then
if jobStatus.job_status_code >= 200 && jobStatus.job_status_code < 300 then
trace("Job completed successfully", GREEN)
else
trace("Job completed with error " & jobStatus.job_results, RED)
endif
else
trace("Error querying job status: " & hmcGetLastError(), RED)
endif
Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*