Asynchronous jobs

Most of storage manipulation methods, for example CreateOrModifyVG, can be time-consuming. Therefore the methods only check input parameters and return immediately with a reference to LMI_StorageJob instance. The operation itself is performed asynchronously on the server in a separate thread.

The returned LMI_StorageJob instance can be then used to either pull the operation status or applications can subscribe for job events and get an indication when status of a job changes.

Currently, only one job is being executed at a time, all others are enqueued and executed later.

Job status

The job status is exposed in OperationalStatus and JobState properties. Their combination compose unique job status:

Job is OperationalStatus JobStatus
Queued Dormant New
Suspended OK Suspended
Running OK Running
Finished OK Completed, OK Completed
Failed Completed, Error Exception
Cancelled Stopped Terminated

Job.RequestStateChange method can be used to suspend, resume and cancel a job, while following rules apply:

  • Only Queued job can be suspended.
  • Only Suspended job can be resumed.
  • Only Queued or Suspended job can be cancelled.

Note

Running job cannot be terminated in any way.

Job state machine.

By default, all job instances disappear automatically after 60 seconds after they reach any final state. This can be overridden by setting TimeBeforeRemoval and DeleteOnCompletion properties of a job.

Return value and output parameters

Return value and output parameters of an asynchronous method call are stored in LMI_StorageMethodResult.PostCallIndication property, which is associated to the job. The property itself is embedded instance of CIM_InstMethodCall class. Return value is stored in its ReturnValue property. Output parameters are stored in its MethodParameters property.

Error

Due to CIMOM bug, the MethodParameters property is empty.

LMI_AffectedStorageJobElement association can be used to find created/modified element of a LMI_StorageJob instance.

Instance diagram of a job before finishing.

Instance diagram of a job after finishing.

Supported event filters

  • PercentComplete property of a job changed:

    SELECT * FROM LMI_StorageInstModification
        WHERE SourceInstance ISA LMI_StorageJob
            AND SourceInstance.CIM_ConcreteJob::PercentComplete
                <> PreviousInstance.CIM_ConcreteJob::PercentComplete
  • State of a job changed:

    SELECT FROM LMI_StorageInstModification
        WHERE SourceInstance ISA CIM_ConcreteJob
            AND SourceInstance.CIM_ConcreteJob::JobState <> PreviousInstance.CIM_ConcreteJob::JobState
  • A job reaches state “Completed/OK”:

    SELECT * FROM LMI_StorageInstModification
        WHERE SourceInstance ISA LMI_StorageJob
            AND SourceInstance.CIM_ConcreteJob::JobState = 17
  • A job reaches state “Completed/Error”:

    SELECT * FROM LMI_StorageInstModification
        WHERE SourceInstance ISA LMI_StorageJob
            AND SourceInstance.CIM_ConcreteJob::JobState = 10
  • New job was created:

    SELECT * FROM LMI_StorageInstCreation WHERE SourceInstance ISA LMI_StorageJob

Note

All other indication filter queries will be rejected.

Table Of Contents

Previous topic

Overwrite policy

Next topic

OpenLMI-Storage usage

This Page