@ -324,12 +324,16 @@ class RedfishUtils(object):
return { ' ret ' : False , ' msg ' : " Storage resource not found " }
return { ' ret ' : False , ' msg ' : " Storage resource not found " }
def get_disk_inventory ( self ) :
def get_disk_inventory ( self ) :
result = { }
result = { ' entries ' : [ ] }
controller_list = [ ]
controller_list = [ ]
disk_results = [ ]
disk_results = [ ]
# Get these entries, but does not fail if not found
# Get these entries, but does not fail if not found
properties = [ ' Name ' , ' Manufacturer ' , ' Model ' , ' Status ' ,
properties = [ ' BlockSizeBytes ' , ' CapableSpeedGbs ' , ' CapacityBytes ' ,
' CapacityBytes ' ]
' EncryptionAbility ' , ' EncryptionStatus ' ,
' FailurePredicted ' , ' HotspareType ' , ' Id ' , ' Identifiers ' ,
' Manufacturer ' , ' MediaType ' , ' Model ' , ' Name ' ,
' PartNumber ' , ' PhysicalLocation ' , ' Protocol ' , ' Revision ' ,
' RotationSpeedRPM ' , ' SerialNumber ' , ' Status ' ]
# Find Storage service
# Find Storage service
response = self . get_request ( self . root_uri + self . systems_uri )
response = self . get_request ( self . root_uri + self . systems_uri )
@ -337,34 +341,69 @@ class RedfishUtils(object):
return response
return response
data = response [ ' data ' ]
data = response [ ' data ' ]
if ' SimpleStorage ' not in data :
if ' SimpleStorage ' not in data and ' Storage ' not in data :
return { ' ret ' : False , ' msg ' : " SimpleStorage resource not found " }
return { ' ret ' : False , ' msg ' : " SimpleStorage and Storage resource \
not found " }
# Get a list of all storage controllers and build respective URIs
if ' Storage ' in data :
storage_uri = data [ " SimpleStorage " ] [ " @odata.id " ]
# Get a list of all storage controllers and build respective URIs
response = self . get_request ( self . root_uri + storage_uri )
storage_uri = data [ u ' Storage ' ] [ u ' @odata.id ' ]
if response [ ' ret ' ] is False :
response = self . get_request ( self . root_uri + storage_uri )
return response
if response [ ' ret ' ] is False :
result [ ' ret ' ] = True
return response
data = response [ ' data ' ]
result [ ' ret ' ] = True
data = response [ ' data ' ]
for controller in data [ u ' Members ' ] :
controller_list . append ( controller [ u ' @odata.id ' ] )
for c in controller_list :
if data [ u ' Members ' ] :
uri = self . root_uri + c
for controller in data [ u ' Members ' ] :
response = self . get_request ( uri )
controller_list . append ( controller [ u ' @odata.id ' ] )
for c in controller_list :
uri = self . root_uri + c
response = self . get_request ( uri )
if response [ ' ret ' ] is False :
return response
data = response [ ' data ' ]
if ' Drives ' in data :
for device in data [ u ' Drives ' ] :
disk_uri = self . root_uri + device [ u ' @odata.id ' ]
response = self . get_request ( disk_uri )
data = response [ ' data ' ]
disk_result = { }
for property in properties :
if property in data :
if data [ property ] is not None :
disk_result [ property ] = data [ property ]
disk_results . append ( disk_result )
result [ " entries " ] . append ( disk_results )
if ' SimpleStorage ' in data :
# Get a list of all storage controllers and build respective URIs
storage_uri = data [ " SimpleStorage " ] [ " @odata.id " ]
response = self . get_request ( self . root_uri + storage_uri )
if response [ ' ret ' ] is False :
if response [ ' ret ' ] is False :
return response
return response
result [ ' ret ' ] = True
data = response [ ' data ' ]
data = response [ ' data ' ]
for device in data [ u ' Devices ' ] :
for controller in data [ u ' Members ' ] :
disk = { }
controller_list . append ( controller [ u ' @odata.id ' ] )
for property in properties :
if property in device :
for c in controller_list :
disk [ property ] = device [ property ]
uri = self . root_uri + c
disk_results . append ( disk )
response = self . get_request ( uri )
result [ " entries " ] = disk_results
if response [ ' ret ' ] is False :
return response
data = response [ ' data ' ]
for device in data [ u ' Devices ' ] :
disk_result = { }
for property in properties :
if property in device :
disk_result [ property ] = device [ property ]
disk_results . append ( disk_result )
result [ " entries " ] . append ( disk_results )
return result
return result
def restart_manager_gracefully ( self ) :
def restart_manager_gracefully ( self ) :