Monitoring VIB Installation
The VMware implementation of the DMTF Software Update profile allows system administrators to use CIM client applications to update ESXi software. See Installing VIBs. The update can take several minutes to complete. For a CIM client, this is an asynchronous operation because the CIM server returns before the update is complete.
You can monitor the status of the update operation in one of two ways:
This example shows how to monitor the update and report completion status by polling an instance of CIM_ConcreteJob.
Monitoring an Update of ESXi Software shows the relationships of the CIM objects involved.
Monitoring an Update of ESXi Software
Monitoring an Update of ESXi Software shows some classes, such as CIM_Error, that you can use to provide detail on status of the software update operation, but their use is not shown here. This example pseudocode relies only on the properties available in the CIM_ConcreteJob instance that represents the status of an operation in progress. The CIM_ConcreteJob instance remains in existence for a few minutes after the job completes.
This pseudocode depends on the pseudocode in Making a Connection to the CIMOM and Identifying the Base Server Scoping Instance.
To monitor VIB installation
1
After invoking the InstallFromURI() method, save the object reference returned in the Job output parameter.
The output parameter is a reference to an instance of CIM_ConcreteJob that you can use to monitor progress of the software update operation.
( error_return, output ) = connection.InvokeMethod( 'InstallFromURI', \
                                                    service, \
                                                    **method_params )
...
job_ref = output[ ’Job’ ]
...
2
Retrieve the referenced instance of CIM_ConcreteJob and test the value of the PercentComplete property.
Repeat this step until the PercentComplete property has the value 100.
function check_job_done( job_ref )
   job = connection.GetInstance( job_ref )
   print ’ percent complete %3d’ % job[ ’PercentComplete’ ]
   print ’ job status: %s’ % job[ ’JobStatus’ ]
   if job[ ’PercentComplete’ ] == 100
      return 1
   else
      return 0
 
use time
ticks = 0
while not check_job_done( job_ref )
   print ’Job time elapsed: %d seconds’ % ticks
   print
   time.sleep( 10 )
   ticks = ticks + 10
print ’      error code: %s’ % job[ ’ErrorCode’ ]
print ’     description: %s’ % job[ ’ErrorDescription’ ]
print ’Time elapsed: %d seconds’ % ticks
While the software update operation is in progress, the property has an arbitrary value less than 100. After the operation completes, the PercentComplete property takes the value 100 and the CIM server no longer updates the CIM_ConcreteJob instance.
A sample of the output looks like the following:
Software installation in progress...
   percent complete 10
   job status: Scanning URI for installable packages
Time elapsed: 0 seconds
 
   percent complete 10
   job status: Scanning URI for installable packages
Time elapsed: 10 seconds
 
   percent complete 10
   job status: Scanning URI for installable packages
Time elapsed: 20 seconds
 
   percent complete 30
   job status: Scan of URI Complete and installable packages found. Starting Update.
Time elapsed: 30 seconds
 
   percent complete 30
   job status: Scan of URI Complete and installable packages found. Starting Update.
Time elapsed: 40 seconds
 
...
 
   percent complete 100
   job status: The update completed successfully, but the system needs to be rebooted for the changes to be effective.
          error code: None
         description: None
Time elapsed: 1000 seconds