Installing VIBs
The VMware implementation of the DMTF Software Update profile allows system administrators to update ESXi software by using CIM client applications. The CIM software installation service applies an offline bundle file to update the software on the managed server. To identify the current software version, see Reporting Installed VIBs.
This example shows how to locate the CIM_SoftwareInstallationService by traversing the CIM_HostedService association from the server Scoping Instance. The InstallFromURI() method starts the update process on the managed server and returns a CIM_ConcreteJob instance that you can use to monitor completion of the installation.
The VMware implementation of the Software Update profile does not include a CIM_ServiceAffectsElement association between the instance of CIM_SoftwareInstallationService and the instance of CIM_SoftwareIdentity that represents a VIB. As a result, you cannot use the InstallFromSoftwareIdentity() method that is described in the Software Update profile specification.
To use the InstallFromURI() method, you must know the location of the offline bundle in a local file system. You supply the path to the offline bundle in the form of a URI when you invoke the method. For example, you might pass "file:///vmfs/Storage1/bundle.zip" as the value of the URI parameter.
Note You cannot use an online depot in the URI that you pass to the InstallFromURI() method. For instructions to create an offline bundle from a set of VIBs in an online depot, see Offline Bundles.
Starting an Update of ESXi Software shows the relationships of the CIM objects involved in the installation of VIBs by using CIM. The CIM_SoftwareInstallationService instance in Starting an Update of ESXi Software represents the CIM provider that starts the software installation.
Starting an Update of ESXi Software
The CIM_SoftwareInstallationServiceCapabilities instance advertises the InstallFromURI action and the supported URI schemes that it supports. Starting an Update of ESXi Software includes the instance for completeness. The pseudocode example does not use it.
This pseudocode depends on the pseudocode in Making a Connection to the CIMOM and Identifying the Base Server Scoping Instance.
To install VIBs
1
Specify the Interop namespace, supplied as a parameter, for the connection.
use wbemlib
use sys
use connection renamed cnx
connection = Null
 
params = cnx.get_params()
if params is Null
sys.exit(-1)
interop_params = params
interop_params['namespace'] = 'root/interop'
connection = cnx.connect_to_host( interop_params )
if connection is Null
print 'Failed to connect to: ' + params['host'] + ' as user: ' + params['user']
sys.exit(-1)
2
use scoping_instance renamed si
 
scoping_instance_name = si.get_scoping_instance_name( connection )
if scoping_instance_name is Null
print 'Failed to find server Scoping Instance.'
sys.exit(-1)
3
Use the CIM_HostedService association to identify the CIM_SoftwareInstallationService instance that represents the Software Update provider on the managed server.
The VMware implementation includes only one instance of CIM_SoftwareInstallationService.
installation_services = connection.AssociatorNames( scoping_instance_name, \
                                        AssocClass = ’CIM_HostedService’, \
                                        ResultClass = 'CIM_SoftwareInstallationService' )
if len( installation_services ) != 1
   print 'Failed to find the software installation service for the scoping computer system.'
   sys.exit(-1)
installation_service = installation_services.pop()
4
On the CIM_SoftwareInstallationService instance, invoke the InstallFromURI() method with the following parameters.
A reference to the CIM_ComputerSystem instance that represents the managed server.
An empty list for the InstallOptions parameter. The CIM provider ignores any install options that you specify.
The method returns a single output parameter, which is a reference to an instance of CIM_ConcreteJob. You can use the instance to monitor completion of the software installation.
function launch_installation( service, \
                              bundle_file, \
                              server, \
                              cli_options )
   metadata_uri = ’file://%s’ % bundle_file
   method_params = { ’URI’   : metadata_uri, \
                    ’Target’ : server, \
                   ’InstallOptions’ : cli_options }
   ( error_return, output ) = connection.InvokeMethod( 'InstallFromURI', \
                                                       service, \
                                                       **method_params )
   if error_return == 4096
      print ’Software installation in progress...’
      job_ref = output[ ’Job’ ]
      return job_ref
   else
      print ’Invalid method parameters; error = %s’ % error_return
      sys.exit( -1 )
vib = params[’extra_params’][0]
cli_options = []
job_ref = launch_installation( installation_service, \
                           vib, \
                           scoping_instance_name, \
                           cli_options )
If there is an error in the method parameters, such as a mismatch in the option lists, the InstallFromURI() method returns immediately.
If the method returns the value 4096, the provider has accepted the method parameters and will start the update process. You can monitor the installation by using the instance of CIM_ConcreteJob that is returned by the method. See Monitoring VIB Installation.