2010-07-28 20:24:29 +00:00
|
|
|
/**
|
|
|
|
* Execute when the DOM is fully loaded
|
|
|
|
*/
|
|
|
|
$(document).ready(function() {
|
2012-05-04 00:54:58 +00:00
|
|
|
// Load utility scripts
|
2010-07-15 22:57:48 +00:00
|
|
|
});
|
|
|
|
|
2010-07-22 19:56:09 +00:00
|
|
|
/**
|
|
|
|
* Constructor
|
|
|
|
*
|
|
|
|
* @return Nothing
|
|
|
|
*/
|
2010-07-23 18:47:54 +00:00
|
|
|
var hmcPlugin = function() {
|
2010-07-28 20:24:29 +00:00
|
|
|
|
2010-07-22 19:56:09 +00:00
|
|
|
};
|
|
|
|
|
2012-03-14 04:32:06 +00:00
|
|
|
/**
|
|
|
|
* Steps for hardware discovery wizard
|
|
|
|
*
|
|
|
|
* @return Discovery steps
|
|
|
|
*/
|
2012-05-04 00:54:58 +00:00
|
|
|
hmcPlugin.prototype.getStep = function() {
|
|
|
|
return [ 'Basic patterns', 'Supernode', 'More patterns',
|
|
|
|
'Power on hardware', 'Discover frames', 'Management node',
|
2012-07-23 10:13:30 +00:00
|
|
|
'Discover Rest of Hardware and Update Definitions', 'Create LPARs' ];
|
2012-03-14 04:32:06 +00:00
|
|
|
};
|
|
|
|
|
2012-05-04 00:54:58 +00:00
|
|
|
hmcPlugin.prototype.getInitFunction = function() {
|
|
|
|
return [ powerInitBasicPattern, powerInitSupernode, powerInitSiteTable,
|
|
|
|
powerInitPoweronHardware, powerInitDiscoverFrames, powerInitConfig,
|
|
|
|
powerInitUpdateDefinition, powerInitCreateLpar ];
|
2012-03-14 04:32:06 +00:00
|
|
|
};
|
|
|
|
|
2012-05-04 00:54:58 +00:00
|
|
|
hmcPlugin.prototype.getNextFunction = function() {
|
|
|
|
return [ checkBasicPattern, checkSupernode, checkSiteTable, undefined,
|
|
|
|
checkFrameMtms, undefined, undefined, collectInputValue ];
|
2012-03-14 04:32:06 +00:00
|
|
|
};
|
|
|
|
|
2010-07-15 22:57:48 +00:00
|
|
|
/**
|
|
|
|
* Load node inventory
|
|
|
|
*
|
2012-05-04 00:54:58 +00:00
|
|
|
* @param data Data from HTTP request
|
2010-07-15 22:57:48 +00:00
|
|
|
*/
|
2010-07-23 18:47:54 +00:00
|
|
|
hmcPlugin.prototype.loadInventory = function(data) {
|
2012-05-04 00:54:58 +00:00
|
|
|
// Get arguments
|
|
|
|
var args = data.msg.split(',');
|
|
|
|
// Get tab ID
|
|
|
|
var tabId = args[0].replace('out=', '');
|
|
|
|
// Get node
|
|
|
|
var node = args[1].replace('node=', '');
|
|
|
|
// Get node inventory
|
|
|
|
var inv = data.rsp;
|
|
|
|
|
|
|
|
// Remove loader
|
|
|
|
$('#' + tabId).find('img').remove();
|
|
|
|
|
|
|
|
// Create division to hold inventory
|
|
|
|
var invDivId = tabId + 'Inventory';
|
|
|
|
var invDiv = $('<div class="inventory" id="' + invDivId + '"></div>');
|
|
|
|
|
|
|
|
// Loop through each line
|
|
|
|
var fieldSet = null;
|
|
|
|
var legend = null;
|
|
|
|
var oList = null;
|
|
|
|
var item = null;
|
|
|
|
for (var k = 0; k < inv.length; k++) {
|
|
|
|
// Remove node name in front
|
|
|
|
var str = inv[k].replace(node + ': ', '');
|
|
|
|
str = jQuery.trim(str);
|
|
|
|
|
|
|
|
// If string is a header
|
|
|
|
if (str.indexOf('I/O Bus Information') > -1
|
|
|
|
|| str.indexOf('Machine Configuration Info') > -1) {
|
|
|
|
// Create a fieldset
|
|
|
|
fieldSet = $('<fieldset></fieldset>');
|
|
|
|
legend = $('<legend>' + str + '</legend>');
|
|
|
|
fieldSet.append(legend);
|
|
|
|
oList = $('<ol></ol>');
|
|
|
|
fieldSet.append(oList);
|
|
|
|
invDiv.append(fieldSet);
|
|
|
|
} else {
|
|
|
|
// If no fieldset is defined
|
|
|
|
if (!fieldSet) {
|
|
|
|
// Define general fieldset
|
|
|
|
fieldSet = $('<fieldset></fieldset>');
|
|
|
|
legend = $('<legend>General</legend>');
|
|
|
|
fieldSet.append(legend);
|
|
|
|
oList = $('<ol></ol>');
|
|
|
|
fieldSet.append(oList);
|
|
|
|
invDiv.append(fieldSet);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Append the string to a list
|
|
|
|
item = $('<li></li>');
|
|
|
|
item.append(str);
|
|
|
|
oList.append(item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Append to inventory form
|
|
|
|
$('#' + tabId).append(invDiv);
|
2010-07-22 19:56:09 +00:00
|
|
|
};
|
2010-07-15 22:57:48 +00:00
|
|
|
|
|
|
|
/**
|
2010-07-19 18:28:31 +00:00
|
|
|
* Load clone page
|
2010-07-15 22:57:48 +00:00
|
|
|
*
|
2012-05-04 00:54:58 +00:00
|
|
|
* @param node Source node to clone
|
2010-07-15 22:57:48 +00:00
|
|
|
*/
|
2010-07-23 18:47:54 +00:00
|
|
|
hmcPlugin.prototype.loadClonePage = function(node) {
|
2012-05-04 00:54:58 +00:00
|
|
|
// Get nodes tab
|
|
|
|
var tab = getNodesTab();
|
|
|
|
var newTabId = node + 'CloneTab';
|
|
|
|
|
|
|
|
// If there is no existing clone tab
|
|
|
|
if (!$('#' + newTabId).length) {
|
|
|
|
// Create status bar and hide it
|
|
|
|
var statBarId = node + 'CloneStatusBar';
|
|
|
|
var statBar = $('<div class="statusBar" id="' + statBarId + '"></div>')
|
|
|
|
.hide();
|
|
|
|
|
|
|
|
// Create info bar
|
|
|
|
var infoBar = createInfoBar('Not yet supported');
|
|
|
|
|
|
|
|
// Create clone form
|
|
|
|
var cloneForm = $('<div class="form"></div>');
|
|
|
|
cloneForm.append(statBar);
|
|
|
|
cloneForm.append(infoBar);
|
|
|
|
|
|
|
|
// Add clone tab
|
|
|
|
tab.add(newTabId, 'Clone', cloneForm, true);
|
|
|
|
}
|
2011-04-16 14:40:15 +00:00
|
|
|
|
2012-05-04 00:54:58 +00:00
|
|
|
tab.select(newTabId);
|
2010-07-22 19:56:09 +00:00
|
|
|
};
|
2010-07-15 22:57:48 +00:00
|
|
|
|
|
|
|
/**
|
2010-07-19 18:28:31 +00:00
|
|
|
* Load provision page
|
2010-07-15 22:57:48 +00:00
|
|
|
*
|
2012-05-04 00:54:58 +00:00
|
|
|
* @param tabId The provision tab ID
|
2010-07-15 22:57:48 +00:00
|
|
|
*/
|
2010-07-23 18:47:54 +00:00
|
|
|
hmcPlugin.prototype.loadProvisionPage = function(tabId) {
|
2011-08-24 10:30:30 +00:00
|
|
|
// Create provision form
|
|
|
|
var provForm = $('<div class="form"></div>');
|
2010-07-20 18:49:31 +00:00
|
|
|
|
2011-08-24 10:30:30 +00:00
|
|
|
// Create info bar
|
2012-03-15 05:09:28 +00:00
|
|
|
var infoBar = createInfoBar('Provision a node on System p');
|
2011-08-24 10:30:30 +00:00
|
|
|
provForm.append(infoBar);
|
2011-04-16 14:40:15 +00:00
|
|
|
|
2011-08-24 10:30:30 +00:00
|
|
|
// Append to provision tab
|
|
|
|
$('#' + tabId).append(provForm);
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2012-03-15 05:09:28 +00:00
|
|
|
// Append provisioning section for HMC
|
|
|
|
appendProvisionSection('hmc', provForm);
|
2010-07-22 19:56:09 +00:00
|
|
|
};
|
2011-04-16 14:40:15 +00:00
|
|
|
|
2010-07-19 18:28:31 +00:00
|
|
|
/**
|
|
|
|
* Load resources
|
|
|
|
*/
|
2010-07-23 18:47:54 +00:00
|
|
|
hmcPlugin.prototype.loadResources = function() {
|
2012-05-04 00:54:58 +00:00
|
|
|
// Get resource tab ID
|
|
|
|
var tabId = 'hmcResourceTab';
|
|
|
|
// Remove loader
|
|
|
|
$('#' + tabId).find('img').remove();
|
2011-04-16 14:40:15 +00:00
|
|
|
|
2012-05-04 00:54:58 +00:00
|
|
|
// Create info bar
|
|
|
|
var infoBar = createInfoBar('Not yet supported');
|
2010-07-28 20:24:29 +00:00
|
|
|
|
2012-05-04 00:54:58 +00:00
|
|
|
// Create resource form
|
|
|
|
var resrcForm = $('<div class="form"></div>');
|
|
|
|
resrcForm.append(infoBar);
|
2011-04-16 14:40:15 +00:00
|
|
|
|
2012-05-04 00:54:58 +00:00
|
|
|
$('#' + tabId).append(resrcForm);
|
2010-09-22 16:52:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2010-09-24 02:27:04 +00:00
|
|
|
* Add node range
|
2010-09-22 16:52:41 +00:00
|
|
|
*/
|
2010-09-23 20:43:10 +00:00
|
|
|
hmcPlugin.prototype.addNode = function() {
|
2012-05-04 00:54:58 +00:00
|
|
|
var dialog = $('<div id="addHmc" class="form"></div>');
|
|
|
|
dialog.append(createInfoBar('Add a System p node range'));
|
|
|
|
|
|
|
|
// Create option to select node type
|
|
|
|
dialog.append('<div><label>Node type:</label>'
|
|
|
|
+ '<select id="nodeType"><option>HMC</option>'
|
|
|
|
+ '<option>Scan node</option>' + '</select></div>');
|
|
|
|
dialog.append('<div id="nodeSettings"></div>');
|
|
|
|
|
|
|
|
// Show dialog
|
|
|
|
dialog.dialog({
|
2011-09-09 06:03:09 +00:00
|
|
|
modal : true,
|
|
|
|
width : 400,
|
2011-09-28 21:38:12 +00:00
|
|
|
title : 'Add node',
|
2012-05-04 00:54:58 +00:00
|
|
|
close : function() {
|
|
|
|
$('#addHmc').remove();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// Bind to select change event
|
|
|
|
$('#nodeType').bind('change',
|
|
|
|
function() {
|
|
|
|
// Remove existing warnings
|
|
|
|
$('#addHmc .ui-state-error').remove();
|
|
|
|
|
|
|
|
// Clear settings section
|
|
|
|
$('#nodeSettings').empty();
|
|
|
|
if ($(this).val() == 'HMC') {
|
|
|
|
$('#addHmc').dialog('option', 'width', '400');
|
|
|
|
$('#nodeSettings').append('<div><label>Node:</label><input type="text" name="node"/></div>');
|
|
|
|
$('#nodeSettings').append('<div><label>User name:</label><input type="text" name="username"/></div>');
|
|
|
|
$('#nodeSettings').append('<div><label>Password:</label><input type="password" name="password"/></div>');
|
|
|
|
$('#nodeSettings').append('<div><label>IP adress:</label><input type="text" name="ip"/></div>');
|
|
|
|
|
|
|
|
// Change dialog buttons
|
|
|
|
$('#addHmc').dialog('option', 'buttons', {
|
|
|
|
'Add' : function() {
|
|
|
|
addHmcNode();
|
|
|
|
},
|
|
|
|
'Cancel' : function() {
|
|
|
|
$('#addHmc').dialog('close');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
// Add loader
|
|
|
|
$('#nodeSettings').append(createLoader());
|
|
|
|
|
|
|
|
// Change dialog buttons
|
|
|
|
$('#addHmc').dialog('option', 'buttons', {
|
|
|
|
'Cancel' : function() {
|
|
|
|
$('#addHmc').dialog('close');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// Set to longer dialog width
|
|
|
|
$('#addHmc').dialog('option', 'width', '650');
|
|
|
|
$.ajax({
|
|
|
|
url : 'lib/cmd.php',
|
|
|
|
dataType : 'json',
|
|
|
|
data : {
|
|
|
|
cmd : 'nodels',
|
|
|
|
tgt : 'all',
|
|
|
|
args : 'nodetype.nodetype==hmc',
|
|
|
|
msg : ''
|
|
|
|
},
|
|
|
|
success : function(data) {
|
|
|
|
// Remove loader
|
|
|
|
$('#nodeSettings img').remove();
|
|
|
|
drawHmcSelector(data.rsp);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// Trigger select event change
|
|
|
|
$('#nodeType').trigger('change');
|
2011-12-31 06:46:13 +00:00
|
|
|
};
|
|
|
|
|
2012-03-14 04:32:06 +00:00
|
|
|
/**
|
|
|
|
* Add HMC node
|
|
|
|
*/
|
2012-05-04 00:54:58 +00:00
|
|
|
function addHmcNode() {
|
|
|
|
// Remove existing warnings
|
2012-03-14 04:32:06 +00:00
|
|
|
$('#addHmc .ui-state-error').remove();
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
var errorMessage = '';
|
|
|
|
var args = '';
|
|
|
|
$('#nodeSettings input').each(function() {
|
|
|
|
if (!$(this).val())
|
|
|
|
errorMessage = 'Please provide a value for each missing field!';
|
|
|
|
args += $(this).val() + ',';
|
|
|
|
});
|
|
|
|
|
|
|
|
// Do no continue if an error is found
|
|
|
|
if (errorMessage) {
|
|
|
|
$('#addHmc').prepend(createWarnBar(errorMessage));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Disabled button
|
|
|
|
$('.ui-dialog-buttonpane button').attr('disabled', 'disabled');
|
|
|
|
// Remove last comma
|
|
|
|
args = args.substr(0, args.length - 1);
|
|
|
|
|
|
|
|
// Append loader
|
|
|
|
$('#nodeSettings').append(createLoader());
|
|
|
|
|
|
|
|
// Send request to add HMC
|
|
|
|
$.ajax({
|
|
|
|
url : 'lib/cmd.php',
|
2012-03-14 04:32:06 +00:00
|
|
|
dataType : 'json',
|
|
|
|
data : {
|
|
|
|
cmd : 'webrun',
|
|
|
|
tgt : '',
|
|
|
|
args : 'addnode;hmc;' + args,
|
|
|
|
msg : ''
|
|
|
|
},
|
2012-05-04 00:54:58 +00:00
|
|
|
success : function(data) {
|
|
|
|
$('#addHmc').dialog('close');
|
2012-03-14 04:32:06 +00:00
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
});
|
2012-03-14 04:32:06 +00:00
|
|
|
}
|
2011-12-31 06:46:13 +00:00
|
|
|
|
2011-09-09 06:03:09 +00:00
|
|
|
/**
|
2012-03-14 04:32:06 +00:00
|
|
|
* Add HMCs into dialog
|
2011-09-09 06:03:09 +00:00
|
|
|
*
|
2012-05-04 00:54:58 +00:00
|
|
|
* @param hmcs HMCs
|
2011-09-09 06:03:09 +00:00
|
|
|
*/
|
2012-05-04 00:54:58 +00:00
|
|
|
function drawHmcSelector(hmcs) {
|
|
|
|
// Remove existing warnings
|
2012-03-14 04:32:06 +00:00
|
|
|
$('#addHmc .ui-state-error').remove();
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
// Do not continue if no HMCs are given
|
|
|
|
if (hmcs.length < 1) {
|
|
|
|
$('#addHmc').prepend(createWarnBar('Please define an HMC node first!'));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Add HMCs into a dropdown and add scan button
|
|
|
|
var hmcSelect = $('<select></select>');
|
|
|
|
var scanButton = createButton('Scan');
|
|
|
|
for (var i in hmcs) {
|
|
|
|
hmcSelect.append('<option>' + hmcs[i][0] + '</option>');
|
|
|
|
}
|
|
|
|
|
|
|
|
$('#nodeSettings').append($('<div><label>HMC:</label></div>').append(hmcSelect, scanButton));
|
|
|
|
|
|
|
|
scanButton.bind('click', function() {
|
|
|
|
var hmcname = $('#nodeSettings select').val();
|
|
|
|
$('#nodeSettings').append(createLoader());
|
|
|
|
$.ajax({
|
|
|
|
url : 'lib/cmd.php',
|
|
|
|
dataType : 'json',
|
|
|
|
data : {
|
|
|
|
cmd : 'rscan',
|
|
|
|
tgt : hmcname,
|
|
|
|
args : '',
|
|
|
|
msg : ''
|
|
|
|
},
|
|
|
|
success : function(data) {
|
|
|
|
// Remove loader
|
|
|
|
$('#nodeSettings img').remove();
|
|
|
|
|
|
|
|
// Draw table with checkboxes
|
|
|
|
drawRscanResult(data.rsp[0]);
|
|
|
|
|
|
|
|
// Add the add button
|
|
|
|
$('#addHmc').dialog('option', 'buttons', {
|
|
|
|
'Add' : function() {
|
|
|
|
addPNode();
|
|
|
|
},
|
|
|
|
'Cancel' : function() {
|
|
|
|
$('#addHmc').dialog('close');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
2011-09-09 06:03:09 +00:00
|
|
|
}
|
|
|
|
|
2012-03-14 04:32:06 +00:00
|
|
|
/**
|
|
|
|
* Draw table showing HMC rscan results
|
|
|
|
*
|
2012-05-04 00:54:58 +00:00
|
|
|
* @param results Data returned from rscan
|
2012-03-14 04:32:06 +00:00
|
|
|
*/
|
2012-05-04 00:54:58 +00:00
|
|
|
function drawRscanResult(results) {
|
|
|
|
var tmpRegex = /\S+/g;
|
|
|
|
var idRegex = /^\d+$/;
|
|
|
|
var rSection = $('<div class="tab" style="height:300px; overflow:auto;"></div>');
|
|
|
|
var rTable = $('<table></table>');
|
|
|
|
|
|
|
|
// Empty node settings section
|
|
|
|
$('#nodeSettings div').remove();
|
|
|
|
if (!results)
|
|
|
|
return;
|
|
|
|
|
|
|
|
var lines = results.split("\n");
|
|
|
|
// Do not continue if no results are found
|
|
|
|
if (lines.length < 2) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var fields = lines[0].match(tmpRegex);
|
|
|
|
var cols = fields.length;
|
|
|
|
|
|
|
|
// Add table header
|
|
|
|
var tHead = $('<thead class="ui-widget-header"></thead>').append('<th><input type="checkbox" onclick="selectAllRscanNode(this)"></th>');
|
|
|
|
for (var i in fields) {
|
|
|
|
tHead.append('<th>' + fields[i] + '</th>');
|
|
|
|
}
|
|
|
|
rTable.append(tHead);
|
|
|
|
|
|
|
|
// Add table body
|
|
|
|
var tBody = $('<tbody></tbody>');
|
|
|
|
rTable.append(tBody);
|
|
|
|
for (var i = 1; i < lines.length; i++) {
|
|
|
|
var row = $('<tr></tr>');
|
|
|
|
|
|
|
|
// Go to next row if there is nothing
|
|
|
|
if (!lines[i])
|
|
|
|
continue;
|
|
|
|
|
|
|
|
fields = lines[i].match(tmpRegex);
|
|
|
|
|
|
|
|
// Go to next row if this row is the HMC
|
|
|
|
if (fields[0] == 'hmc')
|
|
|
|
continue;
|
|
|
|
|
|
|
|
// If the 3rd field is empty, create an empty column
|
|
|
|
if (!idRegex.test(fields[2]))
|
|
|
|
fields = [ fields[0], fields[1], '' ].concat(fields.slice(2));
|
|
|
|
row.append('<td><input type="checkbox" name="' + fields[1] + '"></td>');
|
|
|
|
|
|
|
|
// Go through each field and add it to the row as a column
|
|
|
|
for (var j = 0; j < cols; j++) {
|
|
|
|
var col = $('<td></td>');
|
|
|
|
if (fields[j]) {
|
|
|
|
if (j == 1)
|
|
|
|
col.append('<input value="' + fields[j] + '"/>');
|
|
|
|
else
|
|
|
|
col.append(fields[j]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tBody.append(row);
|
|
|
|
}
|
|
|
|
|
|
|
|
rSection.append(rTable);
|
|
|
|
$('#nodeSettings').append(rSection);
|
2011-09-09 06:03:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-05-04 00:54:58 +00:00
|
|
|
* Add System p node (contains frame, CEC, LPAR)
|
2011-09-09 06:03:09 +00:00
|
|
|
*/
|
2012-05-04 00:54:58 +00:00
|
|
|
function addPNode() {
|
|
|
|
// Get the HMC name
|
|
|
|
var hmcname = $('#nodeSettings select').val();
|
|
|
|
var nodename = '';
|
|
|
|
|
|
|
|
// Get checked nodes
|
|
|
|
$('#nodeSettings :checked').each(function() {
|
|
|
|
if ($(this).attr('name')) {
|
|
|
|
nodename += $(this).attr('name') + ',';
|
|
|
|
nodename += $(this).parents('tr').find('input').eq(1).val() + ',';
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
if (!nodename) {
|
|
|
|
alert('You should select nodes first!');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Disabled the button
|
|
|
|
$('.ui-dialog-buttonpane button').attr('disabled', 'disabled');
|
|
|
|
|
|
|
|
nodename = nodename.substr(0, nodename.length - 1);
|
|
|
|
$('#nodeSettings').append(createLoader());
|
|
|
|
// Send the add request
|
|
|
|
$.ajax({
|
|
|
|
url : 'lib/cmd.php',
|
2011-09-09 06:03:09 +00:00
|
|
|
dataType : 'json',
|
|
|
|
data : {
|
|
|
|
cmd : 'webrun',
|
|
|
|
tgt : '',
|
2011-09-21 07:11:31 +00:00
|
|
|
args : 'addnode;node;' + hmcname + ',' + nodename,
|
2011-09-09 06:03:09 +00:00
|
|
|
msg : ''
|
|
|
|
},
|
2011-09-12 19:47:26 +00:00
|
|
|
success : function(data) {
|
2012-05-04 00:54:58 +00:00
|
|
|
// Refresh the area on the right side
|
|
|
|
$('#addHmc').dialog('close');
|
|
|
|
$('.selectgroup').trigger('click');
|
2011-09-09 06:03:09 +00:00
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
});
|
2011-09-09 06:03:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-05-04 00:54:58 +00:00
|
|
|
* Select all checkbox in a table
|
2011-09-09 06:03:09 +00:00
|
|
|
*/
|
2012-05-04 00:54:58 +00:00
|
|
|
function selectAllRscanNode(obj) {
|
|
|
|
var status = $(obj).attr('checked');
|
|
|
|
$(obj).parents('table').find(':checkbox').attr('checked', status);
|
2011-12-31 06:46:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-05-04 00:54:58 +00:00
|
|
|
* Step 2: Cluster basic patterns
|
2011-12-31 06:46:13 +00:00
|
|
|
*/
|
2012-05-04 00:54:58 +00:00
|
|
|
function powerInitBasicPattern() {
|
2011-12-31 06:46:13 +00:00
|
|
|
$('#discoverContentDiv').empty();
|
|
|
|
$('.tooltip').remove();
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
var showString = '<div style="min-height:360px" id="patternDiv"><h2>' + steps[currentStep] + '</h2>';
|
|
|
|
showString += '<table><tbody>';
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2012-06-15 09:13:32 +00:00
|
|
|
showString += '<tr><td><b>Frames:</b></td></tr>';
|
2012-05-04 00:54:58 +00:00
|
|
|
showString += '<tr><td>Name Range:</td><td><input type="text" title="Format: Frame[1-6] or F1-F6" '
|
|
|
|
+ 'name="frameName" value="'
|
|
|
|
+ getDiscoverEnv('frameName')
|
|
|
|
+ '"></td>';
|
|
|
|
|
|
|
|
// Use the super node to configure file and calculate the CEC's number
|
2011-12-31 06:46:13 +00:00
|
|
|
showString += '<td></td><td></td></tr>';
|
2012-06-15 09:13:32 +00:00
|
|
|
showString += '<tr><td>Vlan1 IP Header:</td><td><input type="text" name="vlan1ip" value="'
|
|
|
|
+ getDiscoverEnv('vlan1ip') + '"></td><td>Vlan2 IP Header:</td>'
|
|
|
|
+ '<td><input type="text" name="vlan2ip" value="' + getDiscoverEnv('vlan2ip') + '"></td></tr>';
|
2011-12-31 06:46:13 +00:00
|
|
|
|
2012-06-15 09:13:32 +00:00
|
|
|
showString += '<tr><td><b>Drawers:</b></td></tr>';
|
2012-05-04 00:54:58 +00:00
|
|
|
showString += '<tr><td>Name Range:</td><td><input type="text" title="Format: CEC[1-60] or F[1-6]C[1-10]" '
|
|
|
|
+ 'name="cecName" value="' + getDiscoverEnv('cecName') + '"></td>';
|
|
|
|
|
|
|
|
showString += '<td>Number of LPARs per Drawer:</td><td><input type="text" name="lparNumPerCec" value="'
|
|
|
|
+ getDiscoverEnv('lparNumPerCec') + '"></td></tr>';
|
|
|
|
|
2012-06-15 09:13:32 +00:00
|
|
|
showString += '<tr><td><b>Lpars:</b></td></tr>';
|
2012-05-04 00:54:58 +00:00
|
|
|
showString += '<tr><td>Name Range:</td><td><input type="text" title="Format: F[1-6]C[1-10]L[1-8]" '
|
|
|
|
+ 'name="lparName" value="'
|
|
|
|
+ getDiscoverEnv('lparName')
|
2012-06-15 09:13:32 +00:00
|
|
|
+ '"></td><td>Starting IP Adress:</td><td><input type="text" name="lparstartip" value="'
|
|
|
|
+ getDiscoverEnv('lparstartip') + '"></td></tr>';
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2012-06-15 09:13:32 +00:00
|
|
|
showString += '<tr><td><b>HMCs:</b></td></tr>';
|
2012-05-04 00:54:58 +00:00
|
|
|
showString += '<tr id="hmcTr"><td>Name Range:</td><td><input type="text" title="Format: HMC[01-10] or HMC01-HMC10" name="hmcName" value="'
|
|
|
|
+ getDiscoverEnv('hmcName') + '"></td>';
|
|
|
|
|
|
|
|
showString += '<td>Number of Frames per HMC:</td><td><input type="text" name="frameNumPerHmc" value="'
|
|
|
|
+ getDiscoverEnv('frameNumPerHmc') + '"></td></tr>';
|
2012-06-15 09:13:32 +00:00
|
|
|
showString += '<tr><td>Starting IP Adress:</td><td><input type="text" name="hmcstartip" value="'
|
|
|
|
+ getDiscoverEnv('hmcstartip') + '"></td>';
|
|
|
|
showString += '<td>Hardware Managment:</td><td><input type="radio" name="managetype" value="hmc" title="Hardware Management Console">HMC ';
|
2011-12-31 06:46:13 +00:00
|
|
|
showString += '<input type="radio" name="managetype" value="dfm" title="Direct FSP Management">DFM</td></tr>';
|
2012-06-15 09:13:32 +00:00
|
|
|
|
|
|
|
showString += '<tr><td><b>Building Block</b></td></tr>';
|
|
|
|
showString += '<tr><td>Frame amount per BB:</td>'
|
|
|
|
+ '<td><input type="text" name="framepbb" value="' + getDiscoverEnv('framepbb') + '"></td>'
|
|
|
|
+ '<td>CEC amount per BB:</td>'
|
|
|
|
+ '<td><input type="text" name="cecpbb" value="' + getDiscoverEnv('cecpbb') + '"></td>'
|
|
|
|
+ '</tr>';
|
2011-12-31 06:46:13 +00:00
|
|
|
showString += '</tbody></table></div>';
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
$('#discoverContentDiv').append(showString);
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
$('#discoverContentDiv [title]').tooltip({
|
2012-05-04 00:54:58 +00:00
|
|
|
position : "center right",
|
|
|
|
offset : [ -2, 10 ],
|
|
|
|
effect : "fade",
|
|
|
|
opacity : 1
|
2011-12-31 06:46:13 +00:00
|
|
|
});
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
// Change the radio input checked status
|
|
|
|
if (getDiscoverEnv('hmcFlag')) {
|
2011-12-31 06:46:13 +00:00
|
|
|
$('#discoverContentDiv :radio[value=hmc]').attr('checked', 'checked');
|
2012-05-04 00:54:58 +00:00
|
|
|
} else {
|
2011-12-31 06:46:13 +00:00
|
|
|
$('#discoverContentDiv :radio[value=dfm]').attr('checked', 'checked');
|
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
createDiscoverButtons();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-05-04 00:54:58 +00:00
|
|
|
* Step 2: Check basic patterns when user input the basic patterns
|
2011-12-31 06:46:13 +00:00
|
|
|
*/
|
2012-05-04 00:54:58 +00:00
|
|
|
function checkBasicPattern(operType) {
|
2011-12-31 06:46:13 +00:00
|
|
|
collectInputValue();
|
|
|
|
|
2012-05-04 00:54:58 +00:00
|
|
|
if ('back' == operType) {
|
2011-12-31 06:46:13 +00:00
|
|
|
return true;
|
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
$('#patternDiv .ui-state-error').remove();
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
var errMessage = '';
|
|
|
|
var tempName = '';
|
|
|
|
var frameNum = 0;
|
|
|
|
var cecNum = 0;
|
|
|
|
var lparNum = 0;
|
|
|
|
var hmcNum = 0;
|
|
|
|
var cecNumPerFrame = getDiscoverEnv('cecNumPerFrame');
|
|
|
|
var frameNumPerHmc = getDiscoverEnv('frameNumPerHmc');
|
|
|
|
var lparNumPerCec = getDiscoverEnv('lparNumPerCec');
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
// Check the frame name
|
2011-12-31 06:46:13 +00:00
|
|
|
tempName = getDiscoverEnv('frameName');
|
2012-05-04 00:54:58 +00:00
|
|
|
if (!tempName) {
|
2011-12-31 06:46:13 +00:00
|
|
|
errMessage += 'Input the Frame Name Range.<br/>';
|
2012-05-04 00:54:58 +00:00
|
|
|
} else {
|
2011-12-31 06:46:13 +00:00
|
|
|
frameNum = expandNR(tempName).length;
|
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
// Check the CEC name
|
2011-12-31 06:46:13 +00:00
|
|
|
tempName = getDiscoverEnv('cecName');
|
2012-05-04 00:54:58 +00:00
|
|
|
if (!tempName) {
|
2011-12-31 06:46:13 +00:00
|
|
|
errMessage += 'Input the CEC Name Range.<br/>';
|
2012-05-04 00:54:58 +00:00
|
|
|
} else {
|
2011-12-31 06:46:13 +00:00
|
|
|
cecNum = expandNR(tempName).length;
|
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
// LPAR number per CEC
|
|
|
|
if (!lparNumPerCec) {
|
2011-12-31 06:46:13 +00:00
|
|
|
errMessage += 'Input the Lpar Number Per Drawer.<br/>';
|
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
// Check the LPAR name
|
2011-12-31 06:46:13 +00:00
|
|
|
tempName = getDiscoverEnv('lparName');
|
2012-05-04 00:54:58 +00:00
|
|
|
if (!tempName) {
|
2011-12-31 06:46:13 +00:00
|
|
|
errMessage += 'Input the Lpar Name Range.<br/>';
|
2012-05-04 00:54:58 +00:00
|
|
|
} else {
|
2011-12-31 06:46:13 +00:00
|
|
|
lparNum = expandNR(tempName).length;
|
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
// Check the HMC name
|
2011-12-31 06:46:13 +00:00
|
|
|
tempName = getDiscoverEnv('hmcName');
|
2012-05-04 00:54:58 +00:00
|
|
|
if (!tempName) {
|
2011-12-31 06:46:13 +00:00
|
|
|
errMessage += 'Input the HMC Name Range.<br/>';
|
2012-05-04 00:54:58 +00:00
|
|
|
} else {
|
2011-12-31 06:46:13 +00:00
|
|
|
hmcNum = expandNR(tempName).length;
|
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
// Frame number per HMC
|
|
|
|
if (!frameNumPerHmc) {
|
2011-12-31 06:46:13 +00:00
|
|
|
errMessage += 'Input the Frame Number Per HMC.<br/>';
|
|
|
|
}
|
2012-06-15 09:13:32 +00:00
|
|
|
|
|
|
|
if (!getDiscoverEnv('vlan1ip')){
|
|
|
|
errMessage += 'Input the Vlan 1 IP Header.<br/>';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!getDiscoverEnv('vlan2ip')){
|
|
|
|
errMessage += 'Input the Vlan 2 IP Header.<br/>';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!getDiscoverEnv('lparstartip')){
|
|
|
|
errMessage += 'Input the Lpars\' Starting IP Adress.<br/>';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!getDiscoverEnv('hmcstartip')){
|
|
|
|
errMessage += 'Input the HMCs\' Starting IP Adress.<br/>';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!getDiscoverEnv('framepbb')){
|
|
|
|
errMessage += 'Input the Frame amount per BB.<br/>';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!getDiscoverEnv('cecpbb')){
|
|
|
|
errMessage += 'Input the CEC amount per BB<br/>';
|
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
// Hardware management type is HMC
|
|
|
|
if ('hmc' == $('#discoverContentDiv :checked').attr('value')) {
|
2011-12-31 06:46:13 +00:00
|
|
|
setDiscoverEnv('hmcFlag', true);
|
2012-05-04 00:54:58 +00:00
|
|
|
} else {
|
2011-12-31 06:46:13 +00:00
|
|
|
removeDiscoverEnv('hmcFlag');
|
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
// Input value check is finished
|
|
|
|
if ('' != errMessage) {
|
2011-12-31 06:46:13 +00:00
|
|
|
var warnBar = createWarnBar(errMessage);
|
|
|
|
$('#patternDiv').prepend(warnBar);
|
|
|
|
return false;
|
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
// Check the connections between all numbers
|
|
|
|
if (getDiscoverEnv('hmcFlag')) {
|
|
|
|
if ((Number(frameNumPerHmc) * hmcNum) < frameNum) {
|
|
|
|
errMessage += 'The frame number should less than '
|
|
|
|
+ Number(cecNumPerFrame)
|
|
|
|
* frameNum
|
|
|
|
+ ' ("the number of hmc" * "the number of frame managed by per hmc")';
|
2011-12-31 06:46:13 +00:00
|
|
|
}
|
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2012-06-15 09:13:32 +00:00
|
|
|
if ((Number(lparNumPerCec) * cecNum) > lparNum) {
|
2012-05-04 00:54:58 +00:00
|
|
|
errMessage += 'The number of Lpars calculate by Name Range should be '
|
|
|
|
+ Number(lparNumPerCec) * cecNum
|
|
|
|
+ '("the number of Drawers" * "the number of lpar per drawer")';
|
2011-12-31 06:46:13 +00:00
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
if ('' != errMessage) {
|
2011-12-31 06:46:13 +00:00
|
|
|
var warnBar = createWarnBar(errMessage);
|
|
|
|
$('#patternDiv').prepend(warnBar);
|
|
|
|
return false;
|
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
setDiscoverEnv('cecNum', cecNum);
|
|
|
|
setDiscoverEnv('frameNum', frameNum);
|
|
|
|
setDiscoverEnv('lparNum', lparNum);
|
|
|
|
setDiscoverEnv('hmcNum', hmcNum);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-05-04 00:54:58 +00:00
|
|
|
* Step 3: Allow the users to edit the super node configure file
|
2011-12-31 06:46:13 +00:00
|
|
|
*/
|
2012-05-04 00:54:58 +00:00
|
|
|
function powerInitSupernode() {
|
2011-12-31 06:46:13 +00:00
|
|
|
$('#discoverContentDiv').empty();
|
|
|
|
$('.tooltip').remove();
|
2012-05-04 00:54:58 +00:00
|
|
|
$('#discoverContentDiv').append(
|
|
|
|
'<div style="min-height:360px" id="supernodeDiv"><h2>'
|
|
|
|
+ steps[currentStep] + '</h2></div>');
|
2011-12-31 06:46:13 +00:00
|
|
|
createDiscoverButtons();
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
// Add the introduction about the page
|
2011-12-31 06:46:13 +00:00
|
|
|
var infoStr = '<div>The supernode-list file lists what supernode numbers should be ';
|
|
|
|
infoStr += 'given to each CEC in each frame. Here is a sample file:<br/>';
|
2012-07-24 12:17:04 +00:00
|
|
|
infoStr += 'frame01: 0, 1, 16<br/>frame02: 17, 32<br/>frame03: 33, 48, 49<br/>';
|
|
|
|
infoStr += 'frame04: 64 , 65, 80<br/>frame05: 81, 96<br/>frame06: 97(1), 112(1), 113(1), 37(1), 55, 71<br/>';
|
2012-05-04 00:54:58 +00:00
|
|
|
infoStr += 'The name before the colon is the node name of the frame BPC. The numbers after the colon '
|
|
|
|
+ 'are the supernode numbers to assign to the groups of CECs in that frame from bottom to top. '
|
|
|
|
+ 'Each supernode contains 4 CECs, unless it is immediately followed by "(#)", in which case the '
|
2012-07-24 12:17:04 +00:00
|
|
|
+ 'number in parenthesis indicates how many CECs are in this supernode.<br/><br/>'
|
|
|
|
+ 'You can define the supernode by inputting manually or load a configure file same with the correct format.</div>';
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
var InfoBar = createInfoBar(infoStr);
|
|
|
|
$('#discoverContentDiv #supernodeDiv').append(InfoBar);
|
2012-07-24 12:17:04 +00:00
|
|
|
|
|
|
|
var uploadform = $('<form action="lib/upload.php" method="post" enctype="multipart/form-data">'
|
|
|
|
+ 'Configuration File:'
|
|
|
|
+ '<input type="file" id="file" name="file"></form>');
|
|
|
|
uploadform.find('form').append(createButton('Parse'));
|
|
|
|
uploadform.ajaxForm({
|
|
|
|
success: parseSupernodeConfig
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#discoverContentDiv #supernodeDiv').append(uploadform);
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
var frameArray = expandNR(getDiscoverEnv('frameName'));
|
|
|
|
var showStr = '<center><table><tbody>';
|
2012-05-04 00:54:58 +00:00
|
|
|
for (var i in frameArray) {
|
2012-07-24 12:17:04 +00:00
|
|
|
var tempname = 'sp_' + frameArray[i];
|
2012-05-04 00:54:58 +00:00
|
|
|
showStr += '<tr><td>' + frameArray[i]
|
2012-07-24 12:17:04 +00:00
|
|
|
+ ':</td><td><input type="text" name="' + tempname + '" id="' + tempname
|
|
|
|
+ '" value="' + getDiscoverEnv(tempname)
|
2012-05-04 00:54:58 +00:00
|
|
|
+ '"></td></tr>';
|
2011-12-31 06:46:13 +00:00
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
showStr += '</tbody></table></center>';
|
|
|
|
$('#discoverContentDiv #supernodeDiv').append(showStr);
|
|
|
|
}
|
|
|
|
|
2012-07-24 12:17:04 +00:00
|
|
|
/**
|
|
|
|
* Step 3: Parse the content in the configure file
|
|
|
|
*/
|
|
|
|
function parseSupernodeConfig(responseText){
|
|
|
|
var lines = responseText.split("\n");
|
|
|
|
for(var i in lines){
|
|
|
|
var spMap = lines[i].split(':');
|
|
|
|
var spName = spMap[0];
|
|
|
|
var spDef = spMap[1];
|
|
|
|
$('#sp_' + spName).attr('value', spDef);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
/**
|
2012-05-04 00:54:58 +00:00
|
|
|
* Step 3: Check the super node configure file
|
2011-12-31 06:46:13 +00:00
|
|
|
*/
|
2012-05-04 00:54:58 +00:00
|
|
|
function checkSupernode(operType) {
|
2011-12-31 06:46:13 +00:00
|
|
|
collectInputValue();
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
if ('back' == operType) {
|
2011-12-31 06:46:13 +00:00
|
|
|
return true;
|
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
$('#supernodeDiv .ui-state-error').remove();
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
var errString = '';
|
|
|
|
var eceNum = 0;
|
|
|
|
var args = '';
|
|
|
|
var frameArray = expandNR(getDiscoverEnv('frameName'));
|
2012-05-04 00:54:58 +00:00
|
|
|
for (var i in frameArray) {
|
2011-12-31 06:46:13 +00:00
|
|
|
var sp_config = getDiscoverEnv('sp_' + frameArray[i]);
|
2012-05-04 00:54:58 +00:00
|
|
|
if (sp_config) {
|
2011-12-31 06:46:13 +00:00
|
|
|
eceNum += calcCec(sp_config);
|
2012-05-04 00:54:58 +00:00
|
|
|
if (0 == i) {
|
2011-12-31 06:46:13 +00:00
|
|
|
args += frameArray[i] + ': ' + sp_config;
|
2012-05-04 00:54:58 +00:00
|
|
|
} else {
|
2011-12-31 06:46:13 +00:00
|
|
|
args += '\n' + frameArray[i] + ': ' + sp_config;
|
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
} else {
|
|
|
|
errString += 'Input the super node configure for ' + frameArray[i]
|
|
|
|
+ '<br/>';
|
2011-12-31 06:46:13 +00:00
|
|
|
}
|
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
args += '\n';
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
var warnBar;
|
2012-05-04 00:54:58 +00:00
|
|
|
if (errString) {
|
2011-12-31 06:46:13 +00:00
|
|
|
warnBar = createWarnBar(errString);
|
|
|
|
$('#supernodeDiv').prepend(warnBar);
|
|
|
|
return false;
|
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
$.ajax({
|
|
|
|
url : 'lib/cmd.php',
|
|
|
|
dataType : 'json',
|
|
|
|
data : {
|
|
|
|
cmd : 'webrun',
|
|
|
|
tgt : '',
|
|
|
|
args : 'writeconfigfile;/tmp/websupernode.txt;' + args,
|
|
|
|
msg : ''
|
|
|
|
}
|
|
|
|
});
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-05-04 00:54:58 +00:00
|
|
|
function calcCec(spConfigStr) {
|
2011-12-31 06:46:13 +00:00
|
|
|
var tempArray = spConfigStr.split(',');
|
|
|
|
var num = 0;
|
|
|
|
var reg = /\(([1-4])\)/;
|
2012-05-04 00:54:58 +00:00
|
|
|
for (var i in tempArray) {
|
2011-12-31 06:46:13 +00:00
|
|
|
var regRes = reg.exec(tempArray[i]);
|
2012-05-04 00:54:58 +00:00
|
|
|
if (regRes && regRes[1]) {
|
2011-12-31 06:46:13 +00:00
|
|
|
num += Number(regRes[1]);
|
2012-05-04 00:54:58 +00:00
|
|
|
} else {
|
2011-12-31 06:46:13 +00:00
|
|
|
num += 4;
|
|
|
|
}
|
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
return num;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-05-04 00:54:58 +00:00
|
|
|
* Step 4: Show the field which need to be configured in the site table
|
2011-12-31 06:46:13 +00:00
|
|
|
*/
|
2012-05-04 00:54:58 +00:00
|
|
|
function powerInitSiteTable(operType) {
|
2011-12-31 06:46:13 +00:00
|
|
|
$('#discoverContentDiv').empty();
|
|
|
|
$('.tooltip').remove();
|
2012-05-04 00:54:58 +00:00
|
|
|
var showDiv = $('<div style="min-height:360px" id="siteDiv"><h2>'
|
|
|
|
+ steps[currentStep] + '(Site info)</h2></div>');
|
2011-12-31 06:46:13 +00:00
|
|
|
var statBar = createStatusBar('siteTableStat');
|
|
|
|
statBar.find('div').append(createLoader());
|
|
|
|
showDiv.append(statBar);
|
|
|
|
$('#discoverContentDiv').append(showDiv);
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
if (getDiscoverEnv('domainname')) {
|
2011-12-31 06:46:13 +00:00
|
|
|
showSiteArea();
|
|
|
|
return;
|
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
$.ajax({
|
|
|
|
url : 'lib/cmd.php',
|
|
|
|
dataType : 'json',
|
|
|
|
data : {
|
|
|
|
cmd : 'tabdump',
|
|
|
|
tgt : '',
|
|
|
|
args : 'site',
|
|
|
|
msg : ''
|
|
|
|
},
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
success : function(data) {
|
2011-12-31 06:46:13 +00:00
|
|
|
setDiscoverEnv('domainname', '');
|
2012-05-04 00:54:58 +00:00
|
|
|
setDiscoverEnv('nameserver', '');
|
|
|
|
for (var i in data.rsp) {
|
2011-12-31 06:46:13 +00:00
|
|
|
var tempArray = data.rsp[i].split(',');
|
|
|
|
var tempValue = tempArray[1];
|
2012-05-04 00:54:58 +00:00
|
|
|
switch (tempArray[0]) {
|
|
|
|
case '"domain"': {
|
|
|
|
setDiscoverEnv('domainname', tempValue.substr(1,
|
|
|
|
tempValue.length - 2));
|
|
|
|
}
|
2011-12-31 06:46:13 +00:00
|
|
|
break;
|
2012-05-04 00:54:58 +00:00
|
|
|
case '"nameservers"': {
|
|
|
|
setDiscoverEnv('nameserver', tempValue.substr(1,
|
|
|
|
tempValue.length - 2));
|
|
|
|
}
|
2011-12-31 06:46:13 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
showSiteArea();
|
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
});
|
2011-12-31 06:46:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-05-04 00:54:58 +00:00
|
|
|
* Step 4: When the values are ready, create the table
|
2011-12-31 06:46:13 +00:00
|
|
|
*/
|
2012-05-04 00:54:58 +00:00
|
|
|
function showSiteArea() {
|
2012-06-13 09:47:48 +00:00
|
|
|
var adminpasswd = getDiscoverEnv('adminpasswd');
|
|
|
|
adminpasswd = adminpasswd ? adminpasswd : "admin";
|
|
|
|
var generalpasswd = getDiscoverEnv('generalpasswd');
|
|
|
|
generalpasswd = generalpasswd? generalpasswd : "general";
|
|
|
|
var hmcpasswd = getDiscoverEnv('hmcpasswd');
|
|
|
|
hmcpasswd = hmcpasswd ? hmcpasswd : "abc123";
|
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
var showString = '<table><tbody>';
|
|
|
|
|
2012-05-04 00:54:58 +00:00
|
|
|
showString += '<tr><td>Domain Name:</td><td><input type="text" name="domainname" value="'
|
|
|
|
+ getDiscoverEnv('domainname')
|
|
|
|
+ '" title="The DNS domain name used for the cluster."></td></tr>';
|
|
|
|
|
|
|
|
showString += '<tr><td>Name server:</td><td><input type="text" name="nameserver" value="'
|
|
|
|
+ getDiscoverEnv('nameserver')
|
|
|
|
+ '" title="A comma delimited list of DNS servers that each node in the cluster should use - often the xCAT management node."></td></tr>';
|
|
|
|
|
|
|
|
showString += '<tr><td>DHCP Dynamic Range:</td><td><input type="text" name="ipStart" value="'
|
|
|
|
+ getDiscoverEnv('ipStart')
|
|
|
|
+ '" title="A start Ip address for DHCP dynamic range.">-<input type="text" name="ipEnd" disabled="disabled" value="'
|
|
|
|
+ getDiscoverEnv('ipEnd') + '"></td></tr>';
|
2012-06-13 09:47:48 +00:00
|
|
|
showString += '<tr><td>admin password for FRAME and CEC:</td><td><input type="text" '
|
|
|
|
+ 'name="adminpasswd" value="' + adminpasswd
|
|
|
|
+ '" title="the password used for xCAT to log on bpa and fsp with admin account."</td></tr>';
|
|
|
|
showString += '<tr><td>general password for FRAME and CEC:</td><td><input type="text" '
|
|
|
|
+ 'name="generalpasswd" value="' + generalpasswd
|
|
|
|
+ '" title="the password used for xCAT to log on bpa and fsp with general account."</td></tr>';
|
|
|
|
showString += '<tr><td>hmc password for FRAME and CEC:</td><td><input type="text" '
|
|
|
|
+ 'name="hmcpasswd" value="' + hmcpasswd
|
|
|
|
+ '" title="the password used for xCAT to log on bpa and fsp with hmc account."</td></tr>';
|
2011-12-31 06:46:13 +00:00
|
|
|
showString += '</tbody></table>';
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
$('#discoverContentDiv div').eq(0).append(showString);
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
$('#discoverContentDiv [title]').tooltip({
|
2012-05-04 00:54:58 +00:00
|
|
|
position : "center right",
|
|
|
|
offset : [ -2, 10 ],
|
|
|
|
effect : "fade",
|
|
|
|
opacity : 1
|
2011-12-31 06:46:13 +00:00
|
|
|
});
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
$('#discoverContentDiv input[name=ipStart]').bind(
|
|
|
|
'change',
|
|
|
|
function() {
|
|
|
|
if (verifyIp($(this).attr('value'))) {
|
|
|
|
var tempNum = Number(getDiscoverEnv('frameNum')) * 4
|
|
|
|
+ Number(getDiscoverEnv('cecNum')) * 4
|
|
|
|
+ Number(getDiscoverEnv('lparNum'))
|
|
|
|
+ Number(getDiscoverEnv('hmcNum'));
|
|
|
|
var ipEnd = calcEndIp($(this).attr('value'), tempNum);
|
|
|
|
if (!verifyIp(ipEnd)) {
|
|
|
|
ipEnd = '';
|
|
|
|
}
|
|
|
|
$('#discoverContentDiv input[name=ipEnd]').attr('value',
|
|
|
|
ipEnd);
|
|
|
|
} else {
|
|
|
|
$('#discoverContentDiv input[name=ipEnd]')
|
|
|
|
.attr('value', '');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// Show the current network interface configuration
|
2011-12-31 06:46:13 +00:00
|
|
|
$.ajax({
|
|
|
|
url : 'lib/systemcmd.php',
|
|
|
|
dataType : 'json',
|
|
|
|
data : {
|
|
|
|
cmd : 'ifconfig | grep -E "encap|Mask"'
|
|
|
|
},
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
success : function(data) {
|
|
|
|
$('#discoverContentDiv #siteTableStat div').html(
|
|
|
|
'Current network interface configuration:<br/><pre>'
|
|
|
|
+ data.rsp + '</pre>');
|
2011-12-31 06:46:13 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
createDiscoverButtons();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-05-04 00:54:58 +00:00
|
|
|
* Step 4: Check that the inputs are all filled
|
2011-12-31 06:46:13 +00:00
|
|
|
*/
|
2012-05-04 00:54:58 +00:00
|
|
|
function checkSiteTable(operType) {
|
2011-12-31 06:46:13 +00:00
|
|
|
$('#discoverContentDiv input[name=ipStart]').trigger('change');
|
|
|
|
collectInputValue();
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
if ('back' == operType) {
|
2011-12-31 06:46:13 +00:00
|
|
|
return true;
|
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
$('#discoverContentDiv .ui-state-error').remove();
|
|
|
|
var errMessage = '';
|
2012-05-04 00:54:58 +00:00
|
|
|
if (!getDiscoverEnv('domainname')) {
|
2011-12-31 06:46:13 +00:00
|
|
|
errMessage += 'Input the domain name.<br/>';
|
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
if (!getDiscoverEnv('nameserver')) {
|
2011-12-31 06:46:13 +00:00
|
|
|
errMessage += 'Input the name server.<br/>';
|
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
if (!getDiscoverEnv('ipEnd')) {
|
2011-12-31 06:46:13 +00:00
|
|
|
errMessage += 'Input the DHCP Dynamic Range.<br/>';
|
|
|
|
}
|
2012-06-13 09:47:48 +00:00
|
|
|
|
|
|
|
if (!getDiscoverEnv('adminpasswd')) {
|
|
|
|
errMessage += 'Input the admin\'s password for FRAME and CEC.<br/>';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!getDiscoverEnv('generalpasswd')) {
|
|
|
|
errMessage += 'Input the general\'s password for FRAME and CEC.<br/>';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!getDiscoverEnv('hmcpasswd')) {
|
|
|
|
errMessage += 'Input the hmc\'s password for FRAME and CEC.<br/>';
|
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
if ('' == errMessage) {
|
|
|
|
$.ajax({
|
2011-12-31 06:46:13 +00:00
|
|
|
url : 'lib/cmd.php',
|
|
|
|
dataType : 'json',
|
|
|
|
data : {
|
|
|
|
cmd : 'webrun',
|
|
|
|
tgt : '',
|
2012-05-04 00:54:58 +00:00
|
|
|
args : 'dynamiciprange;' + getDiscoverEnv('ipStart') + '-'
|
|
|
|
+ getDiscoverEnv('ipEnd'),
|
2011-12-31 06:46:13 +00:00
|
|
|
msg : ''
|
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
});
|
2011-12-31 06:46:13 +00:00
|
|
|
return true;
|
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
var warnBar = createWarnBar(errMessage);
|
|
|
|
$('#discoverContentDiv #siteDiv').prepend(warnBar);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-05-04 00:54:58 +00:00
|
|
|
* Step 5: Tell users to power on machines
|
2011-12-31 06:46:13 +00:00
|
|
|
*/
|
2012-05-04 00:54:58 +00:00
|
|
|
function powerInitPoweronHardware() {
|
2011-12-31 06:46:13 +00:00
|
|
|
$('#discoverContentDiv').empty();
|
|
|
|
$('.tooltip').remove();
|
2012-05-04 00:54:58 +00:00
|
|
|
var showStr = '<div style="min-height:360px"><h2>' + steps[currentStep]
|
|
|
|
+ '</h2><h3>Do the following manual steps now:</h3>';
|
2011-12-31 06:46:13 +00:00
|
|
|
showStr += '<ul><li>1. Power on the HMCs.</li>';
|
|
|
|
showStr += '<li>2. Configure the HMC\'s static IP and enable the SLP & SSH ports by HMC GUI</li>';
|
|
|
|
showStr += '<li>3. Power on all of Frames.</li>';
|
|
|
|
showStr += '<li>4. Click Next to discover the hardware on the service network.</li></ul></div>';
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
$('#discoverContentDiv').append(showStr);
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
createDiscoverButtons();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-05-04 00:54:58 +00:00
|
|
|
* Step 6: Discover all frames from the cluster and map all MTMs with frame name
|
2011-12-31 06:46:13 +00:00
|
|
|
*/
|
2012-05-04 00:54:58 +00:00
|
|
|
function powerInitDiscoverFrames() {
|
2011-12-31 06:46:13 +00:00
|
|
|
$('#discoverContentDiv').empty();
|
|
|
|
$('.tooltip').remove();
|
2012-05-04 00:54:58 +00:00
|
|
|
var showDiv = $('<div style="min-height:360px" id="discoverShow"><h2>'
|
|
|
|
+ steps[currentStep] + '</h2>');
|
2011-12-31 06:46:13 +00:00
|
|
|
$('#discoverContentDiv').append(showDiv);
|
2012-07-24 12:17:04 +00:00
|
|
|
|
|
|
|
//the discover button, use lsslp
|
|
|
|
var discoverButton = createButton('Discovery by lsslp');
|
|
|
|
discoverButton.bind('click', function(){
|
|
|
|
$('#discoverShow').empty();
|
|
|
|
$('#discoverContentDiv button').remove();
|
|
|
|
$('#discoverShow').append(createStatusBar('framedisc'));
|
|
|
|
$('#discoverShow').append('<center><table><tr><td id="frameTd">'
|
|
|
|
+ '</td><td style="width:20px"></td><td id="mtmsTd"></td></tr></table></center>');
|
|
|
|
discoverFrame();
|
|
|
|
});
|
|
|
|
$('#discoverShow').append(discoverButton);
|
|
|
|
|
|
|
|
//the import button, use mtms map file
|
|
|
|
var importButton = createButton('Import the mtms map file');
|
|
|
|
importButton.bind('click', function(){
|
|
|
|
$('#discoverShow').empty();
|
|
|
|
$('#discoverContentDiv button').remove();
|
|
|
|
$('#discoverShow').append(createStatusBar('framedisc'));
|
|
|
|
$('#framedisc div').html('Use the mtms map file with the format <framename> <mtm> <serial>(frame1 78AC-100 9920032).');
|
|
|
|
$('#discoverShow').append('<center><form action="lib/upload.php" method="post" enctype="multipart/form-data">MTMS map file:'
|
|
|
|
+ '<input type="file" name="file"></form></center>');
|
|
|
|
$('#discoverShow form').append(createButton('Parse'));
|
|
|
|
$('#discoverShow form').ajaxForm({
|
|
|
|
success : parseMtmsMap
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$('#discoverShow').append(importButton);
|
|
|
|
|
2012-05-04 00:54:58 +00:00
|
|
|
if (getDiscoverEnv('framemtmsmap')) {
|
2012-01-17 06:17:25 +00:00
|
|
|
var mapArray = getDiscoverEnv('framemtmsmap').split(';');
|
2012-05-04 00:54:58 +00:00
|
|
|
for (var i in mapArray) {
|
2011-12-31 06:46:13 +00:00
|
|
|
var tempArray = mapArray[i].split(',');
|
2012-07-24 12:17:04 +00:00
|
|
|
showMap(tempArray[0], tempArray[1], 0);
|
2011-12-31 06:46:13 +00:00
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
createDiscoverButtons();
|
|
|
|
return;
|
|
|
|
}
|
2012-07-24 12:17:04 +00:00
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2012-07-24 12:17:04 +00:00
|
|
|
function discoverFrame(){
|
|
|
|
$('#framedisc div').append('Discovering all Frames by lsslp.').append(createLoader());
|
2011-12-31 06:46:13 +00:00
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
url : 'lib/cmd.php',
|
|
|
|
dataType : 'json',
|
|
|
|
data : {
|
|
|
|
cmd : 'webrun',
|
|
|
|
tgt : '',
|
|
|
|
args : 'discover;frame',
|
|
|
|
msg : ''
|
|
|
|
},
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
success : function(data) {
|
2011-12-31 06:46:13 +00:00
|
|
|
var tempInfo = data.rsp[0];
|
2012-05-04 00:54:58 +00:00
|
|
|
if (-1 != tempInfo.indexOf('Error')) {
|
2011-12-31 06:46:13 +00:00
|
|
|
$('#framedisc div').html(tempInfo);
|
|
|
|
createDiscoverButtons();
|
|
|
|
return;
|
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
var mtmsArray = tempInfo.split(';');
|
|
|
|
var frameArray = expandNR(getDiscoverEnv('frameName'));
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
// Check the defined number and discovered number
|
|
|
|
if (mtmsArray.length != frameArray.length) {
|
|
|
|
$('#framedisc div').html(
|
|
|
|
'Error: Definded Number is ' + frameArray.length
|
|
|
|
+ ', but lsslp discovered Number is '
|
|
|
|
+ mtmsArray.length
|
|
|
|
+ ', please check your configure!');
|
2011-12-31 06:46:13 +00:00
|
|
|
createDiscoverButtons();
|
|
|
|
return;
|
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
$('#framedisc div').html(
|
|
|
|
'Mapping the frame name and mtms which discovered by lsslp.<br\>'
|
|
|
|
+ 'Select the frame name, then select the mtms.');
|
|
|
|
|
|
|
|
for (var i in frameArray) {
|
|
|
|
$('#frameTd').append(
|
|
|
|
'<p><input name="frameradio" type="radio" onclick="createMap(this)"><span>'
|
|
|
|
+ frameArray[i] + '</span></p>');
|
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
for (var i in mtmsArray) {
|
|
|
|
$('#mtmsTd').append(
|
|
|
|
'<p><input name="mtmsradio" type="radio" onclick="createMap(this)"><span>'
|
|
|
|
+ mtmsArray[i] + '</span></p>');
|
2011-12-31 06:46:13 +00:00
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
createDiscoverButtons();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2012-07-24 12:17:04 +00:00
|
|
|
function parseMtmsMap(responseText){
|
|
|
|
var frameArray = expandNR(getDiscoverEnv('frameName'));
|
|
|
|
var lines = responseText.split("\n");
|
|
|
|
var temphash = new Object();
|
|
|
|
var nulldefine = '';
|
|
|
|
|
|
|
|
for(var i in lines){
|
|
|
|
var temparray = lines[i].split(" ");
|
|
|
|
var tempname = temparray[0];
|
|
|
|
var tempmtm = temparray[1];
|
|
|
|
var tempserial = temparray[2];
|
|
|
|
temphash[tempname] = tempmtm + '-' + tempserial;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (var i in frameArray){
|
|
|
|
var tempname = frameArray[i];
|
|
|
|
if (!temphash[tempname]){
|
|
|
|
if (!nulldefine){
|
|
|
|
nulldefine += 'tempname';
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
nulldefine += ', tempname';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (nulldefine){
|
|
|
|
$('#framedisc div').html(
|
|
|
|
'Error: ' + nulldefine + ' was not defined in the map file, please check!');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
for (var i in temphash){
|
|
|
|
showMap(i, temphash[i], 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
createDiscoverButtons();
|
|
|
|
}
|
|
|
|
|
2012-05-04 00:54:58 +00:00
|
|
|
function createMap(obj) {
|
2011-12-31 06:46:13 +00:00
|
|
|
var fname = '';
|
|
|
|
var mname = '';
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
if ($('#discoverShow :checked').size() < 2) {
|
2011-12-31 06:46:13 +00:00
|
|
|
return;
|
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
if ('frameradio' == $(obj).attr('name')) {
|
2011-12-31 06:46:13 +00:00
|
|
|
fname = $(obj).next().html();
|
|
|
|
mname = $('#discoverShow input[name=mtmsradio]:checked').next().html();
|
2012-05-04 00:54:58 +00:00
|
|
|
} else {
|
2011-12-31 06:46:13 +00:00
|
|
|
fname = $('#discoverShow input[name=frameradio]:checked').next().html();
|
|
|
|
mname = $(obj).next().html();
|
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
$('#discoverShow :checked').parent().remove();
|
2012-07-24 12:17:04 +00:00
|
|
|
showMap(fname, mname, 1);
|
2011-12-31 06:46:13 +00:00
|
|
|
}
|
|
|
|
|
2012-07-24 12:17:04 +00:00
|
|
|
function showMap(fname, mname, deleteflag) {
|
2011-12-31 06:46:13 +00:00
|
|
|
var rowClass = '';
|
2012-07-24 12:17:04 +00:00
|
|
|
var deleteicon = '';
|
2012-05-04 00:54:58 +00:00
|
|
|
if ($('#discoverShow fieldset').size() < 1) {
|
|
|
|
$('#discoverShow')
|
|
|
|
.append(
|
|
|
|
'<fieldset><legend>Frame and MTMS map</legend><center><table></table></center></fieldset>');
|
2011-12-31 06:46:13 +00:00
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
if (0 == $('#discoverShow fieldset tr').size() % 2) {
|
2011-12-31 06:46:13 +00:00
|
|
|
rowClass = 'odd';
|
2012-05-04 00:54:58 +00:00
|
|
|
} else {
|
2011-12-31 06:46:13 +00:00
|
|
|
rowClass = 'even';
|
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2012-07-24 12:17:04 +00:00
|
|
|
if (deleteflag){
|
|
|
|
deleteicon = '<td><span class="ui-icon ui-icon-trash" style="cursor:pointer;" onclick="deleteMap(this)"></span></td>';
|
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
$('#discoverShow fieldset table')
|
|
|
|
.append(
|
|
|
|
'<tr class="'
|
|
|
|
+ rowClass
|
|
|
|
+ '"><td>'
|
|
|
|
+ fname
|
|
|
|
+ '</td><td width="20px"><----></td><td>'
|
|
|
|
+ mname
|
2012-07-24 12:17:04 +00:00
|
|
|
+ '</td>' + deleteicon + '</tr>');
|
2011-12-31 06:46:13 +00:00
|
|
|
}
|
|
|
|
|
2012-05-04 00:54:58 +00:00
|
|
|
function deleteMap(obj) {
|
2011-12-31 06:46:13 +00:00
|
|
|
var mname = $(obj).parent().prev().html();
|
|
|
|
var fname = $(obj).parent().prev().prev().prev().html();
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
$(obj).parent().parent().remove();
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
$('#frameTd').append(
|
|
|
|
'<p><input name="frameradio" type="radio" onclick="createMap(this)"><span>'
|
|
|
|
+ fname + '</span></p>');
|
|
|
|
$('#mtmsTd').append(
|
|
|
|
'<p><input name="mtmsradio" type="radio" onclick="createMap(this)"><span>'
|
|
|
|
+ mname + '</span></p>');
|
2011-12-31 06:46:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-05-04 00:54:58 +00:00
|
|
|
* Step 6: Write the frame and MTMs map file
|
2011-12-31 06:46:13 +00:00
|
|
|
*/
|
2012-05-04 00:54:58 +00:00
|
|
|
function checkFrameMtms(operType) {
|
|
|
|
// Check the number of radio button
|
2011-12-31 06:46:13 +00:00
|
|
|
var vpdFileCon = '';
|
|
|
|
$('#discoverShow .ui-state-error').remove();
|
2012-05-04 00:54:58 +00:00
|
|
|
if (0 < $('#discoverShow :radio').size()) {
|
2011-12-31 06:46:13 +00:00
|
|
|
var warnBar = createWarnBar('Map all of the frame with mtms.');
|
|
|
|
$('#discoverContentDiv #discoverShow').prepend(warnBar);
|
|
|
|
return false;
|
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
// Find out all maps
|
2011-12-31 06:46:13 +00:00
|
|
|
var maps = '';
|
2012-05-04 00:54:58 +00:00
|
|
|
$('#discoverShow fieldset tr').each(
|
|
|
|
function() {
|
|
|
|
var fname = $(this).children().eq(0).html();
|
|
|
|
var mtms = $(this).children().eq(2).html();
|
|
|
|
var pos = mtms.lastIndexOf('-');
|
|
|
|
var startpos = mtms.indexOf(':');
|
|
|
|
|
|
|
|
maps += (fname + ',' + mtms + ';');
|
|
|
|
vpdFileCon += fname + ':\n';
|
|
|
|
vpdFileCon += ' objtype=node\n serial='
|
|
|
|
+ mtms.substring(pos + 1) + '\n';
|
|
|
|
vpdFileCon += ' mtm=' + mtms.substring(startpos + 1, pos)
|
|
|
|
+ '\n side=A\n';
|
|
|
|
});
|
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
maps = maps.substr(0, maps.length - 1);
|
|
|
|
setDiscoverEnv('framemtmsmap', maps);
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
if ('back' == operType) {
|
2011-12-31 06:46:13 +00:00
|
|
|
return true;
|
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
// Write the maps into vpd table
|
2011-12-31 06:46:13 +00:00
|
|
|
$.ajax({
|
|
|
|
url : 'lib/cmd.php',
|
|
|
|
dataType : 'json',
|
|
|
|
data : {
|
|
|
|
cmd : 'webrun',
|
|
|
|
tgt : '',
|
|
|
|
args : 'writeconfigfile;/tmp/webvpd.stanza;' + vpdFileCon,
|
|
|
|
msg : ''
|
|
|
|
}
|
|
|
|
});
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-05-04 00:54:58 +00:00
|
|
|
* Step 7: Create the xcatsetup configure file and run xcatsetup to define all
|
|
|
|
* objects in xcat database.
|
2011-12-31 06:46:13 +00:00
|
|
|
*/
|
2012-05-04 00:54:58 +00:00
|
|
|
function powerInitConfig(operType) {
|
2011-12-31 06:46:13 +00:00
|
|
|
$('#discoverContentDiv').empty();
|
|
|
|
$('.tooltip').remove();
|
2012-05-04 00:54:58 +00:00
|
|
|
var showStr = '<div style="min-height:360px"><h2>' + steps[currentStep]
|
|
|
|
+ '<br/><br/></h2>';
|
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
var iconClass = '';
|
2012-05-04 00:54:58 +00:00
|
|
|
if ('back' == operType) {
|
2011-12-31 06:46:13 +00:00
|
|
|
iconClass = 'ui-icon-check';
|
2012-05-04 00:54:58 +00:00
|
|
|
} else {
|
2011-12-31 06:46:13 +00:00
|
|
|
iconClass = 'ui-icon-gear';
|
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
showStr += '<ul>';
|
2012-05-04 00:54:58 +00:00
|
|
|
showStr += '<li id="fileLine"><span class="ui-icon ' + iconClass
|
|
|
|
+ '"></span>Create configure file for xcatsetup.</li>';
|
|
|
|
showStr += '<li id="setupLine"><span class="ui-icon ' + iconClass
|
|
|
|
+ '"></span>Wrote Objects into xCAT database by xcatsetup.</li>';
|
2011-12-31 06:46:13 +00:00
|
|
|
showStr += '</ul></div>';
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
$('#discoverContentDiv').append(showStr);
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
if ('back' == operType) {
|
2011-12-31 06:46:13 +00:00
|
|
|
createDiscoverButtons();
|
|
|
|
return;
|
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
createSetupFile();
|
|
|
|
}
|
|
|
|
/**
|
2012-05-04 00:54:58 +00:00
|
|
|
* Step 7: Create the xcat configure file
|
2011-12-31 06:46:13 +00:00
|
|
|
*/
|
2012-05-04 00:54:58 +00:00
|
|
|
function createSetupFile() {
|
2011-12-31 06:46:13 +00:00
|
|
|
var fileContent = '';
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
$('#fileLine').append(createLoader());
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
// Site info
|
2011-12-31 06:46:13 +00:00
|
|
|
fileContent += 'xcat-site:\n';
|
|
|
|
fileContent += ' domain = ' + getDiscoverEnv('domainname') + '\n';
|
2012-05-04 00:54:58 +00:00
|
|
|
if (getDiscoverEnv('hmcFlag')) {
|
|
|
|
// Do nothing
|
|
|
|
} else {
|
2011-12-31 06:46:13 +00:00
|
|
|
fileContent += ' use-direct-fsp-control = 1\n';
|
|
|
|
}
|
2012-06-15 09:38:48 +00:00
|
|
|
fileContent += ' topology = 8D \n';
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
// DHCP IP range
|
2011-12-31 06:46:13 +00:00
|
|
|
fileContent += 'xcat-service-lan:\n';
|
2012-05-04 00:54:58 +00:00
|
|
|
fileContent += ' dhcp-dynamic-range = ' + getDiscoverEnv('ipStart') + '-'
|
|
|
|
+ getDiscoverEnv('ipEnd') + '\n';
|
|
|
|
|
|
|
|
// HMC
|
|
|
|
if (getDiscoverEnv('hmcName')) {
|
2011-12-31 06:46:13 +00:00
|
|
|
fileContent += 'xcat-hmcs:\n';
|
|
|
|
fileContent += ' hostname-range = ' + getDiscoverEnv('hmcName') + '\n';
|
2012-06-15 09:38:48 +00:00
|
|
|
fileContent += ' starting-ip = ' + getDiscoverEnv('hmcstartip') + '\n';
|
2011-12-31 06:46:13 +00:00
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
// Frame
|
2011-12-31 06:46:13 +00:00
|
|
|
fileContent += 'xcat-frames:\n';
|
|
|
|
fileContent += ' hostname-range = ' + getDiscoverEnv('frameName') + '\n';
|
2012-05-04 00:54:58 +00:00
|
|
|
fileContent += ' num-frames-per-hmc = ' + getDiscoverEnv('frameNumPerHmc')
|
|
|
|
+ '\n';
|
2011-12-31 06:46:13 +00:00
|
|
|
fileContent += ' vpd-file = /tmp/webvpd.stanza\n';
|
2012-06-15 09:38:48 +00:00
|
|
|
fileContent += ' vlan-1 = ' + getDiscoverEnv('vlan1ip') + '\n';
|
|
|
|
fileContent += ' vlan-2 = ' + getDiscoverEnv('vlan2ip') + '\n';
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
// CEC
|
2011-12-31 06:46:13 +00:00
|
|
|
fileContent += 'xcat-cecs:\n';
|
|
|
|
fileContent += ' hostname-range = ' + getDiscoverEnv('cecName') + '\n';
|
|
|
|
fileContent += ' delete-unused-cecs = 1\n';
|
|
|
|
fileContent += ' supernode-list = /tmp/websupernode.txt\n';
|
2012-06-15 09:38:48 +00:00
|
|
|
|
|
|
|
//Building Block
|
|
|
|
fileContent += 'xcat-building-blocks:\n';
|
|
|
|
fileContent += ' num-frames-per-bb = ' + getDiscoverEnv('framepbb') + '\n';
|
|
|
|
fileContent += ' num-cecs-per-bb = ' + getDiscoverEnv('cecpbb') + '\n';
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
// LPAR
|
2011-12-31 06:46:13 +00:00
|
|
|
fileContent += 'xcat-lpars:\n';
|
2012-05-04 00:54:58 +00:00
|
|
|
fileContent += ' num-lpars-per-cec = ' + getDiscoverEnv('lparNumPerCec')
|
|
|
|
+ '\n';
|
2011-12-31 06:46:13 +00:00
|
|
|
fileContent += ' hostname-range = ' + getDiscoverEnv('lparName') + '\n';
|
2012-06-15 09:38:48 +00:00
|
|
|
fileContent += ' starting-ip = ' + getDiscoverEnv('lparstartip') + '\n';
|
2012-07-23 10:13:30 +00:00
|
|
|
fileContent += ' aliases = -hf0 \n';
|
|
|
|
fileContent += ' otherinterfaces = -hf1:11.1.3.1,-hf2:12.1.3.1,-hf3:13.1.3.1,-hf4:14.1.3.1,-hf5:15.1.3.1,,-hf6:16.1.3.1,-hf7:17.1.3.1,-bond0:18.1.3.1 \n';
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
$.ajax({
|
|
|
|
url : 'lib/cmd.php',
|
|
|
|
dataType : 'json',
|
|
|
|
data : {
|
|
|
|
cmd : 'webrun',
|
|
|
|
tgt : '',
|
|
|
|
args : 'writeconfigfile;/tmp/webxcat.conf;' + fileContent,
|
|
|
|
msg : ''
|
|
|
|
},
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
success : function() {
|
2011-12-31 06:46:13 +00:00
|
|
|
$('#fileLine img').remove();
|
|
|
|
var tempSpan = $('#fileLine').find('span');
|
|
|
|
tempSpan.removeClass('ui-icon-gear');
|
|
|
|
tempSpan.addClass('ui-icon-check');
|
|
|
|
runSetup();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-05-04 00:54:58 +00:00
|
|
|
* Step 7: Run the xcatsetup command
|
2011-12-31 06:46:13 +00:00
|
|
|
*/
|
2012-05-04 00:54:58 +00:00
|
|
|
function runSetup() {
|
2011-12-31 06:46:13 +00:00
|
|
|
$('#setupLine').append(createLoader());
|
|
|
|
$.ajax({
|
|
|
|
url : 'lib/cmd.php',
|
|
|
|
dataType : 'json',
|
|
|
|
data : {
|
|
|
|
cmd : 'xcatsetup',
|
|
|
|
tgt : '',
|
|
|
|
args : '/tmp/webxcat.conf',
|
|
|
|
msg : ''
|
|
|
|
},
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
success : function() {
|
2011-12-31 06:46:13 +00:00
|
|
|
$('#setupLine img').remove();
|
|
|
|
var tempSpan = $('#setupLine').find('span');
|
|
|
|
tempSpan.removeClass('ui-icon-gear');
|
|
|
|
tempSpan.addClass('ui-icon-check');
|
|
|
|
createDiscoverButtons();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-05-04 00:54:58 +00:00
|
|
|
* Step 8: Discover all HMC and CEC in the cluster and update into xCAT database
|
2011-12-31 06:46:13 +00:00
|
|
|
*/
|
2012-05-04 00:54:58 +00:00
|
|
|
function powerInitUpdateDefinition(operType) {
|
2011-12-31 06:46:13 +00:00
|
|
|
$('#discoverContentDiv').empty();
|
|
|
|
$('.tooltip').remove();
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2012-01-13 07:09:35 +00:00
|
|
|
var iconClass = '';
|
2012-05-04 00:54:58 +00:00
|
|
|
if ('back' == operType) {
|
2012-01-13 07:09:35 +00:00
|
|
|
iconClass = 'ui-icon-check';
|
2012-05-04 00:54:58 +00:00
|
|
|
} else {
|
2012-01-13 07:09:35 +00:00
|
|
|
iconClass = 'ui-icon-gear';
|
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2012-07-27 04:54:26 +00:00
|
|
|
var showStr = '<div style="min-height:360px"><h2>' + steps[currentStep] + '</h2>';
|
|
|
|
showStr += '<div id="outputinfo"></div><ul>';
|
2012-07-05 06:59:38 +00:00
|
|
|
|
2012-05-04 00:54:58 +00:00
|
|
|
showStr += '<li id="hmcLine1"><span class="ui-icon ' + iconClass
|
|
|
|
+ '"></span>Discover HMCs.</li>';
|
|
|
|
showStr += '<li id="hmcLine2"><span class="ui-icon ' + iconClass
|
|
|
|
+ '"></span>Update HMCs into xCAT database.</li>';
|
2012-07-05 06:59:38 +00:00
|
|
|
showStr += '<li id="frameLine1"><span class="ui-icon ' + iconClass
|
|
|
|
+ '"></span>Update Frames into xCAT database.</li>';
|
2012-05-04 00:54:58 +00:00
|
|
|
showStr += '<li id="frameLine2"><span class="ui-icon ' + iconClass
|
2012-07-23 10:13:30 +00:00
|
|
|
+ '"></span>Set up Frame DHCP, DNS.</li>';
|
|
|
|
showStr += '<li id="frameLine3"><span class="ui-icon ' + iconClass
|
|
|
|
+ '"></span>Resetting networks on FRAME to get persistent IP.</li>';
|
|
|
|
showStr += '<li id="frameLine4"><span class="ui-icon ' + iconClass
|
|
|
|
+ '"></span>Creating hardware connection for FRAME.</li>';
|
2012-05-04 00:54:58 +00:00
|
|
|
showStr += '<li id="cecLine"><span class="ui-icon ' + iconClass
|
|
|
|
+ '"></span>Discover CECs and update into xCAT database.</li>';
|
|
|
|
showStr += '<li id="cecLine2"><span class="ui-icon ' + iconClass
|
2012-07-23 10:13:30 +00:00
|
|
|
+ '"></span>Set up CEC DHCP, DNS.</li>';
|
|
|
|
showStr += '<li id="cecLine3"><span class="ui-icon ' + iconClass
|
|
|
|
+ '"></span>Resetting networks on CEC to get persistent IP.</li>';
|
|
|
|
showStr += '<li id="cecLine4"><span class="ui-icon ' + iconClass
|
|
|
|
+ '"></span>Creating hardware connection for CEC.</li>';
|
2011-12-31 06:46:13 +00:00
|
|
|
showStr += '</ul></div>';
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
$('#discoverContentDiv').append(showStr);
|
2012-07-27 04:54:26 +00:00
|
|
|
$('#discoverContentDiv #outputinfo').append(createStatusBar('returninfo'));
|
|
|
|
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
if ('back' == operType) {
|
2011-12-31 06:46:13 +00:00
|
|
|
createDiscoverButtons();
|
|
|
|
return;
|
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2012-07-05 06:59:38 +00:00
|
|
|
lsslpWriteHMC();
|
2011-12-31 06:46:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-05-04 00:54:58 +00:00
|
|
|
* Step 8: Write all the lsslp HMC info into database
|
2011-12-31 06:46:13 +00:00
|
|
|
*/
|
2012-05-04 00:54:58 +00:00
|
|
|
function lsslpWriteHMC() {
|
2011-12-31 06:46:13 +00:00
|
|
|
$('#hmcLine1').append(createLoader());
|
|
|
|
$.ajax({
|
|
|
|
url : 'lib/cmd.php',
|
|
|
|
dataType : 'json',
|
|
|
|
data : {
|
|
|
|
cmd : 'webrun',
|
|
|
|
tgt : '',
|
|
|
|
args : 'discover;hmc',
|
|
|
|
msg : ''
|
|
|
|
},
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
success : function(data) {
|
|
|
|
// modify the page elements
|
2011-12-31 06:46:13 +00:00
|
|
|
$('#hmcLine1 img').remove();
|
|
|
|
var tempSpan = $('#hmcLine1').find('span');
|
|
|
|
tempSpan.removeClass('ui-icon-gear');
|
|
|
|
tempSpan.addClass('ui-icon-check');
|
|
|
|
$('#hmcLine2').append(createLoader());
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
var hmcArray = expandNR(getDiscoverEnv('hmcName'));
|
|
|
|
var mtmsArray = data.rsp[0].split(';');
|
|
|
|
var tempPar = '';
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2012-07-05 06:59:38 +00:00
|
|
|
if (hmcArray.length > mtmsArray.length) {
|
2012-05-04 00:54:58 +00:00
|
|
|
// Error info
|
2011-12-31 06:46:13 +00:00
|
|
|
$('#hmcLine2 img').remove();
|
2012-05-04 00:54:58 +00:00
|
|
|
var warnBar = createWarnBar('Error: Defined ' + hmcArray.length
|
|
|
|
+ ' HMCs, but discovered ' + mtmsArray.length
|
|
|
|
+ ' HMCs. Please check the configuration.');
|
2011-12-31 06:46:13 +00:00
|
|
|
$('#discoverContentDiv div').prepend(warnBar);
|
|
|
|
createDiscoverButtons();
|
|
|
|
return;
|
|
|
|
}
|
2012-07-27 04:54:26 +00:00
|
|
|
else{
|
|
|
|
$('#returninfo div').append('<p>Discover ' + hmcArray.length + ' hmcs.</p>');
|
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
// Create the HMC and MTMs pair string
|
|
|
|
for (var i in hmcArray) {
|
2011-12-31 06:46:13 +00:00
|
|
|
var tPos = mtmsArray[i].lastIndexOf('-');
|
2012-05-04 00:54:58 +00:00
|
|
|
var startPos = mtmsArray[i].indexOf(':');
|
|
|
|
if ('' == tempPar) {
|
|
|
|
tempPar += hmcArray[i] + ','
|
|
|
|
+ mtmsArray[i].substring(startPos + 1, tPos) + ','
|
|
|
|
+ mtmsArray[i].substring(tPos + 1);
|
|
|
|
} else {
|
|
|
|
tempPar += ':' + hmcArray[i] + ','
|
|
|
|
+ mtmsArray[i].substring(startPos + 1, tPos) + ','
|
|
|
|
+ mtmsArray[i].substring(tPos + 1);
|
2011-12-31 06:46:13 +00:00
|
|
|
}
|
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
// Write MTMs and HMC name pair into vpd table
|
2011-12-31 06:46:13 +00:00
|
|
|
$.ajax({
|
|
|
|
url : 'lib/cmd.php',
|
|
|
|
dataType : 'json',
|
|
|
|
data : {
|
|
|
|
cmd : 'webrun',
|
|
|
|
tgt : '',
|
|
|
|
args : 'updatevpd;' + tempPar,
|
|
|
|
msg : ''
|
|
|
|
},
|
2012-05-04 00:54:58 +00:00
|
|
|
success : function() {
|
|
|
|
// Run lsslp and write all info into datatable
|
2011-12-31 06:46:13 +00:00
|
|
|
$.ajax({
|
|
|
|
url : 'lib/cmd.php',
|
|
|
|
dataType : 'json',
|
|
|
|
data : {
|
|
|
|
cmd : 'lsslp',
|
|
|
|
tgt : '',
|
|
|
|
args : '-s;HMC;-w',
|
|
|
|
msg : ''
|
|
|
|
},
|
2012-07-27 04:54:26 +00:00
|
|
|
success : function(data) {
|
2011-12-31 06:46:13 +00:00
|
|
|
$('#hmcLine2 img').remove();
|
|
|
|
var tempSpan = $('#hmcLine2').find('span');
|
|
|
|
tempSpan.removeClass('ui-icon-gear');
|
|
|
|
tempSpan.addClass('ui-icon-check');
|
2012-07-27 04:54:26 +00:00
|
|
|
$('#returninfo div').append('<p>Add the discovered hmc into xCAT Database.<br/>' + data.rsp[0] +'</p>');
|
2012-07-05 06:59:38 +00:00
|
|
|
lsslpWriteFrame();
|
2011-12-31 06:46:13 +00:00
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
});
|
2011-12-31 06:46:13 +00:00
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
});
|
2011-12-31 06:46:13 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2012-01-17 06:17:25 +00:00
|
|
|
/**
|
2012-07-05 06:59:38 +00:00
|
|
|
* Step 8: Write all lsslp frame info into the database
|
2012-01-17 06:17:25 +00:00
|
|
|
*/
|
2012-07-05 06:59:38 +00:00
|
|
|
function lsslpWriteFrame() {
|
|
|
|
$('#frameLine1').append(createLoader());
|
2012-05-04 00:54:58 +00:00
|
|
|
$.ajax({
|
|
|
|
url : 'lib/cmd.php',
|
2012-01-17 06:17:25 +00:00
|
|
|
dataType : 'json',
|
|
|
|
data : {
|
2012-07-05 06:59:38 +00:00
|
|
|
cmd : 'lsslp',
|
|
|
|
tgt : '',
|
|
|
|
args : '-s;FRAME;-w',
|
2012-01-17 06:17:25 +00:00
|
|
|
msg : ''
|
|
|
|
},
|
2012-07-05 06:59:38 +00:00
|
|
|
|
2012-07-27 04:54:26 +00:00
|
|
|
success : function(data) {
|
2012-07-05 06:59:38 +00:00
|
|
|
$('#frameLine1 img').remove();
|
|
|
|
var tempSpan = $('#frameLine1').find('span');
|
2012-01-17 06:17:25 +00:00
|
|
|
tempSpan.removeClass('ui-icon-gear');
|
|
|
|
tempSpan.addClass('ui-icon-check');
|
2012-07-27 04:54:26 +00:00
|
|
|
$('#returninfo div').append('<p>Write the discovered FRAMES into xCAT Database.<br/><pre>' + data.rsp.join("\n") + '</pre></p>');
|
2012-07-05 06:59:38 +00:00
|
|
|
frameSetup();
|
2012-01-17 06:17:25 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
/**
|
2012-07-23 10:13:30 +00:00
|
|
|
* Step 8: config the frame dhcp and dns
|
2011-12-31 06:46:13 +00:00
|
|
|
*/
|
2012-07-05 06:59:38 +00:00
|
|
|
function frameSetup() {
|
|
|
|
$('#frameLine2').append(createLoader());
|
|
|
|
var tempargs = getDiscoverEnv('adminpasswd') + ';' + getDiscoverEnv('generalpasswd') + ';'
|
|
|
|
+ getDiscoverEnv('hmcpasswd');
|
2011-12-31 06:46:13 +00:00
|
|
|
$.ajax({
|
|
|
|
url : 'lib/cmd.php',
|
|
|
|
dataType : 'json',
|
|
|
|
data : {
|
2012-07-05 06:59:38 +00:00
|
|
|
cmd : 'webrun',
|
2011-12-31 06:46:13 +00:00
|
|
|
tgt : '',
|
2012-07-23 10:13:30 +00:00
|
|
|
args : 'framesetup;' + tempargs + ';1',
|
2011-12-31 06:46:13 +00:00
|
|
|
msg : ''
|
|
|
|
},
|
2012-07-23 10:13:30 +00:00
|
|
|
|
2012-07-27 04:54:26 +00:00
|
|
|
success : function(data) {
|
2012-07-05 06:59:38 +00:00
|
|
|
$('#frameLine2 img').remove();
|
|
|
|
var tempSpan = $('#frameLine2').find('span');
|
2011-12-31 06:46:13 +00:00
|
|
|
tempSpan.removeClass('ui-icon-gear');
|
|
|
|
tempSpan.addClass('ui-icon-check');
|
2012-07-27 04:54:26 +00:00
|
|
|
$('#returninfo div').append('<p><pre>' + data.rsp.join("\n") + '</pre></p>');
|
2012-07-23 10:13:30 +00:00
|
|
|
frameReset();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Step 8: reset the networks for frames
|
|
|
|
*/
|
|
|
|
function frameReset(){
|
|
|
|
$('#frameLine3').append(createLoader());
|
|
|
|
$.ajax({
|
|
|
|
url : 'lib/cmd.php',
|
|
|
|
dataType : 'json',
|
|
|
|
data : {
|
|
|
|
cmd : 'rspconfig',
|
|
|
|
tgt : 'frame',
|
|
|
|
args : '--resetnet',
|
|
|
|
msg : ''
|
|
|
|
},
|
|
|
|
|
2012-07-27 04:54:26 +00:00
|
|
|
success : function(data) {
|
2012-07-23 10:13:30 +00:00
|
|
|
$('#frameLine3 img').remove();
|
|
|
|
var tempSpan = $('#frameLine3').find('span');
|
|
|
|
tempSpan.removeClass('ui-icon-gear');
|
|
|
|
tempSpan.addClass('ui-icon-check');
|
2012-07-27 04:54:26 +00:00
|
|
|
$('#returninfo div').append('<p>Reset network on FRAMES to get persistent IP.<br/><pre>' + data.rsp.join("\n") + '</pre></p>');
|
2012-07-23 10:13:30 +00:00
|
|
|
frameHwconn();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Step 8: create hardware connection for frames
|
|
|
|
*/
|
|
|
|
function frameHwconn(){
|
|
|
|
$('#frameLine4').append(createLoader());
|
|
|
|
var tempargs = getDiscoverEnv('adminpasswd') + ';' + getDiscoverEnv('generalpasswd') + ';'
|
|
|
|
+ getDiscoverEnv('hmcpasswd');
|
|
|
|
$.ajax({
|
|
|
|
url : 'lib/cmd.php',
|
|
|
|
dataType : 'json',
|
|
|
|
data : {
|
|
|
|
cmd : 'webrun',
|
|
|
|
tgt : '',
|
|
|
|
args : 'framesetup;' + tempargs + ';2',
|
|
|
|
msg : ''
|
|
|
|
},
|
|
|
|
|
2012-07-27 04:54:26 +00:00
|
|
|
success : function(data) {
|
2012-07-23 10:13:30 +00:00
|
|
|
$('#frameLine4 img').remove();
|
|
|
|
var tempSpan = $('#frameLine4').find('span');
|
|
|
|
tempSpan.removeClass('ui-icon-gear');
|
|
|
|
tempSpan.addClass('ui-icon-check');
|
2012-07-27 04:54:26 +00:00
|
|
|
$('#returninfo div').append('<p><pre>' + data.rsp.join("\n") + '</p>');
|
2012-07-05 06:59:38 +00:00
|
|
|
lsslpWriteCec();
|
2012-01-17 06:17:25 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-07-05 06:59:38 +00:00
|
|
|
* Step 8: Write all the lsslp cec info into database
|
2012-01-17 06:17:25 +00:00
|
|
|
*/
|
2012-07-05 06:59:38 +00:00
|
|
|
function lsslpWriteCec() {
|
|
|
|
$('#cecLine').append(createLoader());
|
2012-01-17 06:17:25 +00:00
|
|
|
$.ajax({
|
|
|
|
url : 'lib/cmd.php',
|
|
|
|
dataType : 'json',
|
|
|
|
data : {
|
2012-07-05 06:59:38 +00:00
|
|
|
cmd : 'lsslp',
|
|
|
|
tgt : '',
|
|
|
|
args : '-s;CEC;-w',
|
2012-01-17 06:17:25 +00:00
|
|
|
msg : ''
|
|
|
|
},
|
2012-07-27 04:54:26 +00:00
|
|
|
success : function(data) {
|
2012-07-05 06:59:38 +00:00
|
|
|
$('#cecLine img').remove();
|
|
|
|
var tempSpan = $('#cecLine').find('span');
|
2012-01-17 06:17:25 +00:00
|
|
|
tempSpan.removeClass('ui-icon-gear');
|
|
|
|
tempSpan.addClass('ui-icon-check');
|
2012-07-27 04:54:26 +00:00
|
|
|
$('#returninfo div').append('<p>Discover and write CECs into xCAT Database.<br/><pre>' + data.rsp.join("\n") + '</pre></p>');
|
2012-07-05 06:59:38 +00:00
|
|
|
cecsetup();
|
2012-01-13 07:09:35 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-07-23 10:13:30 +00:00
|
|
|
* Step 8: config the cec dhcp and dns
|
2012-01-13 07:09:35 +00:00
|
|
|
*/
|
2012-07-05 06:59:38 +00:00
|
|
|
function cecsetup(){
|
|
|
|
$('#cecLine2').append(createLoader());
|
|
|
|
var tempargs = getDiscoverEnv('adminpasswd') + ';' + getDiscoverEnv('generalpasswd') + ';'
|
|
|
|
+ getDiscoverEnv('hmcpasswd');
|
2012-01-13 07:09:35 +00:00
|
|
|
$.ajax({
|
|
|
|
url : 'lib/cmd.php',
|
|
|
|
dataType : 'json',
|
|
|
|
data : {
|
2012-07-05 06:59:38 +00:00
|
|
|
cmd : 'webrun',
|
2012-01-13 07:09:35 +00:00
|
|
|
tgt : '',
|
2012-07-23 10:13:30 +00:00
|
|
|
args : 'cecsetup;' + tempargs + ';1',
|
2012-01-13 07:09:35 +00:00
|
|
|
msg : ''
|
|
|
|
},
|
2012-07-27 04:54:26 +00:00
|
|
|
success : function(data) {
|
2012-07-05 06:59:38 +00:00
|
|
|
$('#cecLine2 img').remove();
|
|
|
|
var tempSpan = $('#cecLine2').find('span');
|
2012-01-13 07:09:35 +00:00
|
|
|
tempSpan.removeClass('ui-icon-gear');
|
|
|
|
tempSpan.addClass('ui-icon-check');
|
2012-07-27 04:54:26 +00:00
|
|
|
$('#returninfo div').append('<p><pre>' + data.rsp.join("\n") + '</pre></p>');
|
2012-07-23 10:13:30 +00:00
|
|
|
cecReset();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Step 8: reset the networks for cecs
|
|
|
|
*/
|
|
|
|
function cecReset(){
|
|
|
|
$('#cecLine3').append(createLoader());
|
|
|
|
$.ajax({
|
|
|
|
url : 'lib/cmd.php',
|
|
|
|
dataType : 'json',
|
|
|
|
data : {
|
|
|
|
cmd : 'rspconfig',
|
|
|
|
tgt : 'cec',
|
|
|
|
args : '--resetnet',
|
|
|
|
msg : ''
|
|
|
|
},
|
|
|
|
|
2012-07-27 04:54:26 +00:00
|
|
|
success : function(data) {
|
2012-07-23 10:13:30 +00:00
|
|
|
$('#cecLine3 img').remove();
|
|
|
|
var tempSpan = $('#cecLine3').find('span');
|
|
|
|
tempSpan.removeClass('ui-icon-gear');
|
|
|
|
tempSpan.addClass('ui-icon-check');
|
2012-07-27 04:54:26 +00:00
|
|
|
$('#returninfo div').append('<p>Reset network on CECs to get persistent IP.<br/><pre>' + data.rsp.join("\n") + '</pre></p>');
|
2012-07-23 10:13:30 +00:00
|
|
|
cecHwconn();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Step 8: config the cec
|
|
|
|
*/
|
|
|
|
function cecHwconn(){
|
|
|
|
$('#cecLine4').append(createLoader());
|
|
|
|
var tempargs = getDiscoverEnv('adminpasswd') + ';' + getDiscoverEnv('generalpasswd') + ';'
|
|
|
|
+ getDiscoverEnv('hmcpasswd');
|
|
|
|
$.ajax({
|
|
|
|
url : 'lib/cmd.php',
|
|
|
|
dataType : 'json',
|
|
|
|
data : {
|
|
|
|
cmd : 'webrun',
|
|
|
|
tgt : '',
|
|
|
|
args : 'cecsetup;' + tempargs + ';2',
|
|
|
|
msg : ''
|
|
|
|
},
|
2012-07-27 04:54:26 +00:00
|
|
|
success : function(data) {
|
2012-07-23 10:13:30 +00:00
|
|
|
$('#cecLine4 img').remove();
|
|
|
|
var tempSpan = $('#cecLine4').find('span');
|
|
|
|
tempSpan.removeClass('ui-icon-gear');
|
|
|
|
tempSpan.addClass('ui-icon-check');
|
2012-07-27 04:54:26 +00:00
|
|
|
$('#returninfo div').append('<p><pre>' + data.rsp.join("\n") + '</pre></p>');
|
2011-12-31 06:46:13 +00:00
|
|
|
createDiscoverButtons();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-05-04 00:54:58 +00:00
|
|
|
* Step 9: Create LPARs
|
2011-12-31 06:46:13 +00:00
|
|
|
*/
|
2012-05-04 00:54:58 +00:00
|
|
|
function powerInitCreateLpar() {
|
2011-12-31 06:46:13 +00:00
|
|
|
$('#discoverContentDiv').empty();
|
|
|
|
$('.tooltip').remove();
|
2012-05-04 00:54:58 +00:00
|
|
|
var showDiv = $('<div style="min-height:360px" id="createlparDiv"><h2>'
|
|
|
|
+ steps[currentStep] + '</h2>');
|
|
|
|
switch (getDiscoverEnv('machineType')) {
|
|
|
|
case 'ih':
|
2011-12-31 06:46:13 +00:00
|
|
|
ihCreateLpar(showDiv);
|
2012-05-04 00:54:58 +00:00
|
|
|
break;
|
|
|
|
case 'nonih':
|
2011-12-31 06:46:13 +00:00
|
|
|
nonihCreateLpar(showDiv);
|
2012-05-04 00:54:58 +00:00
|
|
|
break;
|
2011-12-31 06:46:13 +00:00
|
|
|
default:
|
2012-05-04 00:54:58 +00:00
|
|
|
break;
|
2011-12-31 06:46:13 +00:00
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
$('#discoverContentDiv').append(showDiv);
|
|
|
|
createDiscoverButtons();
|
|
|
|
}
|
|
|
|
|
2012-05-04 00:54:58 +00:00
|
|
|
function ihCreateLpar(parentDiv) {
|
|
|
|
var showStr = 'Partition Rule:<br/>'
|
|
|
|
+ 'If all the octants configuration value are same in one CEC, it will be " -r 0-7:value".<br/>'
|
|
|
|
+ 'If the octants use the different configuration value in one cec, it will be "-r 0:value1,1:value2,...7:value7", or "-r 0:value1,1-7:value2".<br/>'
|
|
|
|
+ 'The octants configuration value for one Octant could be 1, 2, 3, 4, 5 . The meanings of the octants configuration value are as following:<br/>'
|
|
|
|
+ '1 - 1 partition with all cpus and memory of the octant<br/>'
|
|
|
|
+ '2 - 2 partitions with a 50/50 split of cpus and memory<br/>'
|
|
|
|
+ '3 - 3 partitions with a 25/25/50 split of cpus and memory<br/>'
|
|
|
|
+ '4 - 4 partitions with a 25/25/25/25 split of cpus and memory<br/>'
|
|
|
|
+ '5 - 2 partitions with a 25/75 split of cpus and memory<br/>'
|
|
|
|
+ 'Define the configuration rule for one CEC, and create all Lpars on all CECs by this rule. Or ignore this step.';
|
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
parentDiv.append(createInfoBar(showStr));
|
2012-05-04 00:54:58 +00:00
|
|
|
parentDiv.append('<div><center><table><tr><td>Partition Configuration:</td>'
|
|
|
|
+ '<td><input name="partconf" type="text" value="'
|
|
|
|
+ getDiscoverEnv('partconf')
|
|
|
|
+ '"></td><td></td></tr></table></center></div>');
|
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
var lparButton = createButton('Create Lpars');
|
|
|
|
parentDiv.find('td').eq(2).append(lparButton);
|
|
|
|
|
2012-05-04 00:54:58 +00:00
|
|
|
lparButton.bind('click',
|
|
|
|
function() {
|
|
|
|
var reg = /(([0-7]|[0-7]-[0-7]):[1-5],)*(([0-7]|[0-7]-[0-7]):[1-5])$/g;
|
|
|
|
var lparCount = 0;
|
|
|
|
$('#discoverContentDiv .ui-state-error').remove();
|
|
|
|
collectInputValue();
|
|
|
|
var inputStr = getDiscoverEnv('partconf');
|
|
|
|
var testArray = reg.exec(inputStr);
|
|
|
|
if (!testArray || inputStr != testArray[0]) {
|
|
|
|
var warnBar = createWarnBar('Input the correct configuration rule.');
|
|
|
|
$('#discoverContentDiv').prepend(warnBar);
|
|
|
|
return;
|
2011-12-31 06:46:13 +00:00
|
|
|
}
|
|
|
|
|
2012-05-04 00:54:58 +00:00
|
|
|
var ruleArray = inputStr.split(',');
|
|
|
|
for (var i in ruleArray) {
|
|
|
|
var octantCount = 0;
|
|
|
|
var octantArray = ruleArray[i].split(':');
|
|
|
|
var octantRule = Number(octantArray[1]);
|
|
|
|
var pos = octantArray[0].indexOf('-');
|
|
|
|
if (5 == octantRule) {
|
|
|
|
octantRule = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (-1 == pos) {
|
|
|
|
octantCount = 1;
|
|
|
|
} else {
|
|
|
|
var startIndex = Number(octantArray[0]
|
|
|
|
.substring(0, pos));
|
|
|
|
var endIndex = Number(octantArray[0]
|
|
|
|
.substring(pos + 1));
|
|
|
|
octantCount = endIndex - startIndex + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
lparCount += octantCount * octantRule;
|
2011-12-31 06:46:13 +00:00
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
if (getDiscoverEnv('lparNumPerCec') != lparCount) {
|
|
|
|
var warnBar = createWarnBar('The LPAR number per CEC is '
|
|
|
|
+ getDiscoverEnv('lparNumPerCec')
|
|
|
|
+ ', but the configuration '
|
|
|
|
+ 'rule calculation is ' + lparCount + '.');
|
|
|
|
$('#discoverContentDiv').prepend(warnBar);
|
|
|
|
return;
|
2011-12-31 06:46:13 +00:00
|
|
|
}
|
|
|
|
|
2012-05-04 00:54:58 +00:00
|
|
|
var diaDiv = $('<div id="createLparDiv"></div>');
|
|
|
|
diaDiv.append('<ul></ul>');
|
|
|
|
diaDiv.append(createLoader());
|
|
|
|
diaDiv.dialog({
|
|
|
|
modal : true,
|
|
|
|
width : 600,
|
|
|
|
title : 'Creating Lpars...'
|
2011-12-31 06:46:13 +00:00
|
|
|
});
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
$('.ui-dialog-titlebar-close').hide();
|
|
|
|
|
|
|
|
var cecArray = expandNR(getDiscoverEnv('cecName'));
|
|
|
|
for (var i in cecArray) {
|
|
|
|
$.ajax({
|
|
|
|
url : 'lib/cmd.php',
|
|
|
|
dataType : 'json',
|
|
|
|
data : {
|
|
|
|
cmd : 'mkvm',
|
|
|
|
tgt : cecArray[i] + 'nodes',
|
|
|
|
args : '-i;1;-m;non-interleaved;-r;'
|
|
|
|
+ inputStr,
|
|
|
|
msg : cecArray[i] + ';' + cecArray.length
|
|
|
|
},
|
|
|
|
|
|
|
|
success : function(data) {
|
|
|
|
// update the dialogure
|
|
|
|
var tempArray = data.msg.split(';');
|
|
|
|
updateCreateLparDia(tempArray[0],
|
|
|
|
Number(tempArray[1]));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
2011-12-31 06:46:13 +00:00
|
|
|
}
|
|
|
|
|
2012-05-04 00:54:58 +00:00
|
|
|
function updateCreateLparDia(cecname, cecNum) {
|
2011-12-31 06:46:13 +00:00
|
|
|
$('#createLparDiv ul').append('<li>Creating lpars on ' + cecname + ' competed.</li>');
|
2012-05-04 00:54:58 +00:00
|
|
|
|
|
|
|
if (cecNum != $('#createLparDiv li').size()) {
|
2011-12-31 06:46:13 +00:00
|
|
|
return;
|
|
|
|
}
|
2012-05-04 00:54:58 +00:00
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
$('#createLparDiv').empty();
|
2012-05-04 00:54:58 +00:00
|
|
|
$('#createLparDiv').append('<p>All lpars are created. You must:<br/>1. reboot the all CECS. <br/>'
|
|
|
|
+ '2.use chvm to assign the I/O slots to the new LPAR.</p>');
|
|
|
|
|
2011-12-31 06:46:13 +00:00
|
|
|
var chvmButton = createButton('OK');
|
|
|
|
$('#createLparDiv').append(chvmButton);
|
2012-05-04 00:54:58 +00:00
|
|
|
chvmButton.bind('click', function() {
|
2011-12-31 06:46:13 +00:00
|
|
|
$('#createLparDiv').dialog('destroy');
|
|
|
|
$('#createLparDiv').remove();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2012-05-04 00:54:58 +00:00
|
|
|
function nonihCreateLpar(parentDiv) {
|
2011-12-31 06:46:13 +00:00
|
|
|
var showStr = 'The machine type is not P7 IH, so you had to create lpars by command line manually.';
|
|
|
|
parentDiv.append(createInfoBar(showStr));
|
|
|
|
return;
|
2011-09-09 06:03:09 +00:00
|
|
|
}
|