From a21935e9c747e6068de35653b0251e07c68f657a Mon Sep 17 00:00:00 2001 From: phamt Date: Fri, 26 Apr 2013 20:19:37 +0000 Subject: [PATCH] Enabled multiple volumes to be removed. Allowed delete button to delete using noderm instead of rmvm if checked. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@16085 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-UI/js/custom/zvmUtils.js | 23 ++++++++++++++++++----- xCAT-UI/js/nodes/nodes.js | 19 +++++++++++++++++-- xCAT-server/lib/xcat/plugins/zvm.pm | 7 ++++++- 3 files changed, 41 insertions(+), 8 deletions(-) diff --git a/xCAT-UI/js/custom/zvmUtils.js b/xCAT-UI/js/custom/zvmUtils.js index 6c30ee78d..14f78c8db 100644 --- a/xCAT-UI/js/custom/zvmUtils.js +++ b/xCAT-UI/js/custom/zvmUtils.js @@ -3475,7 +3475,7 @@ function loadDiskPoolTable(data) { var actionBar = $('
').css("width", "450px"); // Create an action menu - var actionsMenu = createMenu([addLnk, removeLnk, refreshLnk, [advancedLnk, advancedMenu]]); + var actionsMenu = createMenu([refreshLnk, addLnk, removeLnk, [advancedLnk, advancedMenu]]); actionsMenu.superfish(); actionsMenu.css('display', 'inline-block'); actionBar.append(actionsMenu); @@ -3675,11 +3675,24 @@ function openRemoveDiskFromPoolDialog(disks2remove) { var hcp2zvm = new Object(); hcp2zvm = getHcpZvmHash(); - var args = disks2remove.split('-'); - var tgtHcp = args[0]; - var tgtPool = args[1]; - var tgtVol = args[2]; + var disks = new Array(); + if (disks2remove.indexOf(',') > -1) + disks = disks2remove.split(','); + else + disks.push(disks2remove); + // Pick the last zHCP and pool it finds + var args, tgtHcp = "", tgtPool = "", tgtVol = ""; + for (var i in disks) { + args = disks[i].split('-'); + tgtHcp = args[0]; + tgtPool = args[1]; + tgtVol += args[2] + ','; + } + + // Strip out last comma + tgtVol = tgtVol.slice(0, -1); + // Create info bar var info = createInfoBar('Remove a disk from a disk pool defined in the EXTENT CONTROL.'); deleteDiskForm.append(info); diff --git a/xCAT-UI/js/nodes/nodes.js b/xCAT-UI/js/nodes/nodes.js index 668704211..87805849a 100644 --- a/xCAT-UI/js/nodes/nodes.js +++ b/xCAT-UI/js/nodes/nodes.js @@ -2023,22 +2023,30 @@ function loadDeletePage(tgtNodes) { // Confirm delete var instr = $('

Are you sure you want to delete ' + tgtNodesStr + '?

').css('word-wrap', 'break-word'); + var dbOnly = $('
Only delete entries in database
'); confirmAttr.append(instr); + confirmAttr.append(dbOnly); /** * Delete */ var deleteBtn = createButton('Delete'); deleteBtn.click(function() { + var cmd = "rmvm"; + // Only delete entries in database if checked + if ($("#" + newTabId + " input[name='db-only']").attr('checked')) { + cmd = "noderm"; + } + // Delete the virtual server $.ajax( { url : 'lib/cmd.php', dataType : 'json', data : { - cmd : 'rmvm', + cmd : cmd, tgt : tgtNodes, args : '', - msg : 'out=' + statBarId + ';cmd=rmvm;tgt=' + tgtNodes + msg : 'out=' + statBarId + ';cmd=' + cmd + ';tgt=' + tgtNodes }, success : updateStatusBar @@ -2135,6 +2143,13 @@ function updateStatusBar(data) { // Enable buttons $('#' + statBarId).parent().find('button').removeAttr('disabled'); + } else if (cmd == 'noderm') { + // Hide loader + $('#' + statBarId).find('img').hide(); + + // Write ajax response to status bar + var prg = $('
Entries deleted in database
'); + $('#' + statBarId).find('div').append(prg); } else { // Hide loader $('#' + statBarId).find('img').hide(); diff --git a/xCAT-server/lib/xcat/plugins/zvm.pm b/xCAT-server/lib/xcat/plugins/zvm.pm index 07c0568c2..4436fbcfb 100644 --- a/xCAT-server/lib/xcat/plugins/zvm.pm +++ b/xCAT-server/lib/xcat/plugins/zvm.pm @@ -6303,7 +6303,12 @@ sub changeHypervisor { # Define region as full volume and add to group if ($funct eq "4") { - $volume = $args->[3]; + $volume = $args->[3]; + # In case multiple regions/volumes are specified, just use the same name + if (scalar(@regions) > 1) { + $volume = $_; + } + $group = $args->[4]; $tmp = `ssh $::SUDOER\@$hcp "$::SUDO $::DIR/smcli Image_Volume_Space_Define_DM -T $hcpUserId -f $funct -g $_ -v $volume -p $group -y 0"`; xCAT::zvmUtils->printSyslog("smcli Image_Volume_Space_Define_DM -T $hcpUserId -f $funct -g $_ -v $volume -p $group -y 0");