diff --git a/xCAT-UI/js/custom/esx.js b/xCAT-UI/js/custom/esx.js new file mode 100644 index 000000000..9a73a90be --- /dev/null +++ b/xCAT-UI/js/custom/esx.js @@ -0,0 +1,599 @@ +/** + * Execute when the DOM is fully loaded + */ +$(document).ready(function() { + // Load utility scripts (if any) +}); + +/** + * Constructor + * + * @return Nothing + */ +var esxPlugin = function() { + +}; + +/** + * Clone node (service page) + * + * @param node + * Node to clone + * @return Nothing + */ +esxPlugin.prototype.serviceClone = function(node) { + +}; + +/** + * Load provision page (service page) + * + * @param tabId + * Tab ID where page will reside + * @return Nothing + */ +esxPlugin.prototype.loadServiceProvisionPage = function(tabId) { + +}; + +/** + * Show node inventory (service page) + * + * @param data + * Data from HTTP request + * @return Nothing + */ +esxPlugin.prototype.loadServiceInventory = function(data) { + +}; + +/** + * Load node inventory + * + * @param data + * Data from HTTP request + * @return Nothing + */ +esxPlugin.prototype.loadInventory = function(data) { + var args = data.msg.split(','); + var tabId = args[0].replace('out=', ''); + 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 = $('
'); + + // Create a fieldset + var fieldSet = $('
'); + var legend = $('Hardware'); + fieldSet.append(legend); + + var oList = $('
    '); + fieldSet.append(oList); + invDiv.append(fieldSet); + + // Loop through each line + var item; + for (var k = 0; k < inv.length; k++) { + // Remove node name + var attr = inv[k].replace(node + ': ', ''); + attr = jQuery.trim(attr); + + // Append attribute to list + item = $('
  1. '); + item.append(attr); + oList.append(item); + } + + // Append to inventory form + $('#' + tabId).append(invDiv); +}; + +/** + * Load clone page + * + * @param node + * Source node to clone + * @return Nothing + */ +esxPlugin.prototype.loadClonePage = function(node) { + // Get nodes tab + var tab = getNodesTab(); + var newTabId = node + 'CloneTab'; + + // If there is no existing clone tab + if (!$('#' + newTabId).length) { + // Create info bar + var infoBar = createInfoBar('Not supported'); + + // Create clone form + var cloneForm = $('
    '); + cloneForm.append(infoBar); + + // Add clone tab + tab.add(newTabId, 'Clone', cloneForm, true); + } + + tab.select(newTabId); +}; + +/** + * Load provision page + * + * @param tabId + * The provision tab ID + * @return Nothing + */ +esxPlugin.prototype.loadProvisionPage = function(tabId) { + // Get OS image names + $.ajax( { + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'tabdump', + tgt : '', + args : 'osimage', + msg : '' + }, + + success : setOSImageCookies + }); + + // Get groups + $.ajax( { + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'extnoderange', + tgt : '/.*', + args : 'subgroups', + msg : '' + }, + + success : setGroupsCookies + }); + + // Get provision tab instance + var inst = tabId.replace('esxProvisionTab', ''); + + // Create provision form + var provForm = $('
    '); + + // Create info bar + var infoBar = createInfoBar('Provision an ESX virtual machine.'); + provForm.append(infoBar); + + // Append to provision tab + $('#' + tabId).append(provForm); + + var vmFS = $('
    '); + var vmLegend = $('Virtual Machine'); + vmFS.append(vmLegend); + + var hwFS = $('
    '); + var hwLegend = $('Hardware'); + hwFS.append(hwLegend); + + var imgFS = $('
    '); + var imgLegend = $('Image'); + imgFS.append(imgLegend); + + provForm.append(vmFS, hwFS, imgFS); + + // Create hypervisor input + var hypervisor = $('
    '); + var hypervisorLabel = $(''); + hypervisor.append(hypervisorLabel); + + // Turn on auto complete for group + var hypervisorNames = $.cookie(''); + if (hypervisorNames) { + // Split group names into an array + var tmp = groupNames.split(','); + + // Create drop down for groups + var hypervisorSelect = $(''); + hypervisorSelect.append(''); + for ( var i in tmp) { + // Add group into drop down + var opt = $(''); + hypervisorSelect.append(opt); + } + hypervisor.append(groupSelect); + } else { + // If no groups are cookied + var hypervisorInput = $(''); + hypervisor.append(hypervisorInput); + } + vmFS.append(hypervisor); + + // Create group input + var group = $('
    '); + var groupLabel = $(''); + group.append(groupLabel); + + // Turn on auto complete for group + var groupNames = $.cookie('groups'); + if (groupNames) { + // Split group names into an array + var tmp = groupNames.split(','); + + // Create drop down for groups + var groupSelect = $(''); + groupSelect.append(''); + for ( var i in tmp) { + // Add group into drop down + var opt = $(''); + groupSelect.append(opt); + } + group.append(groupSelect); + } else { + // If no groups are cookied + var groupInput = $(''); + group.append(groupInput); + } + vmFS.append(group); + + // Create node input + var node = $('
    '); + var nodeLabel = $(''); + var nodeInput = $(''); + node.append(nodeLabel); + node.append(nodeInput); + vmFS.append(node); + + // Create memory input + var memory = $('
    '); + var memoryLabel = $(''); + var memoryInput = $(''); + memory.append(memoryLabel); + memory.append(memoryInput); + hwFS.append(memory); + + // Create processor dropdown + var cpu = $('
    '); + var cpuLabel = $(''); + var cpuSelect = $(''); + cpuSelect.append('' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + ); + cpu.append(cpuLabel); + cpu.append(cpuSelect); + hwFS.append(cpu); + + // Create NIC dropdown + var nic = $('
    '); + var nicLabel = $(''); + var nicSelect = $(''); + nicSelect.append('' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + ); + nic.append(nicLabel); + nic.append(nicSelect); + hwFS.append(nic); + + // Create disk input + var disk = $('
    '); + var diskLabel = $(''); + var diskInput = $(''); + var diskSizeSelect = $(''); + diskSizeSelect.append('' + + '' + ); + disk.append(diskLabel, diskInput, diskSizeSelect); + hwFS.append(disk); + + // Create operating system input + var os = $('
    '); + var osLabel = $(''); + var osInput = $(''); + osInput.one('focus', function() { + var tmp = $.cookie('osvers'); + if (tmp) { + // Turn on auto complete + $(this).autocomplete({ + source: tmp.split(',') + }); + } + }); + os.append(osLabel); + os.append(osInput); + imgFS.append(os); + + // Create architecture input + var arch = $('
    '); + var archLabel = $(''); + var archInput = $(''); + archInput.one('focus', function() { + var tmp = $.cookie('osarchs'); + if (tmp) { + // Turn on auto complete + $(this).autocomplete({ + source: tmp.split(',') + }); + } + }); + arch.append(archLabel); + arch.append(archInput); + imgFS.append(arch); + + // Create profile input + var profile = $('
    '); + var profileLabel = $(''); + var profileInput = $(''); + profileInput.one('focus', function() { + var tmp = $.cookie('profiles'); + if (tmp) { + // Turn on auto complete + $(this).autocomplete({ + source: tmp.split(',') + }); + } + }); + profile.append(profileLabel); + profile.append(profileInput); + imgFS.append(profile); + + // Create boot method dropdown + var method = $('
    '); + var methodLabel = $(''); + var methodSelect = $(''); + methodSelect.append('' + + '' + + '' + + '' + + '' + + '' + ); + method.append(methodLabel); + method.append(methodSelect); + imgFS.append(method); + + /** + * Provision existing + */ + var provisionBtn = createButton('Provision'); + provisionBtn.bind('click', function(event) { + // Remove any warning messages + $(this).parents('.ui-tabs-panel').find('.ui-state-error').remove(); + var ready = true; + var errorMessage = ''; + + // Get provision tab ID + var thisTabId = 'esxProvisionTab' + inst; + }); + provForm.append(provisionBtn); +}; + +/** + * Load resources + * + * @return Nothing + */ +esxPlugin.prototype.loadResources = function() { + // Get resource tab ID + var tabId = 'esxResourceTab'; + // Remove loader + $('#' + tabId).find('img').remove(); + + // Create info bar + var infoBar = createInfoBar('Under construction'); + + // Create resource form + var resrcForm = $('
    '); + resrcForm.append(infoBar); + + $('#' + tabId).append(resrcForm); +}; + +/** + * Add node range + * + * @return Nothing + */ +esxPlugin.prototype.addNode = function() { + var diag = $('
    '); + var info = createInfoBar('Add a node range'); + diag.append(info); + + // Create node inputs + var nodeFieldSet = $('
    '); + var legend = $('Node'); + nodeFieldSet.append(legend); + diag.append(nodeFieldSet); + + var nodeInputs = '
    ' + + '
    ' + + '
    ' + + '
    '; + nodeFieldSet.append(nodeInputs); + + var bmcFieldSet = $('
    '); + var legend = $('BMC'); + bmcFieldSet.append(legend); + diag.append(bmcFieldSet); + + // Create BMC inputs + var bmcInputs = '
    ' + + '
    ' + + '
    '; + bmcFieldSet.append(bmcInputs); + + diag.dialog({ + title: 'Add node', + modal: true, + width: 400, + close: function(){$(this).remove();}, + buttons: { + "OK" : function(){addIdataplex();}, + "Cancel": function(){$(this).dialog('close');} + } + }); +}; + +/** + * Add iDataPlex node range + * + * @return Nothing + */ +function addIdataplex(){ + var tempArray = new Array(); + var errorMessage = ''; + var attr = ''; + var args = ''; + + // Remove existing warnings + $('#addIdplx .ui-state-error').remove(); + + // Get input values + $('#addIdplx input').each(function(){ + attr = $(this).val(); + if (attr) { + tempArray.push($(this).val()); + } else { + errorMessage = "You are missing some inputs!"; + return false; + } + }); + + if (errorMessage) { + $('#addIdplx').prepend(createWarnBar(errorMessage)); + return; + } + + // Create loader + $('#addIdplx').append(createLoader()); + + // Change dialog buttons + $('#addIdplx').dialog('option', 'buttons', { + 'Close':function(){ + $('#addIdplx').dialog('close'); + } + }); + + // Generate chdef arguments + args = '-t;node;-o;' + tempArray[0] + ';mac=' + tempArray[1] + ';ip=' + tempArray[2] + ';groups=' + + tempArray[3] + ';mgt=esx;chain="runcmd=bmcsetup";netboot=xnba;nodetype=osi;profile=compute;' + + 'bmc=' + tempArray[4]; + $.ajax({ + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'chdef', + tgt : '', + args : args, + msg : '' + } + }); + + // Generate chdef arguments for BMC + args = '-t;node;-o;' + tempArray[4] + ';ip=' + tempArray[5] + ';groups=' + tempArray[6]; + $.ajax({ + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'chdef', + tgt : '', + args : args, + msg : '' + }, + success: function(data) { + $('#addIdplx img').remove(); + var message = ''; + for (var i in data.rsp) { + message += data.rsp[i]; + } + + if (message) { + $('#addIdplx').prepend(createInfoBar(message)); + } + } + }); +} + +/** + * Update the provision node status + * + * @param data + * Data returned from HTTP request + * @return Nothing + */ +function updateESXProvisionStatus(data) { + // Get ajax response + var rsp = data.rsp; + var args = data.msg.split(';'); + + // Get command invoked + var cmd = args[0].replace('cmd=', ''); + // Get provision tab instance + var inst = args[1].replace('out=', ''); + + // Get provision tab and status bar ID + var statBarId = 'esxProvisionStatBar' + inst; + var tabId = 'esxProvisionTab' + inst; + + /** + * (2) Remote install + */ + if (cmd == 'nodeadd') { + // Write ajax response to status bar + var prg = writeRsp(rsp, ''); + $('#' + statBarId).find('div').append(prg); + + // Get parameters + var os = $('#' + tabId + ' input[name="os"]').val(); + var profile = $('#' + tabId + ' input[name="profile"]').val(); + var arch = $('#' + tabId + ' input[name="arch"]').val(); + + // Get nodes that were checked + var dTableId = 'esxNodesDatatable' + inst; + var tgts = getNodesChecked(dTableId); + + // Begin installation + $.ajax( { + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'webrun', + tgt : '', + args : 'rinstall;' + os + ';' + profile + ';' + arch + ';' + tgts, + msg : 'cmd=rinstall;out=' + inst + }, + + success : updateESXProvisionStatus + }); + } + + /** + * (3) Done + */ + else if (cmd == 'rinstall') { + // Write ajax response to status bar + var prg = writeRsp(rsp, ''); + $('#' + statBarId).find('div').append(prg); + $('#' + statBarId).find('img').remove(); + + // If installation was successful + if (prg.html().indexOf('Error') == -1) { + $('#' + statBarId).find('div').append('
    It will take several minutes before the nodes are up and ready. Use nodestat to check the status of the install.
    '); + } + } +} \ No newline at end of file diff --git a/xCAT-UI/js/custom/ipmi.js b/xCAT-UI/js/custom/ipmi.js index 3c74067f3..cdda330c8 100644 --- a/xCAT-UI/js/custom/ipmi.js +++ b/xCAT-UI/js/custom/ipmi.js @@ -173,7 +173,7 @@ ipmiPlugin.prototype.loadProvisionPage = function(tabId) { $('#' + tabId).append(provForm); // Create provision existing node division - var provExisting = createIpmpProvisionExisting(inst); + var provExisting = createIpmiProvisionExisting(inst); provForm.append(provExisting); }; @@ -330,7 +330,7 @@ function addIdataplex(){ * Provision tab instance * @return Provision existing node division */ -function createIpmpProvisionExisting(inst) { +function createIpmiProvisionExisting(inst) { // Create provision existing division var provExisting = $('
    '); diff --git a/xCAT-UI/js/custom/kvm.js b/xCAT-UI/js/custom/kvm.js new file mode 100644 index 000000000..39c7ca8f2 --- /dev/null +++ b/xCAT-UI/js/custom/kvm.js @@ -0,0 +1,599 @@ +/** + * Execute when the DOM is fully loaded + */ +$(document).ready(function() { + // Load utility scripts (if any) +}); + +/** + * Constructor + * + * @return Nothing + */ +var kvmPlugin = function() { + +}; + +/** + * Clone node (service page) + * + * @param node + * Node to clone + * @return Nothing + */ +kvmPlugin.prototype.serviceClone = function(node) { + +}; + +/** + * Load provision page (service page) + * + * @param tabId + * Tab ID where page will reside + * @return Nothing + */ +kvmPlugin.prototype.loadServiceProvisionPage = function(tabId) { + +}; + +/** + * Show node inventory (service page) + * + * @param data + * Data from HTTP request + * @return Nothing + */ +kvmPlugin.prototype.loadServiceInventory = function(data) { + +}; + +/** + * Load node inventory + * + * @param data + * Data from HTTP request + * @return Nothing + */ +kvmPlugin.prototype.loadInventory = function(data) { + var args = data.msg.split(','); + var tabId = args[0].replace('out=', ''); + 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 = $('
    '); + + // Create a fieldset + var fieldSet = $('
    '); + var legend = $('Hardware'); + fieldSet.append(legend); + + var oList = $('
      '); + fieldSet.append(oList); + invDiv.append(fieldSet); + + // Loop through each line + var item; + for (var k = 0; k < inv.length; k++) { + // Remove node name + var attr = inv[k].replace(node + ': ', ''); + attr = jQuery.trim(attr); + + // Append attribute to list + item = $('
    1. '); + item.append(attr); + oList.append(item); + } + + // Append to inventory form + $('#' + tabId).append(invDiv); +}; + +/** + * Load clone page + * + * @param node + * Source node to clone + * @return Nothing + */ +kvmPlugin.prototype.loadClonePage = function(node) { + // Get nodes tab + var tab = getNodesTab(); + var newTabId = node + 'CloneTab'; + + // If there is no existing clone tab + if (!$('#' + newTabId).length) { + // Create info bar + var infoBar = createInfoBar('Not supported'); + + // Create clone form + var cloneForm = $('
      '); + cloneForm.append(infoBar); + + // Add clone tab + tab.add(newTabId, 'Clone', cloneForm, true); + } + + tab.select(newTabId); +}; + +/** + * Load provision page + * + * @param tabId + * The provision tab ID + * @return Nothing + */ +kvmPlugin.prototype.loadProvisionPage = function(tabId) { + // Get OS image names + $.ajax( { + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'tabdump', + tgt : '', + args : 'osimage', + msg : '' + }, + + success : setOSImageCookies + }); + + // Get groups + $.ajax( { + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'extnoderange', + tgt : '/.*', + args : 'subgroups', + msg : '' + }, + + success : setGroupsCookies + }); + + // Get provision tab instance + var inst = tabId.replace('kvmProvisionTab', ''); + + // Create provision form + var provForm = $('
      '); + + // Create info bar + var infoBar = createInfoBar('Provision an KVM virtual machine.'); + provForm.append(infoBar); + + // Append to provision tab + $('#' + tabId).append(provForm); + + var vmFS = $('
      '); + var vmLegend = $('Virtual Machine'); + vmFS.append(vmLegend); + + var hwFS = $('
      '); + var hwLegend = $('Hardware'); + hwFS.append(hwLegend); + + var imgFS = $('
      '); + var imgLegend = $('Image'); + imgFS.append(imgLegend); + + provForm.append(vmFS, hwFS, imgFS); + + // Create hypervisor input + var hypervisor = $('
      '); + var hypervisorLabel = $(''); + hypervisor.append(hypervisorLabel); + + // Turn on auto complete for group + var hypervisorNames = $.cookie(''); + if (hypervisorNames) { + // Split group names into an array + var tmp = groupNames.split(','); + + // Create drop down for groups + var hypervisorSelect = $(''); + hypervisorSelect.append(''); + for ( var i in tmp) { + // Add group into drop down + var opt = $(''); + hypervisorSelect.append(opt); + } + hypervisor.append(groupSelect); + } else { + // If no groups are cookied + var hypervisorInput = $(''); + hypervisor.append(hypervisorInput); + } + vmFS.append(hypervisor); + + // Create group input + var group = $('
      '); + var groupLabel = $(''); + group.append(groupLabel); + + // Turn on auto complete for group + var groupNames = $.cookie('groups'); + if (groupNames) { + // Split group names into an array + var tmp = groupNames.split(','); + + // Create drop down for groups + var groupSelect = $(''); + groupSelect.append(''); + for ( var i in tmp) { + // Add group into drop down + var opt = $(''); + groupSelect.append(opt); + } + group.append(groupSelect); + } else { + // If no groups are cookied + var groupInput = $(''); + group.append(groupInput); + } + vmFS.append(group); + + // Create node input + var node = $('
      '); + var nodeLabel = $(''); + var nodeInput = $(''); + node.append(nodeLabel); + node.append(nodeInput); + vmFS.append(node); + + // Create memory input + var memory = $('
      '); + var memoryLabel = $(''); + var memoryInput = $(''); + memory.append(memoryLabel); + memory.append(memoryInput); + hwFS.append(memory); + + // Create processor dropdown + var cpu = $('
      '); + var cpuLabel = $(''); + var cpuSelect = $(''); + cpuSelect.append('' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + ); + cpu.append(cpuLabel); + cpu.append(cpuSelect); + hwFS.append(cpu); + + // Create NIC dropdown + var nic = $('
      '); + var nicLabel = $(''); + var nicSelect = $(''); + nicSelect.append('' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + ); + nic.append(nicLabel); + nic.append(nicSelect); + hwFS.append(nic); + + // Create disk input + var disk = $('
      '); + var diskLabel = $(''); + var diskInput = $(''); + var diskSizeSelect = $(''); + diskSizeSelect.append('' + + '' + ); + disk.append(diskLabel, diskInput, diskSizeSelect); + hwFS.append(disk); + + // Create operating system input + var os = $('
      '); + var osLabel = $(''); + var osInput = $(''); + osInput.one('focus', function() { + var tmp = $.cookie('osvers'); + if (tmp) { + // Turn on auto complete + $(this).autocomplete({ + source: tmp.split(',') + }); + } + }); + os.append(osLabel); + os.append(osInput); + imgFS.append(os); + + // Create architecture input + var arch = $('
      '); + var archLabel = $(''); + var archInput = $(''); + archInput.one('focus', function() { + var tmp = $.cookie('osarchs'); + if (tmp) { + // Turn on auto complete + $(this).autocomplete({ + source: tmp.split(',') + }); + } + }); + arch.append(archLabel); + arch.append(archInput); + imgFS.append(arch); + + // Create profile input + var profile = $('
      '); + var profileLabel = $(''); + var profileInput = $(''); + profileInput.one('focus', function() { + var tmp = $.cookie('profiles'); + if (tmp) { + // Turn on auto complete + $(this).autocomplete({ + source: tmp.split(',') + }); + } + }); + profile.append(profileLabel); + profile.append(profileInput); + imgFS.append(profile); + + // Create boot method dropdown + var method = $('
      '); + var methodLabel = $(''); + var methodSelect = $(''); + methodSelect.append('' + + '' + + '' + + '' + + '' + + '' + ); + method.append(methodLabel); + method.append(methodSelect); + imgFS.append(method); + + /** + * Provision existing + */ + var provisionBtn = createButton('Provision'); + provisionBtn.bind('click', function(event) { + // Remove any warning messages + $(this).parents('.ui-tabs-panel').find('.ui-state-error').remove(); + var ready = true; + var errorMessage = ''; + + // Get provision tab ID + var thisTabId = 'kvmProvisionTab' + inst; + }); + provForm.append(provisionBtn); +}; + +/** + * Load resources + * + * @return Nothing + */ +kvmPlugin.prototype.loadResources = function() { + // Get resource tab ID + var tabId = 'kvmResourceTab'; + // Remove loader + $('#' + tabId).find('img').remove(); + + // Create info bar + var infoBar = createInfoBar('Under construction'); + + // Create resource form + var resrcForm = $('
      '); + resrcForm.append(infoBar); + + $('#' + tabId).append(resrcForm); +}; + +/** + * Add node range + * + * @return Nothing + */ +kvmPlugin.prototype.addNode = function() { + var diag = $('
      '); + var info = createInfoBar('Add a node range'); + diag.append(info); + + // Create node inputs + var nodeFieldSet = $('
      '); + var legend = $('Node'); + nodeFieldSet.append(legend); + diag.append(nodeFieldSet); + + var nodeInputs = '
      ' + + '
      ' + + '
      ' + + '
      '; + nodeFieldSet.append(nodeInputs); + + var bmcFieldSet = $('
      '); + var legend = $('BMC'); + bmcFieldSet.append(legend); + diag.append(bmcFieldSet); + + // Create BMC inputs + var bmcInputs = '
      ' + + '
      ' + + '
      '; + bmcFieldSet.append(bmcInputs); + + diag.dialog({ + title: 'Add node', + modal: true, + width: 400, + close: function(){$(this).remove();}, + buttons: { + "OK" : function(){addIdataplex();}, + "Cancel": function(){$(this).dialog('close');} + } + }); +}; + +/** + * Add iDataPlex node range + * + * @return Nothing + */ +function addIdataplex(){ + var tempArray = new Array(); + var errorMessage = ''; + var attr = ''; + var args = ''; + + // Remove existing warnings + $('#addIdplx .ui-state-error').remove(); + + // Get input values + $('#addIdplx input').each(function(){ + attr = $(this).val(); + if (attr) { + tempArray.push($(this).val()); + } else { + errorMessage = "You are missing some inputs!"; + return false; + } + }); + + if (errorMessage) { + $('#addIdplx').prepend(createWarnBar(errorMessage)); + return; + } + + // Create loader + $('#addIdplx').append(createLoader()); + + // Change dialog buttons + $('#addIdplx').dialog('option', 'buttons', { + 'Close':function(){ + $('#addIdplx').dialog('close'); + } + }); + + // Generate chdef arguments + args = '-t;node;-o;' + tempArray[0] + ';mac=' + tempArray[1] + ';ip=' + tempArray[2] + ';groups=' + + tempArray[3] + ';mgt=kvm;chain="runcmd=bmcsetup";netboot=xnba;nodetype=osi;profile=compute;' + + 'bmc=' + tempArray[4]; + $.ajax({ + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'chdef', + tgt : '', + args : args, + msg : '' + } + }); + + // Generate chdef arguments for BMC + args = '-t;node;-o;' + tempArray[4] + ';ip=' + tempArray[5] + ';groups=' + tempArray[6]; + $.ajax({ + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'chdef', + tgt : '', + args : args, + msg : '' + }, + success: function(data) { + $('#addIdplx img').remove(); + var message = ''; + for (var i in data.rsp) { + message += data.rsp[i]; + } + + if (message) { + $('#addIdplx').prepend(createInfoBar(message)); + } + } + }); +} + +/** + * Update the provision node status + * + * @param data + * Data returned from HTTP request + * @return Nothing + */ +function updateKVMProvisionStatus(data) { + // Get ajax response + var rsp = data.rsp; + var args = data.msg.split(';'); + + // Get command invoked + var cmd = args[0].replace('cmd=', ''); + // Get provision tab instance + var inst = args[1].replace('out=', ''); + + // Get provision tab and status bar ID + var statBarId = 'kvmProvisionStatBar' + inst; + var tabId = 'kvmProvisionTab' + inst; + + /** + * (2) Remote install + */ + if (cmd == 'nodeadd') { + // Write ajax response to status bar + var prg = writeRsp(rsp, ''); + $('#' + statBarId).find('div').append(prg); + + // Get parameters + var os = $('#' + tabId + ' input[name="os"]').val(); + var profile = $('#' + tabId + ' input[name="profile"]').val(); + var arch = $('#' + tabId + ' input[name="arch"]').val(); + + // Get nodes that were checked + var dTableId = 'kvmNodesDatatable' + inst; + var tgts = getNodesChecked(dTableId); + + // Begin installation + $.ajax( { + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'webrun', + tgt : '', + args : 'rinstall;' + os + ';' + profile + ';' + arch + ';' + tgts, + msg : 'cmd=rinstall;out=' + inst + }, + + success : updateKVMProvisionStatus + }); + } + + /** + * (3) Done + */ + else if (cmd == 'rinstall') { + // Write ajax response to status bar + var prg = writeRsp(rsp, ''); + $('#' + statBarId).find('div').append(prg); + $('#' + statBarId).find('img').remove(); + + // If installation was successful + if (prg.html().indexOf('Error') == -1) { + $('#' + statBarId).find('div').append('
      It will take several minutes before the nodes are up and ready. Use nodestat to check the status of the install.
      '); + } + } +} \ No newline at end of file diff --git a/xCAT-UI/js/provision/provision.js b/xCAT-UI/js/provision/provision.js index af0498a7f..bee828b28 100644 --- a/xCAT-UI/js/provision/provision.js +++ b/xCAT-UI/js/provision/provision.js @@ -83,11 +83,15 @@ function loadProvisionPage() { // Create radio buttons for platforms var hwList = $('
        Platforms available:
      '); + var esx = $('
    2. ESX
    3. '); + var kvm = $('
    4. KVM
    5. '); var ipmi = $('
    6. iDataPlex
    7. '); var blade = $('
    8. BladeCenter
    9. '); var hmc = $('
    10. System p
    11. '); var zvm = $('
    12. System z
    13. '); + hwList.append(esx); + hwList.append(kvm); hwList.append(ipmi); hwList.append(blade); hwList.append(hmc); @@ -111,22 +115,30 @@ function loadProvisionPage() { // Create an instance of the plugin var plugin; switch (hw) { - case "blade": - plugin = new bladePlugin(); - title = 'BladeCenter'; - break; - case "hmc": - plugin = new hmcPlugin(); - title = 'System p'; - break; - case "ipmi": - plugin = new ipmiPlugin(); - title = 'iDataPlex'; - break; - case "zvm": - plugin = new zvmPlugin(); - title = 'System z'; - break; + case "kvm": + plugin = new kvmPlugin(); + title = 'KVM'; + break; + case "esx": + plugin = new esxPlugin(); + title = 'ESX'; + break; + case "blade": + plugin = new bladePlugin(); + title = 'BladeCenter'; + break; + case "hmc": + plugin = new hmcPlugin(); + title = 'System p'; + break; + case "ipmi": + plugin = new ipmiPlugin(); + title = 'iDataPlex'; + break; + case "zvm": + plugin = new zvmPlugin(); + title = 'System z'; + break; } // Select tab diff --git a/xCAT-UI/js/ui.js b/xCAT-UI/js/ui.js index 48d69e690..6c2267016 100644 --- a/xCAT-UI/js/ui.js +++ b/xCAT-UI/js/ui.js @@ -533,6 +533,8 @@ function initPage() { includeJs("js/provision/provision.js"); // Custom plugins + includeJs("js/custom/esx.js"); + includeJs("js/custom/kvm.js"); includeJs("js/custom/blade.js"); includeJs("js/custom/ipmi.js"); includeJs("js/custom/zvm.js");