From bfde2723228daee41c7234221c9958249e1bfc19 Mon Sep 17 00:00:00 2001 From: Nate Potter Date: Tue, 11 Oct 2016 14:46:41 -0700 Subject: [PATCH] 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 --- valence/ui/src/js/util.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/valence/ui/src/js/util.js b/valence/ui/src/js/util.js index 3ad1de1..b187fa4 100644 --- a/valence/ui/src/js/util.js +++ b/valence/ui/src/js/util.js @@ -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;