From 17298c84b70357455189be45513c487f9f7c9ee9 Mon Sep 17 00:00:00 2001 From: phamt Date: Mon, 19 Dec 2011 05:03:27 +0000 Subject: [PATCH] Fixed gennodename() to handle VLSM. Fixed provision page layouts. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11265 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-UI/js/custom/blade.js | 32 +++++++-- xCAT-UI/js/custom/esx.js | 41 ++++++++---- xCAT-UI/js/custom/ipmi.js | 32 +++++++-- xCAT-UI/js/custom/kvm.js | 39 +++++++---- xCAT-UI/js/custom/zvm.js | 24 +++++-- xCAT-UI/js/custom/zvmUtils.js | 59 +++++++++++----- xCAT-UI/js/help/help.js | 6 +- xCAT-UI/js/monitor/monitor.js | 23 +++++-- xCAT-UI/js/nodes/nodes.js | 46 +++++++++++-- xCAT-UI/js/provision/provision.js | 12 ++-- xCAT-UI/js/service/service.js | 40 +++++++---- xCAT-UI/xcat/plugins/webportal.pm | 107 ++++++++++++++++++++++++++++-- 12 files changed, 361 insertions(+), 100 deletions(-) diff --git a/xCAT-UI/js/custom/blade.js b/xCAT-UI/js/custom/blade.js index 3881cc78c..d6390f850 100644 --- a/xCAT-UI/js/custom/blade.js +++ b/xCAT-UI/js/custom/blade.js @@ -592,6 +592,26 @@ function createBladeProvisionExisting(inst) { // Create provision existing division var provExisting = $('
'); + // Create VM fieldset + var nodeFS = $('
'); + var nodeLegend = $('Node'); + nodeFS.append(nodeLegend); + + var nodeAttr = $('
'); + nodeFS.append($('
')); + nodeFS.append(nodeAttr); + + // Create image fieldset + var imgFS = $('
'); + var imgLegend = $('Image'); + imgFS.append(imgLegend); + + var imgAttr = $('
'); + imgFS.append($('
')); + imgFS.append(imgAttr); + + provExisting.append(nodeFS, imgFS); + // Create group input var group = $('
'); var groupLabel = $(''); @@ -628,7 +648,7 @@ function createBladeProvisionExisting(inst) { var groupInput = $(''); group.append(groupInput); } - provExisting.append(group); + nodeAttr.append(group); // Create node input var node = $('
'); @@ -636,7 +656,7 @@ function createBladeProvisionExisting(inst) { var nodeDatatable = $('

Select a group to view its nodes

'); node.append(nodeLabel); node.append(nodeDatatable); - provExisting.append(node); + nodeAttr.append(node); // Create boot method drop down var method = $('
'); @@ -651,7 +671,7 @@ function createBladeProvisionExisting(inst) { ); method.append(methodLabel); method.append(methodSelect); - provExisting.append(method); + imgAttr.append(method); // Create operating system input var os = $('
'); @@ -668,7 +688,7 @@ function createBladeProvisionExisting(inst) { }); os.append(osLabel); os.append(osInput); - provExisting.append(os); + imgAttr.append(os); // Create architecture input var arch = $('
'); @@ -685,7 +705,7 @@ function createBladeProvisionExisting(inst) { }); arch.append(archLabel); arch.append(archInput); - provExisting.append(arch); + imgAttr.append(arch); // Create profile input var profile = $('
'); @@ -702,7 +722,7 @@ function createBladeProvisionExisting(inst) { }); profile.append(profileLabel); profile.append(profileInput); - provExisting.append(profile); + imgAttr.append(profile); /** * Provision existing diff --git a/xCAT-UI/js/custom/esx.js b/xCAT-UI/js/custom/esx.js index d31b30b00..f943ddfd4 100644 --- a/xCAT-UI/js/custom/esx.js +++ b/xCAT-UI/js/custom/esx.js @@ -163,24 +163,39 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { var provForm = $('
'); // Create info bar - var infoBar = createInfoBar('Provision an VMware virtual machine.'); + var infoBar = createInfoBar('Provision an KVM virtual machine.'); provForm.append(infoBar); // Append to provision tab $('#' + tabId).append(provForm); + // Create VM fieldset var vmFS = $('
'); var vmLegend = $('Virtual Machine'); vmFS.append(vmLegend); + var vmAttr = $('
'); + vmFS.append($('
')); + vmFS.append(vmAttr); + + // Create hardware fieldset var hwFS = $('
'); var hwLegend = $('Hardware'); hwFS.append(hwLegend); + var hwAttr = $('
'); + hwFS.append($('
')); + hwFS.append(hwAttr); + + // Create image fieldset var imgFS = $('
'); var imgLegend = $('Image'); imgFS.append(imgLegend); + var imgAttr = $('
'); + imgFS.append($('
')); + imgFS.append(imgAttr); + provForm.append(vmFS, hwFS, imgFS); // Create hypervisor input @@ -189,7 +204,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { host.append(hostLabel); var hostInput = $(''); host.append(hostInput); - vmFS.append(host); + vmAttr.append(host); // Create group input var group = $('
'); @@ -216,7 +231,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { var groupInput = $(''); group.append(groupInput); } - vmFS.append(group); + vmAttr.append(group); // Create node input var node = $('
'); @@ -224,7 +239,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { var nodeInput = $(''); node.append(nodeLabel); node.append(nodeInput); - vmFS.append(node); + vmAttr.append(node); // Create memory input var memory = $('
'); @@ -232,7 +247,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { var memoryInput = $(''); memory.append(memoryLabel); memory.append(memoryInput); - hwFS.append(memory); + hwAttr.append(memory); // Create processor dropdown var cpu = $('
'); @@ -249,7 +264,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { ); cpu.append(cpuLabel); cpu.append(cpuSelect); - hwFS.append(cpu); + hwAttr.append(cpu); // Create NIC dropdown var nic = $('
'); @@ -257,7 +272,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { var nicInput = $(''); nic.append(nicLabel); nic.append(nicInput); - hwFS.append(nic); + hwAttr.append(nic); // Create disk input var disk = $('
'); @@ -268,7 +283,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { '' ); disk.append(diskLabel, diskInput, diskSizeSelect); - hwFS.append(disk); + hwAttr.append(disk); // Create disk storage input var storage = $('
'); @@ -276,7 +291,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { var storageInput = $(''); storage.append(storageLabel); storage.append(storageInput); - hwFS.append(storage); + hwAttr.append(storage); // Create operating system input var os = $('
'); @@ -293,7 +308,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { }); os.append(osLabel); os.append(osInput); - imgFS.append(os); + imgAttr.append(os); // Create architecture input var arch = $('
'); @@ -310,7 +325,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { }); arch.append(archLabel); arch.append(archInput); - imgFS.append(arch); + imgAttr.append(arch); // Create profile input var profile = $('
'); @@ -327,7 +342,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { }); profile.append(profileLabel); profile.append(profileInput); - imgFS.append(profile); + imgAttr.append(profile); // Create boot method dropdown var method = $('
'); @@ -342,7 +357,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { ); method.append(methodLabel); method.append(methodSelect); - imgFS.append(method); + imgAttr.append(method); /** * Provision existing diff --git a/xCAT-UI/js/custom/ipmi.js b/xCAT-UI/js/custom/ipmi.js index a18767e4e..178fdcd07 100644 --- a/xCAT-UI/js/custom/ipmi.js +++ b/xCAT-UI/js/custom/ipmi.js @@ -334,6 +334,26 @@ function createIpmiProvisionExisting(inst) { // Create provision existing division var provExisting = $('
'); + // Create VM fieldset + var nodeFS = $('
'); + var nodeLegend = $('Node'); + nodeFS.append(nodeLegend); + + var nodeAttr = $('
'); + nodeFS.append($('
')); + nodeFS.append(nodeAttr); + + // Create image fieldset + var imgFS = $('
'); + var imgLegend = $('Image'); + imgFS.append(imgLegend); + + var imgAttr = $('
'); + imgFS.append($('
')); + imgFS.append(imgAttr); + + provExisting.append(nodeFS, imgFS); + // Create group input var group = $('
'); var groupLabel = $(''); @@ -370,7 +390,7 @@ function createIpmiProvisionExisting(inst) { var groupInput = $(''); group.append(groupInput); } - provExisting.append(group); + nodeAttr.append(group); // Create node input var node = $('
'); @@ -378,7 +398,7 @@ function createIpmiProvisionExisting(inst) { var nodeDatatable = $('

Select a group to view its nodes

'); node.append(nodeLabel); node.append(nodeDatatable); - provExisting.append(node); + nodeAttr.append(node); // Create boot method drop down var method = $('
'); @@ -393,7 +413,7 @@ function createIpmiProvisionExisting(inst) { ); method.append(methodLabel); method.append(methodSelect); - provExisting.append(method); + imgAttr.append(method); // Create operating system input var os = $('
'); @@ -410,7 +430,7 @@ function createIpmiProvisionExisting(inst) { }); os.append(osLabel); os.append(osInput); - provExisting.append(os); + imgAttr.append(os); // Create architecture input var arch = $('
'); @@ -427,7 +447,7 @@ function createIpmiProvisionExisting(inst) { }); arch.append(archLabel); arch.append(archInput); - provExisting.append(arch); + imgAttr.append(arch); // Create profile input var profile = $('
'); @@ -444,7 +464,7 @@ function createIpmiProvisionExisting(inst) { }); profile.append(profileLabel); profile.append(profileInput); - provExisting.append(profile); + imgAttr.append(profile); /** * Provision existing diff --git a/xCAT-UI/js/custom/kvm.js b/xCAT-UI/js/custom/kvm.js index 399ad2276..bd48a855a 100644 --- a/xCAT-UI/js/custom/kvm.js +++ b/xCAT-UI/js/custom/kvm.js @@ -169,18 +169,33 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) { // Append to provision tab $('#' + tabId).append(provForm); + // Create VM fieldset var vmFS = $('
'); var vmLegend = $('Virtual Machine'); vmFS.append(vmLegend); + var vmAttr = $('
'); + vmFS.append($('
')); + vmFS.append(vmAttr); + + // Create hardware fieldset var hwFS = $('
'); var hwLegend = $('Hardware'); hwFS.append(hwLegend); + var hwAttr = $('
'); + hwFS.append($('
')); + hwFS.append(hwAttr); + + // Create image fieldset var imgFS = $('
'); var imgLegend = $('Image'); imgFS.append(imgLegend); + var imgAttr = $('
'); + imgFS.append($('
')); + imgFS.append(imgAttr); + provForm.append(vmFS, hwFS, imgFS); // Create hypervisor input @@ -189,7 +204,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) { host.append(hostLabel); var hostInput = $(''); host.append(hostInput); - vmFS.append(host); + vmAttr.append(host); // Create group input var group = $('
'); @@ -216,7 +231,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) { var groupInput = $(''); group.append(groupInput); } - vmFS.append(group); + vmAttr.append(group); // Create node input var node = $('
'); @@ -224,7 +239,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) { var nodeInput = $(''); node.append(nodeLabel); node.append(nodeInput); - vmFS.append(node); + vmAttr.append(node); // Create memory input var memory = $('
'); @@ -232,7 +247,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) { var memoryInput = $(''); memory.append(memoryLabel); memory.append(memoryInput); - hwFS.append(memory); + hwAttr.append(memory); // Create processor dropdown var cpu = $('
'); @@ -249,7 +264,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) { ); cpu.append(cpuLabel); cpu.append(cpuSelect); - hwFS.append(cpu); + hwAttr.append(cpu); // Create NIC dropdown var nic = $('
'); @@ -257,7 +272,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) { var nicInput = $(''); nic.append(nicLabel); nic.append(nicInput); - hwFS.append(nic); + hwAttr.append(nic); // Create disk input var disk = $('
'); @@ -268,7 +283,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) { '' ); disk.append(diskLabel, diskInput, diskSizeSelect); - hwFS.append(disk); + hwAttr.append(disk); // Create disk storage input var storage = $('
'); @@ -276,7 +291,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) { var storageInput = $(''); storage.append(storageLabel); storage.append(storageInput); - hwFS.append(storage); + hwAttr.append(storage); // Create operating system input var os = $('
'); @@ -293,7 +308,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) { }); os.append(osLabel); os.append(osInput); - imgFS.append(os); + imgAttr.append(os); // Create architecture input var arch = $('
'); @@ -310,7 +325,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) { }); arch.append(archLabel); arch.append(archInput); - imgFS.append(arch); + imgAttr.append(arch); // Create profile input var profile = $('
'); @@ -327,7 +342,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) { }); profile.append(profileLabel); profile.append(profileInput); - imgFS.append(profile); + imgAttr.append(profile); // Create boot method dropdown var method = $('
'); @@ -342,7 +357,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) { ); method.append(methodLabel); method.append(methodSelect); - imgFS.append(method); + imgAttr.append(method); /** * Provision existing diff --git a/xCAT-UI/js/custom/zvm.js b/xCAT-UI/js/custom/zvm.js index 2ed46568f..5befb9c14 100644 --- a/xCAT-UI/js/custom/zvm.js +++ b/xCAT-UI/js/custom/zvm.js @@ -504,20 +504,30 @@ zvmPlugin.prototype.loadClonePage = function(node) { cloneForm.append(statBar); cloneForm.append(infoBar); + // Create VM fieldset var vmFS = $('
'); var vmLegend = $('Virtual Machine'); vmFS.append(vmLegend); cloneForm.append(vmFS); + var vmAttr = $('
'); + vmFS.append($('
')); + vmFS.append(vmAttr); + + // Create hardware fieldset var hwFS = $('
'); var hwLegend = $('Hardware'); hwFS.append(hwLegend); cloneForm.append(hwFS); - vmFS.append('
'); - vmFS.append('
'); - vmFS.append('
'); - vmFS.append('
'); + var hwAttr = $('
'); + hwFS.append($('
')); + hwFS.append(hwAttr); + + vmAttr.append('
'); + vmAttr.append('
'); + vmAttr.append('
'); + vmAttr.append('
'); // Create group input var group = $('
'); @@ -534,7 +544,7 @@ zvmPlugin.prototype.loadClonePage = function(node) { }); group.append(groupLabel); group.append(groupInput); - vmFS.append(group); + vmAttr.append(group); // Get list of disk pools var temp = hcp.split('.'); @@ -548,9 +558,9 @@ zvmPlugin.prototype.loadClonePage = function(node) { }); poolDiv.append(poolLabel); poolDiv.append(poolInput); - hwFS.append(poolDiv); + hwAttr.append(poolDiv); - hwFS.append('
'); + hwAttr.append('
'); // Generate tooltips cloneForm.find('div input[title]').tooltip({ diff --git a/xCAT-UI/js/custom/zvmUtils.js b/xCAT-UI/js/custom/zvmUtils.js index 86b5cb26c..eeb54d887 100644 --- a/xCAT-UI/js/custom/zvmUtils.js +++ b/xCAT-UI/js/custom/zvmUtils.js @@ -1160,7 +1160,7 @@ function openAddProcDialog(node) { // If inputs are not complete, show warning message if (!node || !address || !type) { - var warn = createWarnBar('You are missing inputs.'); + var warn = createWarnBar('Please provide a value for each missing field.'); warn.prependTo($(this)); } else { // Add processor @@ -1269,7 +1269,7 @@ function openAddDiskDialog(node, hcp) { // If inputs are not complete, show warning message if (!node || !type || !address || !size || !pool || !mode) { - var warn = createWarnBar('You are missing inputs.'); + var warn = createWarnBar('Please provide a value for each missing field.'); warn.prependTo($(this)); } else { // Add disk @@ -1500,7 +1500,7 @@ function openAddNicDialog(node, hcp) { // If inputs are not complete, show warning message if (!node || !nicType || !networkType || !address) { - errMsg = 'You are missing inputs.
'; + errMsg = 'Please provide a value for each missing field.
'; ready = false; } @@ -1993,10 +1993,18 @@ function createZProvisionExisting(inst) { vmFS.append(vmLegend); provExisting.append(vmFS); + var vmAttr = $('
'); + vmFS.append($('
')); + vmFS.append(vmAttr); + var osFS = $('
'); var osLegend = $('Operating System'); osFS.append(osLegend); provExisting.append(osFS); + + var osAttr = $('
'); + osFS.append($('
')); + osFS.append(osAttr); // Create group input var group = $('
'); @@ -2033,16 +2041,16 @@ function createZProvisionExisting(inst) { var groupInput = $(''); group.append(groupInput); } - vmFS.append(group); + vmAttr.append(group); // Create node input var node = $('
'); var nodeLabel = $(''); - var nodeDatatable = $('

Select a group to view its nodes

'); + var nodeDatatable = $('

Select a group to view its nodes

'); node.append(nodeLabel); node.append(nodeDatatable); - vmFS.append(node); - + vmAttr.append(node); + // Create operating system image input var os = $('
'); var osLabel = $(''); @@ -2059,7 +2067,7 @@ function createZProvisionExisting(inst) { }); os.append(osLabel); os.append(osInput); - osFS.append(os); + osAttr.append(os); // Create boot method drop down var bootMethod = $('
'); @@ -2073,7 +2081,7 @@ function createZProvisionExisting(inst) { ); bootMethod.append(methoddLabel); bootMethod.append(methodSelect); - osFS.append(bootMethod); + osAttr.append(bootMethod); // Generate tooltips provExisting.find('div input[title]').tooltip({ @@ -2184,22 +2192,37 @@ function createZProvisionExisting(inst) { function createZProvisionNew(inst) { // Create provision new node division var provNew = $('
'); - + + // Create VM fieldset var vmFS = $('
'); var vmLegend = $('Virtual Machine'); vmFS.append(vmLegend); provNew.append(vmFS); + var vmAttr = $('
'); + vmFS.append($('
')); + vmFS.append(vmAttr); + + // Create hardware fieldset var hwFS = $('
'); var hwLegend = $('Hardware'); hwFS.append(hwLegend); provNew.append(hwFS); + var hwAttr = $('
'); + hwFS.append($('
')); + hwFS.append(hwAttr); + + // Create OS fieldset var osFS = $('
'); var osLegend = $('Operating System'); osFS.append(osLegend); provNew.append(osFS); + var osAttr = $('
'); + osFS.append($('
')); + osFS.append(osAttr); + // Create group input var group = $('
'); var groupLabel = $(''); @@ -2216,7 +2239,7 @@ function createZProvisionNew(inst) { }); group.append(groupLabel); group.append(groupInput); - vmFS.append(group); + vmAttr.append(group); // Create node input var nodeName = $('
'); @@ -2224,11 +2247,11 @@ function createZProvisionNew(inst) { var nodeInput = $(''); nodeName.append(nodeLabel); nodeName.append(nodeInput); - vmFS.append(nodeName); + vmAttr.append(nodeName); // Create user ID input var userId = $('
'); - vmFS.append(userId); + vmAttr.append(userId); // Create hardware control point input var hcpDiv = $('
'); @@ -2256,7 +2279,7 @@ function createZProvisionNew(inst) { }); hcpDiv.append(hcpLabel); hcpDiv.append(hcpInput); - vmFS.append(hcpDiv); + vmAttr.append(hcpDiv); // Create operating system image input var os = $('
'); @@ -2274,7 +2297,7 @@ function createZProvisionNew(inst) { }); os.append(osLabel); os.append(osInput); - osFS.append(os); + osAttr.append(os); // Create user entry input var defaultChkbox = $('').click(function() { @@ -2339,7 +2362,7 @@ function createZProvisionNew(inst) { }); var userEntry = $('
'); userEntry.append($('').append(defaultChkbox, 'Use default')); - hwFS.append(userEntry); + hwAttr.append(userEntry); // Create disk table var diskDiv = $('
'); @@ -2451,7 +2474,7 @@ function createZProvisionNew(inst) { diskDiv.append(diskLabel); diskDiv.append(diskTable); - hwFS.append(diskDiv); + hwAttr.append(diskDiv); // Generate tooltips provNew.find('div input[title]').tooltip({ @@ -2510,7 +2533,7 @@ function createZProvisionNew(inst) { // Show error message for missing inputs if (!ready) { - errMsg = errMsg + 'You are missing inputs.
'; + errMsg = errMsg + 'Please provide a value for each missing field.
'; } // Check if user entry contains user ID diff --git a/xCAT-UI/js/help/help.js b/xCAT-UI/js/help/help.js index c04f58e51..9a06f8a1d 100644 --- a/xCAT-UI/js/help/help.js +++ b/xCAT-UI/js/help/help.js @@ -9,7 +9,8 @@ function loadHelpPage(){ helpForm.append( '
' + 'Quick Start' + - '
    ' + + '
    ' + + '
      ' + '
    1. 1. Discover hardware
      Discover all hardware in the cluster. Define them in the xCAT database. Initialize your cluster.
    2. ' + '
    3. 2. Verify defined nodes
      View nodes definition by groups in a table or graphical style.
    4. ' + '
    5. 3. Install compute nodes
      Copy useful files from DVD onto harddisk. Create Linux images. Install compute nodes in stateful, stateless, and statelite style.
    6. ' + @@ -19,7 +20,8 @@ function loadHelpPage(){ '
' + '
' + 'Advanced' + - '
    ' + + '
    ' + + '
      ' + '
    1. a. Edit the xCAT database tables
    2. ' + '
    3. b. Update the xCAT RPM on the Management Node
    4. ' + '
    ' + diff --git a/xCAT-UI/js/monitor/monitor.js b/xCAT-UI/js/monitor/monitor.js index 01d89240b..c7b6daaf3 100644 --- a/xCAT-UI/js/monitor/monitor.js +++ b/xCAT-UI/js/monitor/monitor.js @@ -182,15 +182,20 @@ function loadMonitorPage() { // Create radio buttons for platforms var hwList = $('
      Platforms available:
    '); - var ipmi = $('
  1. iDataPlex
  2. '); + var esx = $('
  3. ESX
  4. '); + var kvm = $('
  5. KVM
  6. '); + var zvm = $('
  7. z\/VM
  8. '); + var ipmi = $('
  9. iDataPlex
  10. '); var blade = $('
  11. BladeCenter
  12. '); var hmc = $('
  13. System p
  14. '); - var zvm = $('
  15. System z
  16. '); - - hwList.append(ipmi); - hwList.append(blade); - hwList.append(hmc); + + hwList.append(esx); + hwList.append(kvm); hwList.append(zvm); + hwList.append(blade); + hwList.append(ipmi); + hwList.append(hmc); + resrcForm.append(hwList); var okBtn = createButton('Ok'); @@ -208,6 +213,12 @@ function loadMonitorPage() { // Create an instance of the plugin var plugin; switch (hw) { + case "kvm": + plugin = new kvmPlugin(); + break; + case "esx": + plugin = new esxPlugin(); + break; case "blade": plugin = new bladePlugin(); break; diff --git a/xCAT-UI/js/nodes/nodes.js b/xCAT-UI/js/nodes/nodes.js index c382573fe..42e647206 100644 --- a/xCAT-UI/js/nodes/nodes.js +++ b/xCAT-UI/js/nodes/nodes.js @@ -380,10 +380,12 @@ function mkAddNodeLink() { addNodeForm.append(info); addNodeForm.append('
    ' + '' + '
    '); @@ -439,6 +441,12 @@ function mkAddNodeLink() { var plugin; switch(mgt) { + case "kvm": + plugin = new kvmPlugin(); + break; + case "esx": + plugin = new esxPlugin(); + break; case "blade": plugin = new bladePlugin(); break; @@ -1874,6 +1882,10 @@ function sortAlpha(a, b) { * @return Nothing */ function powerNode(node, power2) { + // Show power loader + var powerCol = $('#' + nodesTableId + '_wrapper .dataTables_scrollHead .datatable thead tr th:eq(3)'); + powerCol.find('img').show(); + node = node.replace('Power', ''); $.ajax( { url : 'lib/cmd.php', @@ -2081,6 +2093,10 @@ function updateStatusBar(data) { * @return Nothing */ function updatePowerStatus(data) { + // Hide power loader + var powerCol = $('#' + nodesTableId + '_wrapper .dataTables_scrollHead .datatable thead tr th:eq(3)'); + powerCol.find('img').hide(); + // Get datatable var dTable = $('#' + nodesTableId).dataTable(); @@ -3025,6 +3041,10 @@ function openSetAttrsDialog() { * @return Nothing */ function monitorNode(node, monitor) { + // Show ganglia loader + var gangliaCol = $('#' + nodesTableId + '_wrapper .dataTables_scrollHead .datatable thead tr th:eq(4)'); + gangliaCol.find('img').show(); + if (monitor == 'on') { // Append loader to warning bar var warningBar = $('#nodesTab').find('.ui-state-error p'); @@ -3084,13 +3104,27 @@ function monitorNode(node, monitor) { data : { cmd : 'webrun', tgt : '', - args : 'gangliastart;' + data.msg, - msg : '' + args : 'gangliastart;' + data.msg + ';-r', + msg : data.msg }, success : function(data) { // Remove any warnings $('#nodesTab').find('.ui-state-error').remove(); + + // Update datatable + $.ajax( { + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'webrun', + tgt : '', + args : 'gangliastatus;' + data.msg, + msg : '' + }, + + success : loadGangliaStatus + }); } }); } // End of if (warn) @@ -3116,7 +3150,7 @@ function monitorNode(node, monitor) { } else { var args; if (node) { - args = 'gangliastop;' + node; + args = 'gangliastop;' + node + ';-r'; } else { args = 'gangliastop'; } @@ -3132,7 +3166,9 @@ function monitorNode(node, monitor) { }, success : function(data) { - // Do nothing + // Hide ganglia loader + var gangliaCol = $('#' + nodesTableId + '_wrapper .dataTables_scrollHead .datatable thead tr th:eq(4)'); + gangliaCol.find('img').hide(); } }); } diff --git a/xCAT-UI/js/provision/provision.js b/xCAT-UI/js/provision/provision.js index b505d6fdb..eb00921ba 100644 --- a/xCAT-UI/js/provision/provision.js +++ b/xCAT-UI/js/provision/provision.js @@ -85,17 +85,17 @@ function loadProvisionPage() { var hwList = $('
      Platforms available:
    '); var esx = $('
  17. ESX
  18. '); var kvm = $('
  19. KVM
  20. '); + var zvm = $('
  21. z\/VM
  22. '); var ipmi = $('
  23. iDataPlex
  24. '); var blade = $('
  25. BladeCenter
  26. '); var hmc = $('
  27. System p
  28. '); - var zvm = $('
  29. System z
  30. '); - + hwList.append(esx); hwList.append(kvm); - hwList.append(ipmi); - hwList.append(blade); - hwList.append(hmc); hwList.append(zvm); + hwList.append(blade); + hwList.append(ipmi); + hwList.append(hmc); provPg.append(hwList); /** @@ -140,7 +140,7 @@ function loadProvisionPage() { break; case "zvm": plugin = new zvmPlugin(); - title = 'System z'; + title = 'z/VM'; break; } diff --git a/xCAT-UI/js/service/service.js b/xCAT-UI/js/service/service.js index a30f7533d..49bc12b9c 100644 --- a/xCAT-UI/js/service/service.js +++ b/xCAT-UI/js/service/service.js @@ -175,14 +175,12 @@ function loadServiceProvisionPage(tabId) { // Create radio buttons for platforms var hwList = $('
      Platforms available:
    '); - var ipmi = $('
  31. iDataPlex
  32. '); - var blade = $('
  33. BladeCenter
  34. '); - var hmc = $('
  35. System p
  36. '); - var zvm = $('
  37. System z
  38. '); - - hwList.append(ipmi); - hwList.append(blade); - hwList.append(hmc); + var esx = $('
  39. ESX
  40. '); + var kvm = $('
  41. KVM
  42. '); + var zvm = $('
  43. z\/VM
  44. '); + + hwList.append(esx); + hwList.append(kvm); hwList.append(zvm); provPg.append(hwList); @@ -215,6 +213,14 @@ function loadServiceProvisionPage(tabId) { // Create an instance of the plugin var plugin; switch (hw) { + case "kvm": + plugin = new kvmPlugin(); + title = 'KVM'; + break; + case "esx": + plugin = new esxPlugin(); + title = 'ESX'; + break; case "blade": plugin = new bladePlugin(); title = 'BladeCenter'; @@ -229,7 +235,7 @@ function loadServiceProvisionPage(tabId) { break; case "zvm": plugin = new zvmPlugin(); - title = 'System z'; + title = 'z/VM'; // Get zVM host names if (!$.cookie('srv_zvm')){ @@ -897,15 +903,25 @@ function setGroupCookies(data) { var groups = new Array(); // Index 0 is the table header - var cols, name, ip, hostname, desc; - for ( var i = 1; i < data.rsp.length; i++) { + var cols, name, ip, hostname, desc, comments, tmp; + for (var i = 1; i < data.rsp.length; i++) { // Split into columns: // node, ip, hostnames, otherinterfaces, comments, disable cols = data.rsp[i].split(','); name = cols[0].replace(new RegExp('"', 'g'), ''); ip = cols[1].replace(new RegExp('"', 'g'), ''); hostname = cols[2].replace(new RegExp('"', 'g'), ''); - desc = cols[4].replace(new RegExp('"', 'g'), ''); + + // It should return: "description: All machines; network: 10.1.100.0/24;" + comments = cols[4].replace(new RegExp('"', 'g'), ''); + tmp = comments.split(';'); + for (var j = 0; j < tmp.length; j++) { + if (tmp[j].indexOf('description:') > -1) { + desc = tmp[j].replace('description:', ''); + desc = jQuery.trim(desc); + } + } + groups.push(name + ':' + ip + ':' + hostname + ':' + desc); } diff --git a/xCAT-UI/xcat/plugins/webportal.pm b/xCAT-UI/xcat/plugins/webportal.pm index 3ebbb903e..e2b38dc7d 100644 --- a/xCAT-UI/xcat/plugins/webportal.pm +++ b/xCAT-UI/xcat/plugins/webportal.pm @@ -356,10 +356,13 @@ sub gennodename { my $hostname_regex; my $ipaddr_regex; + my @comments; my $base_digit = 0; my $base_hostname; my $base_ipaddr; + my $network = ""; + my $mask; my $hostname; my $ipaddr; my $tmp; @@ -368,7 +371,7 @@ sub gennodename { # Get regular expression for hostname in 'hosts' table my $tab = xCAT::Table->new( 'hosts', -create => 1, -autocommit => 0 ); - my @results = $tab->getAllAttribsWhere( "node='" . $group . "'", 'ip' ); + my @results = $tab->getAllAttribsWhere( "node='" . $group . "'", 'ip', 'comments' ); foreach (@results) { # It should return: |gpok(\d+)|10.1.100.($1+0)| @@ -385,9 +388,36 @@ sub gennodename { # Get the ($1+0) $ipaddr_regex =~ s/$base_ipaddr//g; - } - + + # Get the network within comments + # It should return: "description: All machines; network: 10.1.100.0/24;" + # This will help determine the 1st node in the group if none exists + @comments = split( /;/, $_->{'comments'} ); + foreach (@comments) { + if ($_ =~ m/network:/i) { + $network = $_; + + # Remove network header + $network =~ s/network://g; + + # Trim network section + $network =~ s/\s*$//; + $network =~ s/^\s*//; + + # Extract network + $tmp = rindex($network, '/'); + if ($tmp > -1) { + $network = substr($network, 0, $tmp); + } + + # Extract base digit, which depends on the netmask used + $base_digit = substr($network, rindex($network, '.') + 1); + } + } # End of foreach + } # End of foreach + # Are there nodes in this group already? + # If so, use the existing nodes as a base my $out = `nodels $group`; @args = split( /\n/, $out ); foreach (@args) { @@ -411,10 +441,73 @@ sub gennodename { $ipaddr =~ s/$hostname_regex/$ipaddr_regex/gee; $ipaddr = $base_ipaddr . $ipaddr; + # Get networks in 'networks' table + $tab = xCAT::Table->new( 'networks', -create => 1, -autocommit => 0 ); + my $entries = $tab->getAllEntries(); + + # Go through each network + my $iprange; + foreach (@$entries) { + + # Get network, mask, and range + $network = $_->{'net'}; + $mask = $_->{'mask'}; + $iprange = $_->{'dynamicrange'}; + + # If the host IP address is in this subnet, return + if (xCAT::NetworkUtils->ishostinsubnet($ipaddr, $mask, $network)) { + + # Exit loop + last; + } else { + $network = ""; + } + } + + # Exit if no network exist for group + if (!$network) { + return; + } + + # Find the network range for this group + my @ranges; + my $iprange_low = 1; + my $iprange_high = 254; + if ($iprange) { + @args = split( /;/, $iprange ); + foreach (@args) { + # If a network range exists + if ($_ =~ m/-/) { + @ranges = split( /-/, $_ ); + $iprange_low = $ranges[0]; + $iprange_high = $ranges[1]; + + # Get the low and high ends digit + $iprange_low =~ s/$base_ipaddr//g; + $iprange_high =~ s/$base_ipaddr//g; + } + } + } # End of if ($iprange) + + # If no nodes exist in group + # Set the base digit to the low end of the network range + if ($iprange_low && $base_digit == 1) { + $base_digit = $iprange_low; + + # Generate hostname + $hostname = $base_hostname; + $hostname =~ s/#/$base_digit/g; + + # Generate IP address + $ipaddr = $hostname; + $ipaddr =~ s/$hostname_regex/$ipaddr_regex/gee; + $ipaddr = $base_ipaddr . $ipaddr; + } + # Check xCAT tables, /etc/hosts, and ping to see if hostname is already used - while (`nodels $hostname` || `cat /etc/hosts | grep "$ipaddr "` || !(`ping -c 4 $ipaddr` =~ m/Destination Host Unreachable/)) { + while (`nodels $hostname` || `cat /etc/hosts | grep "$ipaddr "` || !(`ping -c 4 $ipaddr` =~ m/100% packet loss/)) { # Base digit invalid if over 254 - if ($base_digit > 254) { + if ($base_digit > $iprange_high) { last; } @@ -429,8 +522,8 @@ sub gennodename { $ipaddr = $base_ipaddr . $ipaddr; } - # Range must be between 1-255 - if ($base_digit > 254) { + # Range must be within network range + if ($base_digit > $iprange_high) { return; } else { return ($hostname, $ipaddr, $base_digit);