'
+ steps[currentStep] + '
');
var infoBar = createInfoBar('Make sure the discovery NIC\'s IP, start IP addresses and DHCP dynamic IP range are in the same subnet.');
showDiv.append(infoBar);
// Init the IP range by input
if (getDiscoverEnv('idataplexIpStart')) {
startIp = getDiscoverEnv('idataplexIpStart');
}
if (getDiscoverEnv('idataplexIpEnd')) {
endIp = getDiscoverEnv('idataplexIpEnd');
}
var showString = '
';
showDiv.append(showString);
$('#discoverContentDiv').append(showDiv);
$('#discoverContentDiv [title]').tooltip({
position : "center right",
offset : [ -2, 10 ],
effect : "fade",
opacity : 1
});
createDiscoverButtons();
}
/**
* Step 4: Check the dynamic range for DHCP
*/
function idataplexCheckNetwork(operType) {
collectInputValue();
if ('back' == operType) {
return true;
}
$('#networkDiv .ui-state-error').remove();
var startIp = getDiscoverEnv('idataplexIpStart');
var endIp = getDiscoverEnv('idataplexIpEnd');
var errMessage = '';
if (!verifyIp(startIp)) {
errMessage += 'Input the correct start IP address.
';
}
if (!verifyIp(endIp)) {
errMessage += 'Input the correct end IP address.
';
}
if ('' != errMessage) {
var warnBar = createWarnBar(errMessage);
$('#networkDiv').prepend(warnBar);
return false;
}
if (ip2Decimal(endIp) <= ip2Decimal(startIp)) {
var warnBar = createWarnBar('the end IP must larger than start IP.
');
$('#networkDiv').prepend(warnBar);
return false;
}
return true;
}
/**
* Step 5: Configure service by xCAT command and restart
*/
function idataplexInitService(operType) {
$('#discoverContentDiv').empty();
$('.tooltip').remove();
var showStr = '
' + steps[currentStep] + '
';
showStr += '
';
showStr += '- Create configure file for xcatsetup.
';
showStr += '- Wrote Objects into xCAT database by xcatsetup.
';
showStr += '- Configure Hosts.
';
showStr += '- Configure DNS.
';
showStr += '- Configure DHCP.
';
showStr += '- Configure Conserver.
';
showStr += '
';
showStr += '
';
$('#discoverContentDiv').append(showStr);
if ('back' == operType) {
createDiscoverButtons();
return;
}
idataplexCreateSetupFile();
}
/**
* Step 5: Create the stanza file for xcatsetup
*/
function idataplexCreateSetupFile() {
var fileContent = '';
// Add the waiting loader
$('#fileLine').append(createLoader());
fileContent += "xcat-site:\n" + " domain = cluster.com\n"
+ " cluster-type = idataplex\n";
fileContent += "xcat-service-lan:\n" + " dhcp-dynamic-range = "
+ getDiscoverEnv('idataplexIpStart') + "-"
+ getDiscoverEnv('idataplexIpEnd') + "\n";
fileContent += "xcat-switches:\n" + " hostname-range = "
+ getDiscoverEnv('idataplexswitchname') + "\n" + " starting-ip = "
+ getDiscoverEnv('idataplexswitchip') + "\n";
fileContent += "xcat-nodes:\n" + " hostname-range = "
+ getDiscoverEnv('idataplexnodename') + "\n" + " starting-ip = "
+ getDiscoverEnv('idataplexnodeip') + "\n"
+ " num-nodes-per-switch = "
+ getDiscoverEnv('idataplexperswitch') + "\n"
+ " num-nodes-per-frame = " + getDiscoverEnv('idataplexperframe')
+ "\n";
fileContent += "xcat-bmcs:\n" + " hostname-range = "
+ getDiscoverEnv('idataplexbmcname') + "\n" + " starting-ip = "
+ getDiscoverEnv('idataplexbmcip') + "\n";
$.ajax({
url : 'lib/systemcmd.php',
dataType : 'json',
data : {
cmd : 'echo -e "' + fileContent + '" > /tmp/webxcat.conf'
},
success : function(data) {
$('#fileLine img').remove();
var tempSpan = $('#fileLine').find('span');
tempSpan.removeClass('ui-icon-wrench');
tempSpan.addClass('ui-icon-check');
idataplexSetup();
}
});
}
/**
* Step 5: Run xcatsetup to create the database for iDataplex cluster
*/
function idataplexSetup() {
$('#setupLine').append(createLoader());
$.ajax({
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'xcatsetup',
tgt : '',
args : '/tmp/webxcat.conf',
msg : ''
},
success : function(data) {
$('#setupLine img').remove();
var tempSpan = $('#setupLine').find('span');
tempSpan.removeClass('ui-icon-wrench');
tempSpan.addClass('ui-icon-check');
idataplexMakehosts();
}
});
}
/**
* Step 5: Run makehosts for iDataplex
*/
function idataplexMakehosts() {
createDiscoverButtons();
}
/**
* Step 6: Tell users to power on all hardware for discovery
*/
function idataplexInitPowerOn() {
$('#discoverContentDiv').empty();
$('.tooltip').remove();
var showString = '
'
+ steps[currentStep] + '
';
showString += 'Walk over to each idataplex server and push the power button to power on.
'
+ 'After about 5-10 minutes, nodes should be configured and ready for hardware management.
';
$('#discoverContentDiv').append(showString);
// Add the refresh button
var refreshButton = createButton("Refresh");
$('#poweronDiv').append(refreshButton);
refreshButton.bind('click', function() {
var tempObj = $('#poweronDiv div p');
tempObj.empty().append(createLoader());
$.ajax({
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'rpower',
tgt : 'all',
args : 'stat',
msg : ''
},
success : function(data) {
var tempObj = $('#poweronDiv div p');
tempObj.empty();
for ( var i in data.rsp) {
tempObj.append(data.rsp[i] + '
');
}
}
});
});
// Add the info area
var infoBar = createInfoBar('Click the refresh button to check all nodes\' status.');
$('#poweronDiv').append(infoBar);
createDiscoverButtons();
}