Get storage recursively

This commit makes the call to get all logical drives check
through all storage services, not assuming it exists at
/redfish/v1/Services/1/LogicalDrives.

Change-Id: Ia00bf94a8561124ab9778014cf9c99eb6f715f03
Closes-bug: #1632488
This commit is contained in:
Nate Potter 2016-10-11 14:46:41 -07:00
parent fa3395fb29
commit bfde272322

View File

@ -72,15 +72,15 @@ exports.getNodes = function(callback) {
};
exports.getStorage = function(callback) {
var url = config.url + '/redfish/v1/Services/1/LogicalDrives';
var url = config.url + '/redfish/v1/Services';
$.ajax({
url: url,
type: 'GET',
dataType: 'json',
cache: false,
success: function(resp) {
var drives = this.listItems(resp['Members']);
callback(drives);
var services = this.listItems(resp['Members']);
util.getLogicalDrives(services, callback);
}.bind(this),
error: function(xhr, status, err) {
console.error(url, status, err.toString());
@ -88,6 +88,20 @@ exports.getStorage = function(callback) {
});
};
exports.getLogicalDrives = function(services, callback) {
var logicalDrives = [];
var logicalDrivesId;
var serviceLogicalDrives;
for (var i = 0; i < services.length; i++) {
logicalDrivesId = util.readAndReturn(services[i]['LogicalDrives']['@odata.id']);
serviceLogicalDrives = util.listItems(JSON.parse(logicalDrivesId)['Members']);
for (var j = 0; j < serviceLogicalDrives.length; j++) {
logicalDrives.push(serviceLogicalDrives[j]);
}
}
callback(logicalDrives);
};
exports.getProcessors = function(systems, callback) {
var processors = [];
var systemProcessorIds;