' + 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
*
* @param
*
* @return
*/
function idataplexCheckNetwork(operType){
collectInputValue();
//click back button, do not need check, only collect input value is ok.
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
*
* @param
*
* @return
*/
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
*
* @param
*
* @return
*/
function idataplexCreateSetupFile(){
var fileContent = '';
//add the waiting loader on page
$('#fileLine').append(createLoader());
//site
fileContent += "xcat-site:\n" +
" domain = cluster.com\n" +
" cluster-type = idataplex\n";
//xcat-service-lan
fileContent += "xcat-service-lan:\n" +
" dhcp-dynamic-range = " + getDiscoverEnv('idataplexIpStart') + "-" + getDiscoverEnv('idataplexIpEnd') + "\n";
//xcat-switch
fileContent += "xcat-switches:\n" +
" hostname-range = " + getDiscoverEnv('idataplexswitchname') + "\n" +
" starting-ip = " + getDiscoverEnv('idataplexswitchip') + "\n";
//xcat-node
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";
//xcat-bmc
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
*
* @param
*
* @return
*/
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
*
* @param
*
* @return
*/
function idataplexMakehosts(){
createDiscoverButtons();
}
/**
* step 5: run makedns for idataplex
*
* @param
*
* @return
*/
function idataplexMakedns(){
}
/**
* step 5: run make dhcp for idataplex
*
* @param
*
* @return
*/
function idataplexMakedhcp(){
}
/**
* step 5: run make conserver for idataplex
*
* @param
*
* @return
*/
function idataplexMakeconserver(){
}
/**
* step 6: tell users to power on all hardware for discovery
*
* @param
*
* @return
*/
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();
}