This example shows how to report the disk storage extents that are available to a managed server, in the absence of a dedicated storage provider supplied by a storage vendor. Information about the storage extents is limited when a dedicated storage provider is not installed. The limited information can still be useful for configuring the managed servers in a datacenter.
You can locate disk storage extents by enumerating instances of VMware_HypervisorStorageExtent in the Implementation namespace. The pseudocode in this topic depends on the pseudocode in Make a Connection to the CIMOM.
To report storage extents
Procedure
- Connect to the server URL.
Specify the Implementation namespace, supplied as a parameter, for the connection.
The actual namespace you will use depends on your installation.
use wbemlib
use sys
use connection renamed cnx
connection = Null
params = cnx.get_params()
if params is Null
sys.exit( -1 )
connection = cnx.connect_to_host( params )
if connection is Null
print 'Failed to connect to: ' + params['host'] + ' as user: ' + params['user']
sys.exit( -1 )
- Enumerate instance names of VMware_HypervisorStorageExtent.
Select the instances where the OtherIdentifyingInfo property begins with ’/vmfs/devices/disks’. For each such instance, print the ElementName, OtherIdentifyingInfo, and OperationalStatus properties.
use value_mapper renamed mapper
instances = connection.EnumerateInstances( ’VMware_HypervisorStorageExtent’ )
for instance in instances
if instance[ ’OtherIdentifyingInfo’ ][ 0 ] begins ’/vmfs/devices/disks’
status = mapper.map_instance_property_to_string( connection, \
instance, \
’OperationalStatus’ )
print ’ Storage Extent = ’ + instance[ ’ElementName’ ]
print ’ Other Info: ’ + instance[ ’OtherIdentifyingInfo’ ]
print ’ OperationalStatus: ’ + status
A sample of the output looks like the following:
Storage Extent = Local Disk (naa.7001e4e041d08f00119991caf9fd2aaf)
Other Info: /vmfs/devices/disks/naa.7001e4e041d08f00119991caf9fd2aaf
OperationalStatus: OK