RAID controller state is useful to system administrators who need to monitor system health. This example shows how you can report the health state of RAID controllers on the managed server.
This example assumes you have installed a VIB that contains an implementation of the Host Hardware RAID profile, defined by the SNIA. VMware does not implement this profile, but prominent hardware vendors provide implementations for their storage controllers.
You can enumerate the controllers by starting from the Interop namespace and traversing associations from the Scoping Instance of the profile. Locating RAID Controllers shows the relationships of the CIM objects involved. Locating RAID Controllers uses a fictitious namespace and class names that begin with the prefix ACME_.
Note: This example is consistent with versions of SMI-S prior to version 1.4. It is not consistent with version 1.5 or later. Early releases of SMI-S 1.4 are also consistent.
The CIM_PortController instance is logically identical to an instance of CIM_ComputerSystem subclassed as ACME_HBA. The ACME_HBA instance is the logical entity that is associated with the controller port objects.
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)
Locate the CIM_RegisteredProfile instance for the Host Hardware RAID Controller profile.
use registered_profiles renamed prof
profile_instance_name = prof.get_registered_profile_names( connection )
hhrc_instance_name = Null
for instance_name in profile_instance_names
instance = connection.GetInstance( instance_name )
if instance[ ’RegisteredName’ ] == ’Host Hardware RAID Controller’
hhrc_instance_name = instance_name
break
if hhrc_instance_name is Null
print 'Host Hardware RAID Controller profile not registered.'
sys.exit(-1)
Traverse the CIM_ElementConformsToProfile association to reach the CIM_PortController instances for the Host Hardware RAID Controller profile on the managed server.
pc_instance_names = connection.AssociatorNames( hhrc_instance_name, \
AssocClass = 'CIM_ElementConformsToProfile', \
ResultClass = ’CIM_PortController’ )
if len( pc_instance_names ) is 0
print 'Error: No RAID port controllers found.'
sys.exit(-1)
For each port controller instance, traverse the CIM_LogicalIdentity association to reach the matching instance of CIM_ComputerSystem representing the RAID controller.
For the resulting controller instance, print the ElementName, Name, EnabledState, HealthState, and OperationalStatus properties.
This pseudocode provides default values for the properties. VMware cannot guarantee that your hardware vendor has implemented all the properties used in this example.
use value_mapper renamed map
instance = connection.GetInstance( cs_instance_name )
if instance.key( ’ElementName’ )
element_name = instance[ ’ElementName’ ]
else
element_name = ’ElementName not available’
if instance.key( ’Name’ )
name = instance[ ’Name’ ]
else
name = ’Name not available’
if instance.key( ’EnabledState’ )
enabled_state = map.map_instance_property_to_string( connection, \
instance, \
’EnabledState’ )
if not enabled_state
enabled_state = ’not available’
if instance.key( ’HealthState’ )
health_state = map.map_instance_property_to_string( connection, \
instance, \
’HealthState’ )
if not health_state
health_state = ’not available’
if instance.key( ’OperationalStatus’ )
operational_status = map.map_instance_property_to_string( connection, \
instance, \
’OperationalStatus’ )
if not operational_status
operational_status = ’not available’
print "%s (%s)’ % ( element_name, name )
print ’ EnabledState: ’ + enabled_state
print ’ HealthState: ’ + health_state
print ’ OperationalStatus: ’ + operational_status