Report Accessible Storage Extents

This example shows how to report the disk storage extents that are accessible to a given SCSI controller. The information can be useful for configuring the managed servers in a datacenter.

This example assumes you have already located an instance of CIM_ComputerSystem subclassed as ACME_Controller that represents the RAID controller. See Monitor RAID Controller State for information about locating the RAID controllers attached to a managed system.

This example is based on the assumption that you have already 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.

This example is based on the assumption that the implementation on the managed server models serial-attached SCSI connections to drives that belong to pooled RAID configurations. This model is similar to the SMI-S Host Hardware RAID Controller profile published by the SNIA.

The model might or might not correspond to your hardware vendor’s implementation. Contact the hardware vendor for more information about the implementation.

Locating Storage Extents Attached to SCSI Targets shows the relationships of the CIM objects involved. Locating Storage Extents Attached to SCSI Targets uses a fictitious namespace and class names that begin with the prefix ACME_.

The SMI-S specifies two different ways to model connections between targets and initiators. If your hardware vendor’s implementation uses the CIM_SCSIInitiatortargetLogicalUnitPath association, you can follow the LogicalUnit reference of that association to get to the LUN directly.

Another way to locate disk storage extents is to start from each instance of CIM_ConnectivityCollection connected to the controller and to follow a series of associations to the disk media attached to the target endpoint. This procedure begins with the reverse of the last step in Monitor State of RAID Connections, except that you need to filter on the value of the Role property to retrieve only targets, not initiators.

This example bypasses the issue of implementation choice by going from the SCSI controller to the target endpoints in one step by using the CIM_HostedAccessPort association. With this approach, the hardware vendor’s choice of SMI-S implementation does not matter.

Figure 1. Locating Storage Extents Attached to SCSI Targets
Diagram shows path to storage extents that belong to a logical volume.

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

To report available storage extents

Procedure

  1. From a given instance of CIM_ComputerSystem subclassed as ACME_HBA, traverse the CIM_HostedAccessPoint association to reach the CIM_SCSIProtocolEndpoint instances on the managed server.

    Use the value of the Role property to distinguish the target endpoints from the initiator endpoints. Values of 3 or 4 indicate that the endpoint functions as a target.

    targ_instance_names = connection.AssociatorNames( controller_instance_name, \
                                         AssocClass = 'CIM_HostedAccessPoint', \
                                         ResultClass = ’CIM_SCSIProtocolEndpoint’ )
    if len( targ_instance_names ) is 0
       print 'Error:  No targets associated with SCSI controller instance.'
       sys.exit(-1)
    for instance_name in targ_instance_names
       instance = connection.GetInstance( instance_name )
       if ( not ( instance[’Role’] in [3, 4] ) )
          targ_instance_names.delete( instance_name )
  2. For each target instance, traverse the CIM_SAPAvailableForElement association to reach the disk drive for the target.
    for targ_instance_name in targ_instance_names
       disk_instance_names = connection.AssociatorNames( targ_instance_name, \
                                            AssocClass = 'CIM_SAPAvailableForElement', \
                                            ResultClass = ’CIM_DiskDrive’ )
  3. From CIM_DiskDrive, traverse the CIM_MediaPresent association to reach the storage extents that belong to that drive.
       for disk_instance_name in disk_instance_names 
          ext_instance_names = connection.AssociatorNames( disk_instance_name, \
                                             AssocClass = 'CIM_MediaPresent', \
                                             ResultClass = ’CIM_StorageExtent’ )
  4. For each instance of CIM_StorageExtent, print the DeviceID and OperationalStatus properties. Also print the computed extent size (BlockSize * NumberOfBlocks), if those properties are available.
          for ext_instance_name in ext_instance_names 
             print_extent( connection, ext_instance_name )
    
    use value_mapper renamed mapper
    function print_extent( connection, instance_name ) 
       instance = connection.GetInstance( instance_name )
       device_id = instance[ ’DeviceID’ ]
       operational_status = ’’
       status_codes = instance[ ’OperationalStatus’ ]
       for status_code in status_codes 
          value = mapper.map_instance_property_to_string( connection, \
                                                          instance, \
                                                          ’OperationalStatus’ )
          operational_status = operational_status + ’ ’ + value
       if instance.key( ’BlockSize’ ) 
          block_size = instance[ ’BlockSize’ ]
       else 
          block_size = 0
       if instance.key( ’NumberOfBlocks’ ) 
          num_blocks = instance[ ’NumberOfBlocks’ ]
       else 
          num_blocks = 0
       print ’Disk extent: ’ + device_id
       print ’   Operational status: ’ + operational_status
       size = num_blocks * block_size
       if size 
          print ’   Size: " + size