diff --git a/xCAT-UI/js/custom/blade.js b/xCAT-UI/js/custom/blade.js index 23e0c34bb..e20e09d1a 100644 --- a/xCAT-UI/js/custom/blade.js +++ b/xCAT-UI/js/custom/blade.js @@ -411,7 +411,7 @@ function addBladeNode(){ } if ((!name) || (!group) || (!id) || (!mpa)){ - $('#nodeTypeSelectDia').prepend(createWarnBar("You miss some inputs.")); + $('#nodeTypeSelectDia').prepend(createWarnBar("Please provide a value for each missing field.")); return; } diff --git a/xCAT-UI/js/custom/customUtils.js b/xCAT-UI/js/custom/customUtils.js index efde5405d..76ac78bee 100644 --- a/xCAT-UI/js/custom/customUtils.js +++ b/xCAT-UI/js/custom/customUtils.js @@ -581,7 +581,7 @@ function quickProvision(plugin){ $('#' + containerId + ' input[type!="checkbox"]').each(function() { if (!$(this).val()) { - errorMessage = 'You are missing some inputs!'; + errorMessage = 'Please provide a value for each missing field!'; return false; } else { argsArray.push($(this).val()); diff --git a/xCAT-UI/js/custom/esx.js b/xCAT-UI/js/custom/esx.js index 903a2941d..d31b30b00 100644 --- a/xCAT-UI/js/custom/esx.js +++ b/xCAT-UI/js/custom/esx.js @@ -159,14 +159,11 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { 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.'); + var infoBar = createInfoBar('Provision an VMware virtual machine.'); provForm.append(infoBar); // Append to provision tab @@ -187,31 +184,12 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { 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); + var host = $(''); + var hostLabel = $(''); + host.append(hostLabel); + var hostInput = $(''); + host.append(hostInput); + vmFS.append(host); // Create group input var group = $(''); @@ -225,7 +203,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { var tmp = groupNames.split(','); // Create drop down for groups - var groupSelect = $(''); + var groupSelect = $(''); groupSelect.append(''); for ( var i in tmp) { // Add group into drop down @@ -251,7 +229,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { // Create memory input var memory = $(''); var memoryLabel = $(''); - var memoryInput = $(''); + var memoryInput = $(''); memory.append(memoryLabel); memory.append(memoryInput); hwFS.append(memory); @@ -276,34 +254,33 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { // Create NIC dropdown var nic = $(''); var nicLabel = $(''); - var nicSelect = $(''); - nicSelect.append('' - + '' - + '' - + '' - + '' - + '' - + '' - + '' - ); + var nicInput = $(''); nic.append(nicLabel); - nic.append(nicSelect); + nic.append(nicInput); hwFS.append(nic); // Create disk input var disk = $(''); var diskLabel = $(''); - var diskInput = $(''); - var diskSizeSelect = $(''); - diskSizeSelect.append('' - + '' + var diskInput = $(''); + var diskSizeSelect = $(''); + diskSizeSelect.append('' + + '' ); disk.append(diskLabel, diskInput, diskSizeSelect); hwFS.append(disk); + // Create disk storage input + var storage = $(''); + var storageLabel = $(''); + var storageInput = $(''); + storage.append(storageLabel); + storage.append(storageInput); + hwFS.append(storage); + // Create operating system input var os = $(''); - var osLabel = $(''); + var osLabel = $(''); var osInput = $(''); osInput.one('focus', function() { var tmp = $.cookie('osvers'); @@ -320,7 +297,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { // Create architecture input var arch = $(''); - var archLabel = $(''); + var archLabel = $(''); var archInput = $(''); archInput.one('focus', function() { var tmp = $.cookie('osarchs'); @@ -337,7 +314,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { // Create profile input var profile = $(''); - var profileLabel = $(''); + var profileLabel = $(''); var profileInput = $(''); profileInput.one('focus', function() { var tmp = $.cookie('profiles'); @@ -354,7 +331,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { // Create boot method dropdown var method = $(''); - var methodLabel = $(''); + var methodLabel = $(''); var methodSelect = $(''); methodSelect.append('' + '' @@ -375,15 +352,14 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { // Remove any warning messages $(this).parents('.ui-tabs-panel').find('.ui-state-error').remove(); var ready = true; - var errorMessage = ''; // Get tab ID - var thisTabId = $(this).parents('.ui-tabs-panel').attr('id'); - + var tabId = $(this).parents('.ui-tabs-panel').attr('id'); + // Check if fields are properly filled in - var inputs = $('#' + thisTabId + ' input:visible'); + var inputs = $('#' + tabId + ' input:visible'); for ( var i = 0; i < inputs.length; i++) { - if (!inputs.eq(i).val()) { + if (!inputs.eq(i).val() && inputs.eq(i).attr('name') != 'storage') { inputs.eq(i).css('border', 'solid #FF0000 1px'); ready = false; } else { @@ -391,7 +367,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { } } - var selects = $('#' + thisTabId + ' select:visible'); + var selects = $('#' + tabId + ' select:visible'); for ( var i = 0; i < selects.length; i++) { if (!selects.eq(i).val()) { selects.eq(i).css('border', 'solid #FF0000 1px'); @@ -400,6 +376,65 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { selects.eq(i).css('border', 'solid #BDBDBD 1px'); } } + + if (ready) { + var inst = tabId.replace('kvmProvisionTab', ''); + + // Prepend status bar + var statBar = createStatusBar('kvmProvisionStatBar' + inst); + statBar.append(createLoader('')); + statBar.prependTo($('#' + tabId)); + + var host = $('#' + tabId + ' input[name=host]').val(); + var group = $('#' + tabId + ' select[name=group]').val(); + var node = $('#' + tabId + ' input[name=node]').val(); + + var memory = $('#' + tabId + ' input[name=memory]').val(); + var cpu = $('#' + tabId + ' select[name=cpu]').val(); + var nic = $('#' + tabId + ' input[name=nic]').val(); + var disk = $('#' + tabId + ' input[name=disk]').val() + $('#' + tabId + ' select[name=diskUnit]').val(); + var storage = $('#' + tabId + ' input[name=storage]').val(); + + var os = $('#' + tabId + ' input[name=os]').val(); + var arch = $('#' + tabId + ' input[name=arch]').val(); + var profile = $('#' + tabId + ' input[name=profile]').val(); + var boot = $('#' + tabId + ' select[name=bootMethod]').val(); + + /** + * (1) Define node + */ + var args = '-t;node;-o;' + node + + ';vmhost=' + host + + ';groups=' + group + + ';vmmemory=' + memory + + ';vmcpus=' + cpu + + ';vmnics=' + nic + + ';vmstorage=' + storage + + ';os=' + os + + ';arch=' + arch + + ';profile=' + profile + + ';netboot=xnba' + + ';nodetype=osi' + + ';serialport=0' + + ';serialspeed=115200' + + ';mgt=esx'; + $.ajax( { + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'chdef', + tgt : '', + args : args, + msg : 'cmd=chdef;out=' + inst + }, + + success : updateESXProvisionStatus + }); + } else { + // Show warning message + var warn = createWarnBar('Please provide a value for each missing field.'); + warn.prependTo($(this).parent().parent()); + } }); provForm.append(provisionBtn); }; @@ -490,7 +525,7 @@ function addIdataplex(){ if (attr) { tempArray.push($(this).val()); } else { - errorMessage = "You are missing some inputs!"; + errorMessage = "Please provide a value for each missing field!"; return false; } }); @@ -568,35 +603,31 @@ function updateESXProvisionStatus(data) { var inst = args[1].replace('out=', ''); // Get provision tab and status bar ID - var statBarId = 'esxProvisionStatBar' + inst; - var tabId = 'esxProvisionTab' + inst; + var statBarId = 'kvmProvisionStatBar' + inst; + var tabId = 'kvmProvisionTab' + inst; + + var node = $('#' + tabId + ' input[name=node]').val(); /** - * (2) Remote install + * (2) Create virtual machine */ - if (cmd == 'nodeadd') { + if (cmd == 'chdef') { // 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); + var disk = $('#' + tabId + ' input[name=disk]').val() + $('#' + tabId + ' select[name=diskUnit]').val(); // Begin installation $.ajax( { url : 'lib/cmd.php', dataType : 'json', data : { - cmd : 'webrun', + cmd : 'mkvm', tgt : '', - args : 'rinstall;' + os + ';' + profile + ';' + arch + ';' + tgts, - msg : 'cmd=rinstall;out=' + inst + args : node + ';-s;' + disk, + msg : 'cmd=mkvm;out=' + inst }, success : updateESXProvisionStatus @@ -604,9 +635,57 @@ function updateESXProvisionStatus(data) { } /** - * (3) Done + * (3) Prepare node for boot */ - else if (cmd == 'rinstall') { + if (cmd == 'mkvm') { + // Write ajax response to status bar + var prg = writeRsp(rsp, ''); + $('#' + statBarId).find('div').append(prg); + + // Get provision method + var boot = $('#' + tabId + ' select[name=bootMethod]').val(); + + // Prepare node for boot + $.ajax( { + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'nodeset', + tgt : node, + args : boot, + msg : 'cmd=nodeset;out=' + inst + }, + + success : updateESXProvisionStatus + }); + } + + /** + * (4) Power on node + */ + if (cmd == 'nodeset') { + var prg = writeRsp(rsp, ''); + $('#' + statBarId).find('div').append(prg); + + // Prepare node for boot + $.ajax( { + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'rpower', + tgt : node, + args : 'on', + msg : 'cmd=rpower;out=' + inst + }, + + success : updateESXProvisionStatus + }); + } + + /** + * (5) Done + */ + else if (cmd == 'rpower') { // Write ajax response to status bar var prg = writeRsp(rsp, ''); $('#' + statBarId).find('div').append(prg); @@ -614,7 +693,7 @@ function updateESXProvisionStatus(data) { // 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.'); + $('#' + statBarId).find('div').append('
It will take several minutes before the nodes are up and ready. Use rcons to monitor the status of the install.'); } } } \ No newline at end of file diff --git a/xCAT-UI/js/custom/hmc.js b/xCAT-UI/js/custom/hmc.js index ba0ce1e61..5b04ac68e 100644 --- a/xCAT-UI/js/custom/hmc.js +++ b/xCAT-UI/js/custom/hmc.js @@ -371,7 +371,7 @@ function addHmcNode(){ var args = ''; $('#pnodeeditarea input').each(function(){ if (!$(this).val()){ - errorinfo = 'You are missing some inputs!'; + errorinfo = 'Please provide a value for each missing field!'; } args += $(this).val() + ','; }); diff --git a/xCAT-UI/js/custom/ipmi.js b/xCAT-UI/js/custom/ipmi.js index cdda330c8..a18767e4e 100644 --- a/xCAT-UI/js/custom/ipmi.js +++ b/xCAT-UI/js/custom/ipmi.js @@ -263,7 +263,7 @@ function addIdataplex(){ if (attr) { tempArray.push($(this).val()); } else { - errorMessage = "You are missing some inputs!"; + errorMessage = "Please provide a value for each missing field!"; return false; } }); diff --git a/xCAT-UI/js/custom/kvm.js b/xCAT-UI/js/custom/kvm.js index 4276ce400..399ad2276 100644 --- a/xCAT-UI/js/custom/kvm.js +++ b/xCAT-UI/js/custom/kvm.js @@ -525,7 +525,7 @@ function addIdataplex(){ if (attr) { tempArray.push($(this).val()); } else { - errorMessage = "You are missing some inputs!"; + errorMessage = "Please provide a value for each missing field!"; return false; } }); diff --git a/xCAT-UI/js/custom/zvm.js b/xCAT-UI/js/custom/zvm.js index 207100c36..2ed46568f 100644 --- a/xCAT-UI/js/custom/zvm.js +++ b/xCAT-UI/js/custom/zvm.js @@ -503,10 +503,21 @@ zvmPlugin.prototype.loadClonePage = function(node) { var cloneForm = $(''); cloneForm.append(statBar); cloneForm.append(infoBar); - cloneForm.append(''); - cloneForm.append(''); - cloneForm.append(''); - cloneForm.append(''); + + var vmFS = $(''); + var vmLegend = $(''); + vmFS.append(vmLegend); + cloneForm.append(vmFS); + + var hwFS = $(''); + var hwLegend = $(''); + hwFS.append(hwLegend); + cloneForm.append(hwFS); + + vmFS.append(''); + vmFS.append(''); + vmFS.append(''); + vmFS.append(''); // Create group input var group = $(''); @@ -523,7 +534,7 @@ zvmPlugin.prototype.loadClonePage = function(node) { }); group.append(groupLabel); group.append(groupInput); - cloneForm.append(group); + vmFS.append(group); // Get list of disk pools var temp = hcp.split('.'); @@ -537,9 +548,9 @@ zvmPlugin.prototype.loadClonePage = function(node) { }); poolDiv.append(poolLabel); poolDiv.append(poolInput); - cloneForm.append(poolDiv); + hwFS.append(poolDiv); - cloneForm.append(''); + hwFS.append(''); // Generate tooltips cloneForm.find('div input[title]').tooltip({ @@ -582,7 +593,7 @@ zvmPlugin.prototype.loadClonePage = function(node) { // Write error message if (!ready) { - errMsg = errMsg + 'You are missing some inputs.
' + msg + '