diff --git a/xCAT-UI/css/style.css b/xCAT-UI/css/style.css
index 09a47264c..ad52d320c 100644
--- a/xCAT-UI/css/style.css
+++ b/xCAT-UI/css/style.css
@@ -347,7 +347,6 @@ legend {
.actionBar {
display: inline-table;
- width: 50%;
}
.actionBar div {
diff --git a/xCAT-UI/js/configure/service.js b/xCAT-UI/js/configure/service.js
index eaa7954b2..116932cca 100644
--- a/xCAT-UI/js/configure/service.js
+++ b/xCAT-UI/js/configure/service.js
@@ -178,7 +178,7 @@ function loadUserTable(data) {
});
// Create action bar
- var actionBar = $('
');
+ var actionBar = $('').css("width", "400px");
var createLnk = $('Create');
createLnk.click(function() {
@@ -687,7 +687,7 @@ function configImagePanel(data) {
});
// Create action bar
- var actionBar = $('');
+ var actionBar = $('').css("width", "400px");
// Create a profile
var createLnk = $('Create');
@@ -1193,7 +1193,7 @@ function configGroupPanel(data) {
});
// Create action bar
- var actionBar = $('');
+ var actionBar = $('').css("width", "400px");
// Create a group
var createLnk = $('Create');
diff --git a/xCAT-UI/js/custom/zvm.js b/xCAT-UI/js/custom/zvm.js
index a3be98d58..795c2cde6 100644
--- a/xCAT-UI/js/custom/zvm.js
+++ b/xCAT-UI/js/custom/zvm.js
@@ -209,7 +209,7 @@ zvmPlugin.prototype.loadServiceInventory = function(data) {
var inv = data.rsp[0].split(node + ':');
// Create array of property keys
- var keys = new Array('userId', 'host', 'os', 'arch', 'hcp', 'priv', 'memory', 'proc', 'disk', 'nic');
+ var keys = new Array('userId', 'host', 'os', 'arch', 'hcp', 'priv', 'memory', 'proc', 'disk', 'zfcp', 'nic');
// Create hash table for property names
var attrNames = new Object();
@@ -222,6 +222,7 @@ zvmPlugin.prototype.loadServiceInventory = function(data) {
attrNames['memory'] = 'Total Memory:';
attrNames['proc'] = 'Processors:';
attrNames['disk'] = 'Disks:';
+ attrNames['zfcp'] = 'zFCP:';
attrNames['nic'] = 'NICs:';
// Create hash table for node attributes
@@ -269,7 +270,10 @@ zvmPlugin.prototype.loadServiceInventory = function(data) {
*/
fieldSet = $('');
legend = $('');
- fieldSet.append(legend);
+ fieldSet.append(legend);
+// var info = createInfoBar('No data available');
+// fieldSet.append(info.css('width', '300px'));
+
getMonitorMetrics(node);
// Refresh monitoring charts on-click
@@ -457,6 +461,51 @@ zvmPlugin.prototype.loadServiceInventory = function(data) {
dasdTable.append(dasdBody);
item.append(dasdTable);
}
+
+ /**
+ * zFCP section
+ */
+ else if (keys[k] == 'zfcp') {
+ // Create a label - Property name
+ label = $('');
+ item.append(label);
+
+ // Create a table to hold NIC data
+ var zfcpTable = $('
');
+ var zfcpBody = $('');
+
+ // Table columns - Virtual device, Adapter Type, Port Name, # of Devices, MAC Address, and LAN Name
+ var zfcpTabRow = $('
Virtual Device #
Port Name
Unit Number
Size
');
+ zfcpTable.append(zfcpTabRow);
+ var zfcpVDev, zfcpPortName, zfcpLun, zfcpSize;
+
+ // Loop through each zFCP device
+ if (attrs[keys[k]]) {
+ for (l = 0; l < attrs[keys[k]].length; l++) {
+ if (attrs[keys[k]][l]) {
+ args = attrs[keys[k]][l].split(' ');
+
+ // Get zFCP virtual device, port name (WWPN), unit number (LUN), and size
+ zfcpVDev = $('
');
confirmDialog.dialog({
+ title: "Confirm",
modal: true,
width: 300,
buttons: {
@@ -1249,6 +1300,7 @@ zvmPlugin.prototype.loadInventory = function(data) {
// Open dialog to confirm
var confirmDialog = $('
Are you sure you want to remove this disk?
');
confirmDialog.dialog({
+ title: "Confirm",
modal: true,
width: 300,
buttons: {
@@ -1315,6 +1367,100 @@ zvmPlugin.prototype.loadInventory = function(data) {
item.append(dasdTable);
}
+
+ /**
+ * zFCP section
+ */
+ else if (keys[k] == 'zfcp') {
+ // Create a label - Property name
+ label = $('');
+ item.append(label);
+
+ // Create a table to hold NIC data
+ var zfcpTable = $('
');
+ var zfcpBody = $('');
+ var zfcpFooter = $('');
+
+ /**
+ * Remove zFCP
+ */
+ contextMenu = [ {
+ 'Remove' : function(menuItem, menu) {
+ var addr = $(this).text();
+ var portName = $(this).parents('tr').find('td:eq(1)').text();
+ var unitNo = $(this).parents('tr').find('td:eq(2)').text();
+
+ // Open dialog to confirm
+ var confirmDialog = $('
Are you sure you want to remove this zFCP device?
');
+ confirmDialog.dialog({
+ title: "Confirm",
+ modal: true,
+ width: 300,
+ buttons: {
+ "Ok": function(){
+ removeZfcp(node, addr, portName, unitNo);
+ $(this).dialog("close");
+ },
+ "Cancel": function() {
+ $(this).dialog("close");
+ }
+ }
+ });
+ }
+ } ];
+
+ // Table columns - Virtual device, Adapter Type, Port Name, # of Devices, MAC Address, and LAN Name
+ var zfcpTabRow = $('
Virtual Device #
Port Name
Unit Number
Size
');
+ zfcpTable.append(zfcpTabRow);
+ var zfcpVDev, zfcpPortName, zfcpLun, zfcpSize;
+
+ // Loop through each zFCP device
+ if (attrs[keys[k]]) {
+ for (l = 0; l < attrs[keys[k]].length; l++) {
+ if (attrs[keys[k]][l]) {
+ args = attrs[keys[k]][l].split(' ');
+
+ // Get zFCP virtual device, port name (WWPN), unit number (LUN), and size
+ zfcpVDev = $('
');
- // Create a new row for each DASD
+ // Create a new row for each NIC
nicTabRow = $('
');
nicTabRow.append(nicVDev);
nicTabRow.append(nicType);
diff --git a/xCAT-UI/js/custom/zvmUtils.js b/xCAT-UI/js/custom/zvmUtils.js
index 9507bb49e..4d27b2c3b 100644
--- a/xCAT-UI/js/custom/zvmUtils.js
+++ b/xCAT-UI/js/custom/zvmUtils.js
@@ -2,6 +2,7 @@
* Global variables
*/
var diskDatatable; // zVM datatable containing disks
+var zfcpDatatable; // zVM datatable containing zFCP devices
var networkDatatable; // zVM datatable containing networks
/**
@@ -22,6 +23,24 @@ function setDiskDataTable(table) {
diskDatatable = table;
}
+/**
+ * Get the zFCP datatable
+ *
+ * @return Data table object
+ */
+function getZfcpDataTable() {
+ return zfcpDatatable;
+}
+
+/**
+ * Set the zFCP datatable
+ *
+ * @param table Data table object
+ */
+function setZfcpDataTable(table) {
+ zfcpDatatable = table;
+}
+
/**
* Get the network datatable
*
@@ -73,6 +92,23 @@ function loadHcpInfo(data) {
success : setDiskPoolCookies
});
}
+
+ // If there is no cookie for the zFCP pool names
+ if (!$.cookie(hcp + 'zfcppools')) {
+ // Get disk pools
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'lsvm',
+ tgt : hcp,
+ args : '--zfcppoolnames',
+ msg : hcp
+ },
+
+ success : setZfcpPoolCookies
+ });
+ }
// If there is no cookie for the network names
if (!$.cookie(hcp + 'networks')) {
@@ -324,36 +360,64 @@ function incrementNodeProcess(node) {
* @param data Data returned from HTTP request
*/
function updateZProvisionNewStatus(data) {
- // Get ajax response
+ // Parse ajax response
var rsp = data.rsp;
var args = data.msg.split(';');
-
- // Get command invoked
- var cmd = args[0].replace('cmd=', '');
- // Get output ID
+ var lastCmd = args[0].replace('cmd=', '');
var out2Id = args[1].replace('out=', '');
- // Get status bar ID
+ // IDs for status bar, tab, and loader
var statBarId = 'zProvisionStatBar' + out2Id;
- // Get provision tab ID
var tabId = 'zvmProvisionTab' + out2Id;
- // Get loader ID
var loaderId = 'zProvisionLoader' + out2Id;
- // Get node name
var node = $('#' + tabId + ' input[name=nodeName]').val();
/**
- * (2) Update /etc/hosts
+ * (2) Create user entry
*/
- if (cmd == 'nodeadd') {
- // If there was an error, do not continue
- if (rsp.length) {
+ if (lastCmd == 'nodeadd') {
+ if (rsp.length) {
$('#' + loaderId).hide();
$('#' + statBarId).find('div').append('
').click(function () {
+ // Do not load panel again if it is already loaded
+ if ($('#zfcpResource').children().length)
+ return;
+ else
+ $('#zfcpResource').append(createLoader(''));
+
+ // Resize accordion
+ $('#zvmResourceAccordion').accordion('resize');
+
+ // Create a array for hardware control points
+ var hcps = new Array();
+ if ($.cookie('hcp').indexOf(',') > -1)
+ hcps = $.cookie('hcp').split(',');
+ else
+ hcps.push($.cookie('hcp'));
+
+ for ( var i in hcps) {
+ // Gather networks from hardware control points
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'lsvm',
+ tgt : hcps[i],
+ args : '--zfcppoolnames',
+ msg : hcps[i]
+ },
+
+ success : getZfcpPool
+ });
+ }
});
// Create accordion panel for network
@@ -1085,7 +1125,7 @@ function getZResources(data) {
}
});
- resourcesAccordion.append(diskLnk, diskSection, networkLnk, networkSection);
+ resourcesAccordion.append(diskLnk, diskSection, zfcpLnk, zfcpSection, networkLnk, networkSection);
// Append accordion to tab
$('#' + tabId).append(resourcesAccordion);
@@ -1366,6 +1406,133 @@ function openAddDiskDialog(node, hcp) {
});
}
+/**
+ * Create add zFCP device dialog
+ *
+ * @param node Node to add disk to
+ * @param hcp Hardware control point of node
+ */
+function openAddZfcpDialog(node, hcp) {
+ // Get list of disk pools
+ var cookie = $.cookie(hcp + 'zfcppools');
+ var pools = cookie.split(',');
+
+ // Create form to add disk
+ var addZfcpForm = $('');
+ // Create info bar
+ var info = createInfoBar('Add a SCSI|FCP disk to this virtual server.');
+ addZfcpForm.append(info);
+ addZfcpForm.append('');
+ addZfcpForm.append('');
+ addZfcpForm.append('');
+ addZfcpForm.append('');
+
+ // Create drop down for disk pool
+ var diskPool = $('');
+ diskPool.append('');
+ var poolSelect = $('');
+ for ( var i = 0; i < pools.length; i++) {
+ poolSelect.append('');
+ }
+ diskPool.append(poolSelect);
+ addZfcpForm.append(diskPool);
+
+ // Tag to identify where device will be used
+ addZfcpForm.append('');
+
+ // Create advanced link to set advanced zFCP properties
+ var advancedLnk = $('');
+ addZfcpForm.append(advancedLnk);
+ var advanced = $('').hide();
+ addZfcpForm.append(advanced);
+
+ var portName = $('');
+ var unitNo = $('');
+ advanced.append(portName, unitNo);
+
+ // Toggle port name and unit number when clicking on advanced link
+ advancedLnk.click(function() {
+ advanced.toggle();
+ });
+
+ // Open dialog to add disk
+ addZfcpForm.dialog({
+ title:'Add zFCP device',
+ modal: true,
+ close: function(){
+ $(this).remove();
+ },
+ width: 400,
+ buttons: {
+ "Ok": function(){
+ // Remove any warning messages
+ $(this).find('.ui-state-error').remove();
+
+ // Get inputs
+ var node = $(this).find('input[name=diskNode]').val();
+ var address = $(this).find('input[name=diskAddress]').val();
+ var loaddev = $(this).find('input[name=diskLoaddev]');
+ var size = $(this).find('input[name=diskSize]').val();
+ var pool = $(this).find('select[name=diskPool]').val();
+ var tag = $(this).find('select[name=diskTag]').val();
+ var portName = $(this).find('select[name=diskPortName]').val();
+ var unitNo = $(this).find('select[name=diskUnitNo]').val();
+
+ // If inputs are not complete, show warning message
+ if (!node || !address || !size || !pool) {
+ var warn = createWarnBar('Please provide a value for each missing field.');
+ warn.prependTo($(this));
+ } else {
+ if (loaddev.attr('checked')) {
+ loaddev = 1;
+ } else {
+ loaddev = 0;
+ }
+
+ var args = '--addzfcp;' + pool + ';' + address + ';' + loaddev + ';' + size;
+
+ if (tag && tag != "null") {
+ args += ';' + tag;
+ } if (portName && tag != "null") {
+ args += ';' + portName;
+ } if (unitNo && tag != "null") {
+ args += ';' + unitNo;
+ }
+
+ // Add zFCP device
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'chvm',
+ tgt : node,
+ args : args,
+ msg : node
+ },
+
+ success : updateZNodeStatus
+ });
+
+ // Increment node process
+ incrementNodeProcess(node);
+
+ // Show loader
+ var statusId = node + 'StatusBar';
+ var statusBarLoaderId = node + 'StatusBarLoader';
+ $('#' + statusBarLoaderId).show();
+ $('#' + statusId).show();
+
+ // Close dialog
+ $(this).dialog( "close" );
+ } // End of else
+ },
+ "Cancel": function() {
+ $(this).dialog( "close" );
+ }
+ }
+ });
+}
+
/**
* Create add NIC dialog
*
@@ -1667,6 +1834,36 @@ function removeDisk(node, address) {
$('#' + node + 'StatusBar').show();
}
+/**
+ * Remove zFCP device
+ *
+ * @param node Node where disk is attached
+ * @param address Virtual address of zFCP device
+ * @param wwpn World wide port name of zFCP device
+ * @param lun Logical unit number of zFCP device
+ */
+function removeZfcp(node, address, wwpn, lun) {
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'chvm',
+ tgt : node,
+ args : '--removezfcp;' + address + ';' + wwpn + ';' + lun,
+ msg : node
+ },
+
+ success : updateZNodeStatus
+ });
+
+ // Increment node process
+ incrementNodeProcess(node);
+
+ // Show loader
+ $('#' + node + 'StatusBarLoader').show();
+ $('#' + node + 'StatusBar').show();
+}
+
/**
* Remove NIC
*
@@ -1762,6 +1959,42 @@ function getDiskPool(data) {
}
}
+/**
+ * Get contents of each zFCP pool
+ *
+ * @param data HTTP request data
+ */
+function getZfcpPool(data) {
+ if (data.rsp.length) {
+ var hcp = data.msg;
+ var pools = data.rsp[0].split(hcp + ': ');
+
+ // Get contents of each disk pool
+ for ( var i in pools) {
+ if (pools[i]) {
+ pools[i] = jQuery.trim(pools[i]);
+
+ // Query used and free space
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'lsvm',
+ tgt : hcp,
+ args : '--zfcppool;' + pools[i] + ';all',
+ msg : 'hcp=' + hcp + ';pool=' + pools[i]
+ },
+
+ success : loadZfcpPoolTable
+ });
+ } // End of if
+ } // End of for
+ } else {
+ // Load empty table
+ loadZfcpPoolTable(null);
+ }
+}
+
/**
* Get details of each network
*
@@ -1827,7 +2060,7 @@ function loadDiskPoolTable(data) {
// Create a datatable
var table = new DataTable(tableId);
// Resource headers: volume ID, device type, start address, and size
- table.init( [ '', 'HCP', 'Pool', 'Status', 'Region', 'Device type', 'Starting address', 'Size' ]);
+ table.init( [ '', 'zHCP', 'Pool', 'Status', 'Region', 'Device type', 'Starting address', 'Size' ]);
// Append datatable to panel
$('#' + panelId).append(table.object());
@@ -1889,11 +2122,145 @@ function loadDiskPoolTable(data) {
success : getDiskPool
});
+ }
+ });
+
+ // Create action bar
+ var actionBar = $('').css("width", "400px");
+
+ // Create an action menu
+ var actionsMenu = createMenu([addLnk, removeLnk, refreshLnk]);
+ actionsMenu.superfish();
+ actionsMenu.css('display', 'inline-block');
+ actionBar.append(actionsMenu);
+
+ // Set correct theme for action menu
+ actionsMenu.find('li').hover(function() {
+ setMenu2Theme($(this));
+ }, function() {
+ setMenu2Normal($(this));
+ });
+
+ // Create a division to hold actions menu
+ var menuDiv = $('');
+ $('#' + tableId + '_length').prepend(menuDiv);
+ $('#' + tableId + '_length').css({
+ 'padding': '0px',
+ 'width': '500px'
+ });
+ $('#' + tableId + '_filter').css('padding', '10px');
+ menuDiv.append(actionBar);
+ }
+
+ // Resize accordion
+ $('#zvmResourceAccordion').accordion('resize');
+}
+
+/**
+ * Load zFCP pool contents into a table
+ *
+ * @param data HTTP request data
+ */
+function loadZfcpPoolTable(data) {
+ // Delete loader
+ var panelId = 'zfcpResource';
+ $('#' + panelId).find('img[src="images/loader.gif"]').remove();
+
+ var args, hcp, pool, tmp;
+ if (data) {
+ args = data.msg.split(';');
+ hcp = args[0].replace('hcp=', '');
+ pool = args[1].replace('pool=', '');
+ tmp = data.rsp[0].split(hcp + ': ');
+ }
+
+ // Resource tab ID
+ var info = $('#' + panelId).find('.ui-state-highlight');
+ // If there is no info bar, create info bar
+ if (!info.length) {
+ info = createInfoBar('Below are devices that are defined internally in the zFCP pools.');
+ $('#' + panelId).append(info);
+ }
+
+ // Get datatable
+ var tableId = 'zFcpDataTable';
+ var dTable = getZfcpDataTable();
+ if (!dTable) {
+ // Create a datatable
+ var table = new DataTable(tableId);
+ // Resource headers: status, WWPN, LUN, size, owner, channel, tag
+ table.init( [ '', 'zHCP', 'Pool', 'Status', 'Port name', 'Unit number', 'Size', 'Owner', 'Channel', 'Tag' ]);
+
+ // Append datatable to panel
+ $('#' + panelId).append(table.object());
+
+ // Turn into datatable
+ dTable = $('#' + tableId).dataTable({
+ "sScrollX": "100%",
+ "bAutoWidth": true
+ });
+ setZfcpDataTable(dTable);
+ }
+
+ if (data) {
+ // Skip index 0 and 1 because it contains nothing
+ for ( var i = 2; i < tmp.length; i++) {
+ tmp[i] = jQuery.trim(tmp[i]);
+ var diskAttrs = tmp[i].split(',');
+ dTable.fnAddData( [ '', hcp, pool, diskAttrs[0], diskAttrs[1], diskAttrs[2], diskAttrs[3], diskAttrs[4], diskAttrs[5], diskAttrs[6] ]);
+ }
+ }
+
+ // Create actions menu
+ if (!$('#zFcpResourceActions').length) {
+ // Empty filter area
+ $('#' + tableId + '_length').empty();
+
+ // Add disk to pool
+ var addLnk = $('Add');
+ addLnk.bind('click', function(event){
+ openAddZfcp2PoolDialog();
+ });
+
+ // Delete disk from pool
+ var removeLnk = $('Remove');
+ removeLnk.bind('click', function(event){
+ var disks = getNodesChecked(tableId);
+ openRemoveZfcpFromPoolDialog(disks);
+ });
+
+ // Refresh table
+ var refreshLnk = $('Refresh');
+ refreshLnk.bind('click', function(event){
+ $('#zfcpResource').empty().append(createLoader(''));
+ setZfcpDataTable('');
+
+ // Create a array for hardware control points
+ var hcps = new Array();
+ if ($.cookie('hcp').indexOf(',') > -1)
+ hcps = $.cookie('hcp').split(',');
+ else
+ hcps.push($.cookie('hcp'));
+
+ // Query the disk pools for each
+ for (var i in hcps) {
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'lsvm',
+ tgt : hcps[i],
+ args : '--zfcppoolnames',
+ msg : hcps[i]
+ },
+
+ success : getZfcpPool
+ });
}
});
// Create action bar
- var actionBar = $('');
+ var actionBar = $('').css("width", "400px");
// Create an action menu
var actionsMenu = createMenu([addLnk, removeLnk, refreshLnk]);
@@ -1929,7 +2296,7 @@ function loadDiskPoolTable(data) {
* @param disks2remove Disks selected in table
*/
function openRemoveDiskFromPoolDialog(disks2remove) {
- // Create form to delete disk to pool
+ // Create form to delete disk from pool
var dialogId = 'zvmDeleteDiskFromPool';
var deleteDiskForm = $('');
@@ -2142,6 +2509,203 @@ function openAddDisk2PoolDialog() {
});
}
+/**
+ * Open dialog to remove zFCP from pool
+ *
+ * @param devices2remove Comman separated devices selected in table
+ */
+function openRemoveZfcpFromPoolDialog(devices2remove) {
+ // Create form to delete device from pool
+ var dialogId = 'zvmDeleteZfcpFromPool';
+ var deleteDiskForm = $('');
+
+ // Verify disks are in the same zFCP pool
+ var devices = devices2remove.split(',');
+ var tmp, tgtPool;
+ var tgtUnitNo = "";
+ for (var i in devices) {
+ tmp = devices[i].split('-');
+
+ if (tgtPool && tmp[0] != tgtPool) {
+ openDialog("warn", "Please select devices in the same zFCP");
+ return;
+ } else {
+ tgtPool = tmp[0];
+ }
+
+ tgtUnitNo += tmp[1] + ",";
+ }
+
+ // Strip out last comma
+ tgtUnitNo = tgtUnitNo.slice(0, -1);
+
+ // Create info bar
+ var info = createInfoBar('Remove a zFCP device that is defined in a zFCP pool.');
+ deleteDiskForm.append(info);
+
+ var hcp = $('');
+ var hcpSelect = $('');
+ hcp.append(hcpSelect);
+
+ var pool = $('');
+ var unitNo = $('');
+ deleteDiskForm.append(hcp, pool, unitNo);
+
+ // Create a array for hardware control points
+ var hcps = new Array();
+ if ($.cookie('hcp').indexOf(',') > -1) {
+ hcps = $.cookie('hcp').split(',');
+ } else {
+ hcps.push($.cookie('hcp'));
+ }
+
+ // Append options for hardware control points
+ for (var i in hcps) {
+ hcpSelect.append($(''));
+ }
+
+ // Open dialog to delete device
+ deleteDiskForm.dialog({
+ title:'Delete device from pool',
+ modal: true,
+ close: function(){
+ $(this).remove();
+ },
+ width: 500,
+ buttons: {
+ "Ok": function(){
+ // Remove any warning messages
+ $(this).find('.ui-state-error').remove();
+
+ var hcp = $(this).find('select[name=hcp]').val();
+ var pool = $(this).find('input[name=zfcpPool]').val();
+ var unitNo = $(this).find('input[name=unitNo]').val();
+
+ // If inputs are not complete, show warning message
+ if (!hcp || !pool || !unitNo) {
+ var warn = createWarnBar('Please provide a value for each missing field.');
+ warn.prependTo($(this));
+ } else {
+ // Change dialog buttons
+ $(this).dialog('option', 'buttons', {
+ 'Close': function() {$(this).dialog("close");}
+ });
+
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'chvm',
+ tgt : hcp,
+ args : '--removezfcpfrompool;' + pool + ';' + unitNo,
+ msg : dialogId
+ },
+
+ success : updateResourceDialog
+ });
+ }
+ },
+ "Cancel": function() {
+ $(this).dialog( "close" );
+ }
+ }
+ });
+}
+
+/**
+ * Open dialog to add zFCP to pool
+ */
+function openAddZfcp2PoolDialog() {
+ // Create form to add disk to pool
+ var dialogId = 'zvmAddDisk2Pool';
+ var addDiskForm = $('');
+ var info = createInfoBar('Add a device to a zFCP pool defined in xCAT.');
+ addDiskForm.append(info);
+
+ var hcp = $('');
+ var hcpSelect = $('');
+ hcp.append(hcpSelect);
+
+ var pool = $('');
+ var status = $('');
+ var portName = $('');
+ var unitNo = $('');
+ var size = $('');
+ var owner = $('');
+ addDiskForm.append(hcp, pool, status, portName, unitNo, size, owner);
+
+ // Create a array for hardware control points
+ var hcps = new Array();
+ if ($.cookie('hcp').indexOf(',') > -1) {
+ hcps = $.cookie('hcp').split(',');
+ } else {
+ hcps.push($.cookie('hcp'));
+ }
+
+ for (var i in hcps) {
+ hcpSelect.append($(''));
+ }
+
+ // Open dialog to add disk
+ addDiskForm.dialog({
+ title:'Add device to pool',
+ modal: true,
+ close: function(){
+ $(this).remove();
+ },
+ width: 500,
+ buttons: {
+ "Ok": function(){
+ // Delete any warning messages
+ $(this).find('.ui-state-error').remove();
+
+ var tgtHcp = $(this).find('select[name=hcp]').val();
+ var tgtPool = $(this).find('input[name=zfcpPool]').val();
+ var tgtStatus = $(this).find('select[name=zfcpStatus]').val();
+ var tgtPortName = $(this).find('input[name=zfcpPortName]').val();
+ var tgtUnitNo = $(this).find('input[name=zfcpUnitNo]').val();
+ var tgtSize = $(this).find('input[name=zfcpSize]').val();
+
+ // Device owner is optional
+ var tgtOwner = "";
+ if ($(this).find('input[name=zfcpOwner]').val()) {
+ tgtOwner = $(this).find('input[name=zfcpOwner]').val();
+ }
+
+ // If inputs are not complete, show warning message
+ if (!tgtHcp || !tgtPool || !tgtStatus || !tgtPortName || !tgtUnitNo || !tgtSize) {
+ var warn = createWarnBar('Please provide a value for each missing field.');
+ warn.prependTo($(this));
+ } else {
+ // Change dialog buttons
+ $(this).dialog('option', 'buttons', {
+ 'Close': function() {$(this).dialog("close");}
+ });
+
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'chvm',
+ tgt : tgtHcp,
+ args : '--addzfcp2pool;' + tgtPool + ';' + tgtStatus + ';' + tgtPortName + ';' + tgtUnitNo + ';' + tgtSize + ';' + tgtOwner,
+ msg : dialogId
+ },
+
+ success : updateResourceDialog
+ });
+ }
+ },
+ "Cancel": function() {
+ $(this).dialog( "close" );
+ }
+ }
+ });
+}
+
/**
* Update resource dialog
*
@@ -2192,11 +2756,17 @@ function updateResourceDialog(data) {
* @param obj Object triggering event
*/
function selectAllDisk(event, obj) {
- // Get datatable ID
// This will ascend from
var tableObj = obj.parents('.datatable');
var status = obj.attr('checked');
tableObj.find(' :checkbox').attr('checked', status);
+
+ // Handle datatable scroll
+ tableObj = obj.parents('.dataTables_scroll');
+ if (tableObj.length) {
+ tableObj.find(' :checkbox').attr('checked', status);
+ }
+
event.stopPropagation();
}
@@ -2621,6 +3191,22 @@ function createZProvisionNew(inst) {
success : setDiskPoolCookies
});
}
+
+ if (!$.cookie(args[0] + 'zfcppools')) {
+ // Get zFCP pools
+ $.ajax( {
+ url : 'lib/cmd.php',
+ dataType : 'json',
+ data : {
+ cmd : 'lsvm',
+ tgt : args[0],
+ args : '--zfcppoolnames',
+ msg : args[0]
+ },
+
+ success : setZfcpPoolCookies
+ });
+ }
}
});
hcpDiv.append(hcpLabel);
@@ -2648,19 +3234,18 @@ function createZProvisionNew(inst) {
// Create operating system image input
var os = $('');
var osLabel = $('');
- var osInput = $('');
- // Get image names on focus
- osInput.one('focus', function(){
- var imageNames = $.cookie('imagenames');
- if (imageNames) {
- // Turn on auto complete
- $(this).autocomplete({
- source: imageNames.split(',')
- });
- }
- });
+ var osSelect = $('');
+ osSelect.append($(''));
+
+ var imageNames = $.cookie('imagenames').split(',');
+ if (imageNames) {
+ imageNames.sort();
+ for (var i in imageNames) {
+ osSelect.append($(''));
+ }
+ }
os.append(osLabel);
- os.append(osInput);
+ os.append(osSelect);
osAttr.append(os);
// Create user entry input
@@ -2673,7 +3258,7 @@ function createZProvisionNew(inst) {
// Get objects for HCP, user ID, and OS
var userId = $('#' + thisTabId + ' input[name=userId]');
- var os = $('#' + thisTabId + ' input[name=os]');
+ var os = $('#' + thisTabId + ' select[name=os]');
// Get default user entry when clicked
if ($(this).attr('checked')) {
@@ -2745,12 +3330,22 @@ function createZProvisionNew(inst) {
});
var diskBody = $('');
var diskFooter = $('');
-
+
/**
* Add disks
*/
var addDiskLink = $('Add disk');
addDiskLink.bind('click', function(event) {
+ // Get list of disk pools
+ var thisTabId = $(this).parents('.tab').attr('id');
+ var thisHcp = $('#' + thisTabId + ' input[name=hcp]').val();
+ var definedPools = null;
+ if (thisHcp) {
+ // Get node without domain name
+ var temp = thisHcp.split('.');
+ definedPools = $.cookie(temp[0] + 'diskpools').split(',');
+ }
+
// Create a row
var diskRow = $('
');
@@ -2792,23 +3387,14 @@ function createZProvisionNew(inst) {
);
diskMode.append(diskModeSelect);
diskRow.append(diskMode);
-
- // Get list of disk pools
- var thisTabId = $(this).parents('.tab').attr('id');
- var thisHcp = $('#' + thisTabId + ' input[name=hcp]').val();
- var definedPools = null;
- if (thisHcp) {
- // Get node without domain name
- var temp = thisHcp.split('.');
- definedPools = $.cookie(temp[0] + 'diskpools');
+
+ // Create disk pool drop down
+ var diskPool = $('
');
+ var diskPoolSelect = $('');
+ for (var i in definedPools) {
+ diskPoolSelect.append('');
}
-
- // Create disk pool input
- // Turn on auto complete for disk pool
- var diskPoolInput = $('').autocomplete({
- source: definedPools.split(',')
- });
- var diskPool = $('
').append(diskPoolInput);
+ diskPool.append(diskPoolSelect);
diskRow.append(diskPool);
// Create disk password input
@@ -2843,6 +3429,107 @@ function createZProvisionNew(inst) {
diskDiv.append(diskTable);
hwAttr.append(diskDiv);
+ // Create zFCP table
+ var zfcpDiv = $('');
+ var zfcpLabel = $('');
+ var zfcpTable = $('
');
+ var zfcpHeader = $('
Address
Size
Pool
Tag
Port Name
Unit #
LOADDEV
');
+ // Adjust header width
+ zfcpHeader.find('th').css( {
+ 'width' : '80px'
+ });
+ zfcpHeader.find('th').eq(0).css( {
+ 'width' : '20px'
+ });
+ var zfcpBody = $('');
+ var zfcpFooter = $('');
+
+ /**
+ * Add zFCP devices
+ */
+ var addZfcpLink = $('Add zFCP');
+ addZfcpLink.bind('click', function(event) {
+ // Get list of disk pools
+ var thisTabId = $(this).parents('.tab').attr('id');
+ var thisHcp = $('#' + thisTabId + ' input[name=hcp]').val();
+ var definedPools = null;
+ if (thisHcp) {
+ // Get node without domain name
+ var temp = thisHcp.split('.');
+ definedPools = $.cookie(temp[0] + 'zfcppools').split(',');
+ }
+
+ // Create a row
+ var zfcpRow = $('
');
+
+ // Add remove button
+ var removeBtn = $('');
+ var col = $('
');
+ zfcpRow.append(zfcpAddr);
+
+ // Create disk size input
+ var zfcpSize = $('
');
+ zfcpRow.append(zfcpSize);
+
+ // Create zFCP pool drop down
+ var zfcpPool = $('
');
+ var zfcpPoolSelect = $('');
+ for (var i in definedPools) {
+ zfcpPoolSelect.append('');
+ }
+ zfcpPool.append(zfcpPoolSelect);
+ zfcpRow.append(zfcpPool);
+
+ // Create disk tag
+ var zfcpTag = $('
');
+ zfcpRow.append(zfcpTag);
+
+ // Create device port name
+ var zfcpPortName = $('
');
+ zfcpRow.append(zfcpPortName);
+
+ // Create device unit number
+ var zfcpUnitNo = $('