Merge "Get storage recursively"

This commit is contained in:
Jenkins 2016-10-12 17:46:10 +00:00 committed by Gerrit Code Review
commit ae2a6b642f

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;