/** * Execute when the DOM is fully loaded */ $(document).ready(function() { // Load utility scripts }); /** * Constructor * * @return Nothing */ var hmcPlugin = function() { }; /** * Steps for hardware discovery wizard * * @return Discovery steps */ hmcPlugin.prototype.getStep = function() { return [ 'Basic patterns', 'Supernode', 'More patterns', 'Power on hardware', 'Discover frames', 'Management node', 'Discover Rest of Hardware and Update Definitions', 'Create LPARs' ]; }; hmcPlugin.prototype.getInitFunction = function() { return [ powerInitBasicPattern, powerInitSupernode, powerInitSiteTable, powerInitPoweronHardware, powerInitDiscoverFrames, powerInitConfig, powerInitUpdateDefinition, powerInitCreateLpar ]; }; hmcPlugin.prototype.getNextFunction = function() { return [ checkBasicPattern, checkSupernode, checkSiteTable, undefined, checkFrameMtms, undefined, undefined, collectInputValue ]; }; /** * Load node inventory * * @param data Data from HTTP request */ hmcPlugin.prototype.loadInventory = function(data) { // 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 = $('
'); // 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 = $(''); legend = $(''); fieldSet.append(legend); oList = $('Frames: | |||
Name Range: | '; // Use the super node to configure file and calculate the CEC's number showString += ' | ||
Vlan1 IP Header: | Vlan2 IP Header: | ' + '||
Drawers: | |||
Name Range: | '; showString += ' | Number of LPARs per Drawer: | |
Lpars: | |||
Name Range: | Starting IP Adress: | ||
HMCs: | |||
Name Range: | '; showString += ' | Number of Frames per HMC: | |
Starting IP Adress: | '; showString += ' | Hardware Managment: | HMC '; showString += 'DFM |
Building Block | |||
Frame amount per BB: | ' + '' + ' | CEC amount per BB: | ' + '' + ' |
' + frameArray[i] + ': |
Domain Name: | |
Name server: | |
DHCP Dynamic Range: | - |
admin password for FRAME and CEC: | |
general password for FRAME and CEC: | |
hmc password for FRAME and CEC: |
' + data.rsp + ''); } }); createDiscoverButtons(); } /** * Step 4: Check that the inputs are all filled */ function checkSiteTable(operType) { $('#discoverContentDiv input[name=ipStart]').trigger('change'); collectInputValue(); if ('back' == operType) { return true; } $('#discoverContentDiv .ui-state-error').remove(); var errMessage = ''; if (!getDiscoverEnv('domainname')) { errMessage += 'Input the domain name.
' + ' |
' + frameArray[i] + '
'); } for (var i in mtmsArray) { $('#mtmsTd').append( '' + mtmsArray[i] + '
'); } createDiscoverButtons(); } }); } 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(); } function createMap(obj) { var fname = ''; var mname = ''; if ($('#discoverShow :checked').size() < 2) { return; } if ('frameradio' == $(obj).attr('name')) { fname = $(obj).next().html(); mname = $('#discoverShow input[name=mtmsradio]:checked').next().html(); } else { fname = $('#discoverShow input[name=frameradio]:checked').next().html(); mname = $(obj).next().html(); } $('#discoverShow :checked').parent().remove(); showMap(fname, mname, 1); } function showMap(fname, mname, deleteflag) { var rowClass = ''; var deleteicon = ''; if ($('#discoverShow fieldset').size() < 1) { $('#discoverShow') .append( ''); } if (0 == $('#discoverShow fieldset tr').size() % 2) { rowClass = 'odd'; } else { rowClass = 'even'; } if (deleteflag){ deleteicon = '' + fname + '
'); $('#mtmsTd').append( '' + mname + '
'); } /** * Step 6: Write the frame and MTMs map file */ function checkFrameMtms(operType) { // Check the number of radio button var vpdFileCon = ''; $('#discoverShow .ui-state-error').remove(); if (0 < $('#discoverShow :radio').size()) { var warnBar = createWarnBar('Map all of the frame with mtms.'); $('#discoverContentDiv #discoverShow').prepend(warnBar); return false; } // Find out all maps var maps = ''; $('#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'; }); maps = maps.substr(0, maps.length - 1); setDiscoverEnv('framemtmsmap', maps); if ('back' == operType) { return true; } // Write the maps into vpd table $.ajax({ url : 'lib/cmd.php', dataType : 'json', data : { cmd : 'webrun', tgt : '', args : 'writeconfigfile;/tmp/webvpd.stanza;' + vpdFileCon, msg : '' } }); return true; } /** * Step 7: Create the xcatsetup configure file and run xcatsetup to define all * objects in xcat database. */ function powerInitConfig(operType) { $('#discoverContentDiv').empty(); $('.tooltip').remove(); var showStr = 'Partition Configuration: | ' + '
All lpars are created. You must:
1. reboot the all CECS.
'
+ '2.use chvm to assign the I/O slots to the new LPAR.