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.

Figure 1. Locating RAID Controllers
Diagram shows path to locate RAID controllers.

This pseudocode depends on the pseudocode in Make a Connection to the CIMOM and Mapping Integer Property Values to Strings.

To locate RAID controllers

Procedure

  1. Connect to the server URL.

    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. 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)
  3. 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)
  4. For each port controller instance, traverse the CIM_LogicalIdentity association to reach the matching instance of CIM_ComputerSystem representing the RAID controller.
    for pc_instance_name in pc_instance_names
       controller_instance_names = connection.AssociatorNames( pc_instance_name, \
                                                  AssocClass = 'CIM_LogicalIdentity', \
                                                  ResultClass = ’CIM_ComputerSystem’ )
       cs_instance_name = controller_instance_names[ 0 ]
  5. 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

    A sample of the output looks like the following:

    Controller 0 SAS/SATA (1F7D708944192F00) 
      EnabledState: Enabled
      HealthState: Minor failure
      OperationalStatus: Degraded