|
|
@ -280,7 +280,10 @@ class RedfishUtils(object):
|
|
|
|
controller_list = []
|
|
|
|
controller_list = []
|
|
|
|
controller_results = []
|
|
|
|
controller_results = []
|
|
|
|
# Get these entries, but does not fail if not found
|
|
|
|
# Get these entries, but does not fail if not found
|
|
|
|
properties = ['Name', 'Status']
|
|
|
|
properties = ['CacheSummary', 'FirmwareVersion', 'Identifiers',
|
|
|
|
|
|
|
|
'Location', 'Manufacturer', 'Model', 'Name',
|
|
|
|
|
|
|
|
'PartNumber', 'SerialNumber', 'SpeedGbps', 'Status']
|
|
|
|
|
|
|
|
key = "StorageControllers"
|
|
|
|
|
|
|
|
|
|
|
|
# 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)
|
|
|
@ -288,41 +291,45 @@ class RedfishUtils(object):
|
|
|
|
return response
|
|
|
|
return response
|
|
|
|
data = response['data']
|
|
|
|
data = response['data']
|
|
|
|
|
|
|
|
|
|
|
|
if 'SimpleStorage' not in data:
|
|
|
|
if 'Storage' not in data:
|
|
|
|
return {'ret': False, 'msg': "SimpleStorage resource not found"}
|
|
|
|
return {'ret': False, 'msg': "Storage resource not found"}
|
|
|
|
|
|
|
|
|
|
|
|
# Get a list of all storage controllers and build respective URIs
|
|
|
|
# Get a list of all storage controllers and build respective URIs
|
|
|
|
storage_uri = data["SimpleStorage"]["@odata.id"]
|
|
|
|
storage_uri = data['Storage']["@odata.id"]
|
|
|
|
response = self.get_request(self.root_uri + storage_uri)
|
|
|
|
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
|
|
|
|
result['ret'] = True
|
|
|
|
data = response['data']
|
|
|
|
data = response['data']
|
|
|
|
|
|
|
|
|
|
|
|
for controller in data[u'Members']:
|
|
|
|
# Loop through Members and their StorageControllers
|
|
|
|
controller_list.append(controller[u'@odata.id'])
|
|
|
|
# and gather properties from each StorageController
|
|
|
|
|
|
|
|
if data[u'Members']:
|
|
|
|
for c in controller_list:
|
|
|
|
for storage_member in data[u'Members']:
|
|
|
|
controller = {}
|
|
|
|
storage_member_uri = storage_member[u'@odata.id']
|
|
|
|
uri = self.root_uri + c
|
|
|
|
response = self.get_request(self.root_uri + storage_member_uri)
|
|
|
|
response = self.get_request(uri)
|
|
|
|
data = response['data']
|
|
|
|
if response['ret'] is False:
|
|
|
|
|
|
|
|
return response
|
|
|
|
|
|
|
|
data = response['data']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for property in properties:
|
|
|
|
if key in data:
|
|
|
|
if property in data:
|
|
|
|
controller_list = data[key]
|
|
|
|
controller[property] = data[property]
|
|
|
|
for controller in controller_list:
|
|
|
|
controller_results.append(controller)
|
|
|
|
controller_result = {}
|
|
|
|
result["entries"] = controller_results
|
|
|
|
for property in properties:
|
|
|
|
return result
|
|
|
|
if property in controller:
|
|
|
|
|
|
|
|
controller_result[property] = controller[property]
|
|
|
|
|
|
|
|
controller_results.append(controller_result)
|
|
|
|
|
|
|
|
result['entries'] = controller_results
|
|
|
|
|
|
|
|
return result
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
return {'ret': False, 'msg': "Storage resource not found"}
|
|
|
|
|
|
|
|
|
|
|
|
def get_disk_inventory(self):
|
|
|
|
def get_disk_inventory(self):
|
|
|
|
result = {}
|
|
|
|
result = {}
|
|
|
|
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', 'CapacityBytes']
|
|
|
|
properties = ['Name', 'Manufacturer', 'Model', 'Status',
|
|
|
|
|
|
|
|
'CapacityBytes']
|
|
|
|
|
|
|
|
|
|
|
|
# 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)
|
|
|
|