Add storage options to compose menu
This commit adds options in the compose menu to specify required storage capacity, an iqn (perhaps this could be randomized) and a master drive, all of which are required when sectioning off new storage for a composed node. Change-Id: Idc605d165ce6028252049681bd5bbde8abe8853e Partial-bug: #1630811
This commit is contained in:
parent
ae2a6b642f
commit
4831fc79a9
@ -17,6 +17,7 @@ const Layout = React.createClass({
|
||||
racks: [],
|
||||
systems: [],
|
||||
storage: [],
|
||||
processors: [],
|
||||
nodes: []
|
||||
};
|
||||
},
|
||||
@ -25,6 +26,7 @@ const Layout = React.createClass({
|
||||
this.getPods();
|
||||
this.getRacks();
|
||||
this.getSystems();
|
||||
this.getProcessors();
|
||||
this.getStorage();
|
||||
this.getNodes();
|
||||
},
|
||||
@ -48,6 +50,9 @@ const Layout = React.createClass({
|
||||
},
|
||||
|
||||
displayCompose: function() {
|
||||
this.getProcessors();
|
||||
this.getStorage();
|
||||
this.fillComposeForms();
|
||||
this.setState({
|
||||
homeDisplay: "none",
|
||||
detailDisplay: "none",
|
||||
@ -56,6 +61,43 @@ const Layout = React.createClass({
|
||||
});
|
||||
},
|
||||
|
||||
fillDropdownMenu: function(menu, itemNames, itemValues) {
|
||||
var sel = document.getElementById(menu);
|
||||
sel.innerHTML = '';
|
||||
var opt = document.createElement('option');
|
||||
opt.innerHTML = 'None';
|
||||
opt.value = null;
|
||||
sel.appendChild(opt);
|
||||
for (var i = 0; i < itemNames.length; i++) {
|
||||
opt = document.createElement('option');
|
||||
opt.innerHTML = itemNames[i];
|
||||
opt.value = itemValues[i];
|
||||
sel.appendChild(opt);
|
||||
}
|
||||
},
|
||||
|
||||
fillComposeForms: function() {
|
||||
// Fill processor dropdown menu
|
||||
var processorNames = []
|
||||
for (var i = 0; i < this.state.processors.length; i++) {
|
||||
if (this.state.processors[i]['Model'] &&
|
||||
processorNames.indexOf(this.state.processors[i]['Model']) >= 0) {
|
||||
processorsNames.push(this.state.processors[i]['Model']);
|
||||
}
|
||||
}
|
||||
this.fillDropdownMenu('procModels', processorNames, processorNames);
|
||||
// Fill storage dropdown menu
|
||||
var driveNames = [];
|
||||
var driveValues = []
|
||||
for (var i = 0; i < this.state.storage.length; i++) {
|
||||
if (this.state.storage[i]['Mode'] == 'LV') {
|
||||
driveNames.push(this.state.storage[i]['Name']);
|
||||
driveValues.push(this.state.storage[i]['@odata.id']);
|
||||
}
|
||||
}
|
||||
this.fillDropdownMenu('remoteDrives', driveNames, driveValues);
|
||||
},
|
||||
|
||||
getPods: function() {
|
||||
util.getPods(this.setPods);
|
||||
},
|
||||
@ -80,6 +122,14 @@ const Layout = React.createClass({
|
||||
this.setState({systems: systems});
|
||||
},
|
||||
|
||||
getProcessors: function() {
|
||||
util.getProcessors(this.state.systems, this.setProcessors);
|
||||
},
|
||||
|
||||
setProcessors: function(processors) {
|
||||
this.setState({processors: processors});
|
||||
},
|
||||
|
||||
getStorage: function() {
|
||||
util.getStorage(this.setStorage);
|
||||
},
|
||||
|
@ -5,16 +5,6 @@ var util = require('../../util.js');
|
||||
|
||||
const ComposeDisplay = React.createClass({
|
||||
|
||||
getInitialState: function() {
|
||||
return {
|
||||
processors: []
|
||||
};
|
||||
},
|
||||
|
||||
componentDidMount() {
|
||||
this.getProcessors();
|
||||
},
|
||||
|
||||
compose: function() {
|
||||
var data = this.prepareRequest();
|
||||
var url = config.url + '/redfish/v1/Nodes/Actions/Allocate';
|
||||
@ -38,46 +28,36 @@ const ComposeDisplay = React.createClass({
|
||||
});
|
||||
},
|
||||
|
||||
getProcessors: function() {
|
||||
util.getProcessors(this.props.systemList, this.setProcessors);
|
||||
},
|
||||
|
||||
setProcessors: function(processors) {
|
||||
this.setState({processors: processors});
|
||||
this.fillForms();
|
||||
},
|
||||
|
||||
fillForms: function() {
|
||||
var sel = document.getElementById('procModels');
|
||||
sel.innerHTML = "";
|
||||
for (var i = 0; i < this.state.processors.length; i++) {
|
||||
if (this.state.processors[i]['Model']) {
|
||||
var opt = document.createElement('option');
|
||||
opt.innerHTML = this.state.processors[i]['Model'];
|
||||
opt.value = this.state.processors[i]['Model'];
|
||||
sel.appendChild(opt);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
prepareRequest: function() {
|
||||
var name = document.getElementById('name').value;
|
||||
var description = document.getElementById('description').value;
|
||||
var totalMem = document.getElementById('totalMem').value;
|
||||
var storageCapacity = document.getElementById('storageCapacity').value;
|
||||
var iqn = document.getElementById('iqn').value;
|
||||
var masterDrive = document.getElementById('remoteDrives').value;
|
||||
var procModel = document.getElementById('procModels').value;
|
||||
if (procModel == "") {
|
||||
procModel = null;
|
||||
}
|
||||
var data = {
|
||||
"Name": name,
|
||||
"Description": description,
|
||||
"Memory": [{
|
||||
"CapacityMiB": totalMem * 1000
|
||||
}],
|
||||
"Processors": [{
|
||||
"Model": procModel
|
||||
}]
|
||||
}
|
||||
if (procModel != 'null') {
|
||||
data["Processors"] = [{"Model": procModel}];
|
||||
}
|
||||
if (iqn != 'null' && masterDrive != 'null') {
|
||||
data["RemoteDrives"] = [{
|
||||
"CapacityGiB": storageCapacity,
|
||||
"iSCSIAddress": iqn,
|
||||
"Master": {
|
||||
"Type": "Snapshot",
|
||||
"Resource": {
|
||||
"@odata.id": masterDrive
|
||||
}
|
||||
}
|
||||
}];
|
||||
}
|
||||
return JSON.stringify(data);
|
||||
},
|
||||
|
||||
@ -103,6 +83,18 @@ const ComposeDisplay = React.createClass({
|
||||
<td align="right">System Memory GB:</td>
|
||||
<td align="left"><input type="number" min="0" id="totalMem" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Remote Storage Capacity GB:</td>
|
||||
<td align="left"><input type="number" min="0" id="storageCapacity" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Remote storage IQN:</td>
|
||||
<td align="left"><input type="text" id="iqn" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Remote storage master drive:</td>
|
||||
<td align="left"><select id="remoteDrives" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Processor Model:</td>
|
||||
<td align="left"><select id="procModels" /></td>
|
||||
|
@ -39,7 +39,6 @@ const NodeList = React.createClass({
|
||||
|
||||
powerOn: function(nodeId) {
|
||||
var url = config.url + '/redfish/v1/Nodes/' + nodeId + '/Actions/ComposedNode.Reset'
|
||||
console.log(nodeId);
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'POST',
|
||||
@ -48,7 +47,6 @@ const NodeList = React.createClass({
|
||||
},
|
||||
data: JSON.stringify({"ResetType": "On"}),
|
||||
success: function(resp) {
|
||||
console.log(resp);
|
||||
this.props.onUpdateNodes();
|
||||
}.bind(this),
|
||||
error: function(xhr, status, err) {
|
||||
|
Loading…
Reference in New Issue
Block a user