Fixed bugs in xCAT-UI: fixed spacing issues, set default commands for guest users, set default arch and hypervisor for add z/VM node, and fixed dialog for adding SCSI/FCP device directly using WWPN & LUN.

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@16690 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
phamt 2013-06-19 15:25:12 +00:00
parent c68a422c44
commit f5a31b7f4f
8 changed files with 397 additions and 351 deletions

View File

@ -75,7 +75,7 @@ function loadConfigPage() {
tab.add('discoverTab', 'Discover', '', false);
// Add the self-service tab
tab.add('serviceTab', 'Service', '', false);
tab.add('serviceTab', 'Service', '', false);
// Get list of tables and their descriptions
$.ajax({
@ -98,7 +98,7 @@ function loadConfigPage() {
return;
}
if (ui.index == 1) {
if (ui.index == 1) {
loadUpdatePage();
} else if (ui.index == 2) {
loadUserPage();

View File

@ -328,8 +328,6 @@ function openCreateUserDialog(data) {
args += ' policy.name=' + usrName;
} if (host) {
args += " policy.host='" + host + "'";
} if (commands) {
args += " policy.commands='" + commands + "'";
} if (parameters) {
args += " policy.parameters='" + parameters + "'";
} if (nodeRange) {
@ -347,6 +345,13 @@ function openCreateUserDialog(data) {
args += " policy.comments=''";
}
// Handle cases where there are commands and no commands
if (commands) {
args += " policy.commands='" + commands + "'";
} else {
args += " policy.commands=''";
}
// Trim any extra spaces
args = jQuery.trim(args);
@ -396,21 +401,30 @@ function openCreateUserDialog(data) {
// Change comments if access checkbox is checked
typeSelect.change(function() {
var comments = createUserForm.find('input[name=comments]').val();
var tag = "privilege:root";
comments = jQuery.trim(comments);
var cmds = createUserForm.find('input[name=commands]').val();
comments = jQuery.trim(comments);
cmds = jQuery.trim(cmds);
// Append tag to comments
var tag = "privilege:root";
// The list of every command used by the self-service page
// Every command must be separated by a comma
var authorizedCmds = "authcheck,lsdef,nodestat,tabdump,rinv,rpower,rmvm,webportal,webrun";
// Append tag to commands and comments
if (typeSelect.val().indexOf("admin") > -1) {
if (comments && comments.charAt(comments.length - 1) != ";") {
comments += ";";
}
comments += tag;
createUserForm.find('input[name=comments]').val(comments);
createUserForm.find('input[name=comments]').val(comments);
createUserForm.find('input[name=commands]').val("");
} else {
comments = comments.replace(tag, "");
comments = comments.replace(";;", ";");
createUserForm.find('input[name=comments]').val(comments);
createUserForm.find('input[name=comments]').val(comments);
createUserForm.find('input[name=commands]').val(authorizedCmds);
}
// Strip off leading semi-colon
@ -453,6 +467,9 @@ function openCreateUserDialog(data) {
if (comments.indexOf("privilege:root") > -1) {
typeSelect.val("admin");
}
} else {
// Default user type to guest
typeSelect.val("guest").change();
}
}
/**

View File

@ -2085,12 +2085,12 @@ zvmPlugin.prototype.addNode = function() {
var args = "";
if (type == 'host') {
args = node + ';zvm.hcp=' + hcp
+ ';nodehm.mgt=zvm;hypervisor.type=zvm;groups=' + group
+ ';nodehm.mgt=zvm;nodetype.arch=s390x;hypervisor.type=zvm;groups=' + group
+ ';nodetype.os=' + os;
} else {
args = node + ';zvm.hcp=' + hcp
+ ';zvm.userid=' + userId
+ ';nodehm.mgt=zvm' + ';groups=' + group;
+ ';nodehm.mgt=zvm' + ';nodetype.arch=s390x' + ';groups=' + group;
}
if (ipRange != "" && ipRange != null) {
@ -2164,12 +2164,12 @@ zvmPlugin.prototype.addNode = function() {
var args = "";
if (type == 'host') {
args = nodeRange + ';zvm.hcp=' + hcp
+ ';nodehm.mgt=zvm;hypervisor.type=zvm;groups=' + group
+ ';nodehm.mgt=zvm;nodetype.arch=s390x;hypervisor.type=zvm;groups=' + group
+ ';nodetype.os=' + os;
} else {
args = nodeRange + ';zvm.hcp=' + hcp
+ ';zvm.userid=' + userIdRange
+ ';nodehm.mgt=zvm' + ';groups=' + group;
+ ';nodehm.mgt=zvm' + ';nodetype.arch=s390x' + ';groups=' + group;
}
if (ipRange)

View File

@ -80,7 +80,7 @@ function loadHcpInfo(data) {
if (userEntry[0].indexOf('Failed') < 0) {
if (hcp) {
// If there is no cookie for the disk pool names
if (!$.cookie(hcp + 'diskpools')) {
if (!$.cookie(hcp + 'diskpools') || $.cookie(hcp + 'diskpools') === null) {
// Get disk pools
$.ajax( {
url : 'lib/cmd.php',
@ -97,7 +97,7 @@ function loadHcpInfo(data) {
}
// If there is no cookie for the zFCP pool names
if (!$.cookie(hcp + 'zfcppools')) {
if (!$.cookie(hcp + 'zfcppools') || $.cookie(hcp + 'zfcppools') === null) {
// Get disk pools
$.ajax( {
url : 'lib/cmd.php',
@ -114,7 +114,7 @@ function loadHcpInfo(data) {
}
// If there is no cookie for the network names
if (!$.cookie(hcp + 'networks')) {
if (!$.cookie(hcp + 'networks') || $.cookie(hcp + 'networks') === null) {
// Get network names
$.ajax( {
url : 'lib/cmd.php',
@ -955,7 +955,8 @@ function getZResources(data) {
for (var key in hcpHash) {
// Get the short host name
hcp = key.split('.')[0];
hcps.push(hcp);
if (jQuery.inArray(hcp, hcps) == -1)
hcps.push(hcp);
}
// Set hardware control point cookie
@ -1159,7 +1160,7 @@ function openAddProcDialog(node) {
procType.append(typeSelect);
addProcForm.append(procType);
// Generate tooltips
// Generate tooltips
addProcForm.find('div input[title],select[title]').tooltip({
position: "center right",
offset: [-2, 10],
@ -1248,7 +1249,7 @@ function openAddDiskDialog(node, hcp) {
var cookie = $.cookie(hcp + 'diskpools');
var pools = new Array();
if (cookie) {
pools = cookie.split(',');
pools = cookie.split(',');
}
// Create form to add disk
@ -1288,7 +1289,7 @@ function openAddDiskDialog(node, hcp) {
addDiskForm.append('<div><label>Disk password:</label><input type="password" id="diskPassword" name="diskPassword" title="Optional. Defines the read, write, and multi password that will be used for accessing the disk."/></div>');
// Generate tooltips
// Generate tooltips
addDiskForm.find('div input[title],select[title]').tooltip({
position: "center right",
offset: [-2, 10],
@ -1411,7 +1412,7 @@ function openAddZfcpDialog(node, hcp, zvm) {
var cookie = $.cookie(hcp + 'zfcppools');
var pools = new Array();
if (cookie) {
pools = cookie.split(',');
pools = cookie.split(',');
}
// Create form to add disk
@ -1452,7 +1453,7 @@ function openAddZfcpDialog(node, hcp, zvm) {
advanced.toggle();
});
// Generate tooltips
// Generate tooltips
addZfcpForm.find('div input[title],select[title]').tooltip({
position: "center right",
offset: [-2, 10],
@ -1492,9 +1493,9 @@ function openAddZfcpDialog(node, hcp, zvm) {
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();
var tag = $(this).find('input[name=diskTag]').val();
var portName = $(this).find('input[name=diskPortName]').val();
var unitNo = $(this).find('input[name=diskUnitNo]').val();
// If inputs are not complete, show warning message
if (!node || !address || !size || !pool) {
@ -1511,10 +1512,12 @@ function openAddZfcpDialog(node, hcp, zvm) {
if (tag && tag != "null") {
args += '||' + tag;
} if (portName && tag != "null") {
args += '||' + portName;
} if (unitNo && tag != "null") {
args += '||' + unitNo;
} else {
args += '|| ""';
}
if ((portName && portName != "null") && (unitNo && unitNo != "null")) {
args += '||' + portName + '||' + unitNo;
}
// Add zFCP device
@ -1572,7 +1575,7 @@ function openDedicateDeviceDialog(node, hcp) {
'<option value="1">Read-only</option>' +
'</select>');
// Generate tooltips
// Generate tooltips
dedicateForm.find('div input[title],select[title]').tooltip({
position: "center right",
offset: [-2, 10],
@ -1675,7 +1678,7 @@ function openAddEckd2SystemDialog(hcp) {
// Append options for hardware control points
systemSelect.append($('<option value=""></option>'));
for (var hcp in hcp2zvm) {
systemSelect.append($('<option value="' + hcp2zvm[hcp] + '">' + hcp2zvm[hcp] + '</option>'));
systemSelect.append($('<option value="' + hcp2zvm[hcp] + '">' + hcp2zvm[hcp] + '</option>'));
}
// Create info bar
@ -1685,7 +1688,7 @@ function openAddEckd2SystemDialog(hcp) {
addE2SForm.append(system);
addE2SForm.append('<div><label>Device number:</label><input type="text" name="devNum" value="" maxlength="4" title="The disk device number"/></div>');
// Generate tooltips
// Generate tooltips
addE2SForm.find('div input[title],select[title]').tooltip({
position: "center right",
offset: [-2, 10],
@ -1727,10 +1730,10 @@ function openAddEckd2SystemDialog(hcp) {
var args = new Array('select[name=system]', 'input[name=devNum]');
for (var i in args) {
if (!$(this).find(args[i]).val()) {
$(this).find(args[i]).css('border', 'solid #FF0000 1px');
$(this).find(args[i]).css('border', 'solid #FF0000 1px');
ready = false;
} else {
$(this).find(args[i]).css('border', 'solid #BDBDBD 1px');
$(this).find(args[i]).css('border', 'solid #BDBDBD 1px');
}
}
@ -1787,7 +1790,7 @@ function openAddPageSpoolDialog(hcp) {
// Append options for hardware control points
systemSelect.append($('<option value=""></option>'));
for (var hcp in hcp2zvm) {
systemSelect.append($('<option value="' + hcp2zvm[hcp] + '">' + hcp2zvm[hcp] + '</option>'));
systemSelect.append($('<option value="' + hcp2zvm[hcp] + '">' + hcp2zvm[hcp] + '</option>'));
}
// Create info bar
@ -1805,7 +1808,7 @@ function openAddPageSpoolDialog(hcp) {
diskAttr.append('<div><label>Volume label:</label><input type="text" name="volLabel" value="" maxlength="6" title="The name to be associated with the newly formatted volume"/></div>');
diskAttr.append('<div><label>Volume use:</label><select name="volUse" title="Specifies that the volume is to be formatted and used as a page or spool volume"><option value="PAGE">Page</option><option value="SPOOL">Spool</option></select></div>');
// Generate tooltips
// Generate tooltips
addPageSpoolForm.find('div input[title],select[title]').tooltip({
position: "center right",
offset: [-2, 10],
@ -1849,10 +1852,10 @@ function openAddPageSpoolDialog(hcp) {
var args = new Array('select[name=system]', 'input[name=volAddr]', 'input[name=volLabel]', 'select[name=volUse]');
for (var i in args) {
if (!$(this).find(args[i]).val()) {
$(this).find(args[i]).css('border', 'solid #FF0000 1px');
$(this).find(args[i]).css('border', 'solid #FF0000 1px');
ready = false;
} else {
$(this).find(args[i]).css('border', 'solid #BDBDBD 1px');
$(this).find(args[i]).css('border', 'solid #BDBDBD 1px');
}
}
@ -1905,7 +1908,7 @@ function openShareDiskDialog(disks2share) {
var tgtVol = args[1];
if (!tgtVol || tgtVol == "undefined")
tgtVol = "";
tgtVol = "";
// Create info bar
var info = createInfoBar('Indicate a full-pack minidisk is to be shared by the users of many real and virtual systems.');
@ -1917,7 +1920,7 @@ function openShareDiskDialog(disks2share) {
var shareEnable = $('<div><label>Share enable:</label><select name="shareEnable" title="Turns sharing of the specified full-pack minidisk on or off"><option value="ON">On</option><option value="OFF">Off</option></select></div>');
shareDiskForm.append(node, volAddr, shareEnable);
// Generate tooltips
// Generate tooltips
shareDiskForm.find('div input[title],select[title]').tooltip({
position: "center right",
offset: [-2, 10],
@ -1961,10 +1964,10 @@ function openShareDiskDialog(disks2share) {
var args = new Array('input[name=node]', 'input[name=volAddr]', 'select[name=shareEnable]');
for (var i in args) {
if (!$(this).find(args[i]).val()) {
$(this).find(args[i]).css('border', 'solid #FF0000 1px');
$(this).find(args[i]).css('border', 'solid #FF0000 1px');
ready = false;
} else {
$(this).find(args[i]).css('border', 'solid #BDBDBD 1px');
$(this).find(args[i]).css('border', 'solid #BDBDBD 1px');
}
}
@ -2027,7 +2030,7 @@ function openAddScsi2SystemDialog(hcp) {
// Append options for hardware control points
systemSelect.append($('<option value=""></option>'));
for (var hcp in hcp2zvm) {
systemSelect.append($('<option value="' + hcp2zvm[hcp] + '">' + hcp2zvm[hcp] + '</option>'));
systemSelect.append($('<option value="' + hcp2zvm[hcp] + '">' + hcp2zvm[hcp] + '</option>'));
}
var devNo = $('<div><label>Device number:</label><input type="text" name="devNo" maxlength="4" title="The SCSI disk device number"/></div>');
@ -2109,7 +2112,7 @@ function openAddScsi2SystemDialog(hcp) {
devPathBody.append(devPathRow);
// Generate tooltips
// Generate tooltips
addS2SForm.find('div input[title],select[title]').tooltip({
position: "center right",
offset: [-2, 10],
@ -2138,17 +2141,17 @@ function openAddScsi2SystemDialog(hcp) {
devPathDiv.append(devPathTable);
var option = $('<div><label>Option:</label><select name="option" title="The action to perform">' +
'<option selected value="1">Add a new SCSI disk</option>' +
'<option value="2">Add new paths to an existing SCSI disk</option>' +
'<option value="3">Delete paths from an existing SCSI disk</option>' +
'</select></div>');
'<option selected value="1">Add a new SCSI disk</option>' +
'<option value="2">Add new paths to an existing SCSI disk</option>' +
'<option value="3">Delete paths from an existing SCSI disk</option>' +
'</select></div>');
var persist = $('<div><label>Persist:</label><select name="persist" title="Specifies that the SCSI device is to be updated on the active system configuration or both the active and permanent system configurations">' +
'<option selected value="no">No</option>' +
'<option value="yes">Yes</option>' +
'</select></div>');
'<option selected value="no">No</option>' +
'<option value="yes">Yes</option>' +
'</select></div>');
addS2SForm.append(system, devNo, devPathDiv, option, persist);
// Generate tooltips
// Generate tooltips
addS2SForm.find('div input[title],select[title]').tooltip({
position: "center right",
offset: [-2, 10],
@ -2212,10 +2215,10 @@ function openAddScsi2SystemDialog(hcp) {
var args = new Array('select[name=system]', 'input[name=devNum]', 'select[name=option]', 'select[name=persist]');
for (var i in args) {
if (!$(this).find(args[i]).val()) {
$(this).find(args[i]).css('border', 'solid #FF0000 1px');
$(this).find(args[i]).css('border', 'solid #FF0000 1px');
ready = false;
} else {
$(this).find(args[i]).css('border', 'solid #BDBDBD 1px');
$(this).find(args[i]).css('border', 'solid #BDBDBD 1px');
}
}
@ -2261,7 +2264,7 @@ function openRemoveScsiDialog(hcp) {
// Create form to add disk
var removeScsiForm = $('<div id="' + dialogId + '" class="form"></div>');
// Obtain mapping for zHCP to zVM system
// Obtain mapping for zHCP to zVM system
var hcp2zvm = new Object();
hcp2zvm = getHcpZvmHash();
@ -2272,7 +2275,7 @@ function openRemoveScsiDialog(hcp) {
// Append options for hardware control points
systemSelect.append($('<option value=""></option>'));
for (var hcp in hcp2zvm) {
systemSelect.append($('<option value="' + hcp2zvm[hcp] + '">' + hcp2zvm[hcp] + '</option>'));
systemSelect.append($('<option value="' + hcp2zvm[hcp] + '">' + hcp2zvm[hcp] + '</option>'));
}
// Create info bar
@ -2280,11 +2283,11 @@ function openRemoveScsiDialog(hcp) {
removeScsiForm.append(info, system);
removeScsiForm.append('<div><label>Device number:</label><input type="text" name="devNum" value="" maxlength="4" title="The SCSI disk device number"/></div>');
removeScsiForm.append('<div><label>Persist:</label><select name="persist" title="Specifies that the SCSI device is to be updated on the active system configuration or both the active and permanent system configurations">' +
'<option value="NO">No</option>' +
'<option value="YES>Yes</option>' +
'</select></div>');
'<option value="NO">No</option>' +
'<option value="YES>Yes</option>' +
'</select></div>');
// Generate tooltips
// Generate tooltips
removeScsiForm.find('div input[title],select[title]').tooltip({
position: "center right",
offset: [-2, 10],
@ -2328,10 +2331,10 @@ function openRemoveScsiDialog(hcp) {
var args = new Array('select[name=system]', 'input[name=devNum]');
for (var i in args) {
if (!$(this).find(args[i]).val()) {
$(this).find(args[i]).css('border', 'solid #FF0000 1px');
$(this).find(args[i]).css('border', 'solid #FF0000 1px');
ready = false;
} else {
$(this).find(args[i]).css('border', 'solid #BDBDBD 1px');
$(this).find(args[i]).css('border', 'solid #BDBDBD 1px');
}
}
@ -2375,10 +2378,10 @@ function openRemoveScsiDialog(hcp) {
*/
function openAddNicDialog(node, hcp) {
// Get network names
var cookie = $.cookie(hcp + 'networks');
var cookie = $.cookie(hcp + 'networks');
var networks = new Array();
if (cookie) {
networks = cookie.split(',');
networks = cookie.split(',');
}
// Create form to add NIC
@ -2512,7 +2515,7 @@ function openAddNicDialog(node, hcp) {
}
});
// Generate tooltips
// Generate tooltips
addNicForm.find('div input[title],select[title]').tooltip({
position: "center right",
offset: [-2, 10],
@ -2648,7 +2651,7 @@ function openAddVswitchVlanDialog(hcp) {
// Create form to add disk
var addVswitchForm = $('<div id="' + dialogId + '" class="form"></div>');
// Create info bar
// Create info bar
var info = createInfoBar('Create a virtual switch or virtual network LAN.');
var netFS = $('<fieldset></fieldset>');
@ -2666,10 +2669,10 @@ function openAddVswitchVlanDialog(hcp) {
var networkTypeDiv = $('<div><label>Network Type:</label>');
var networkType = $('<select name="networkType">' +
'<option></option>' +
'<option value="vswitch">vSwitch</option>' +
'<option value="vlan">VLAN</option>' +
'</select></div>');
'<option></option>' +
'<option value="vswitch">vSwitch</option>' +
'<option value="vlan">VLAN</option>' +
'</select></div>');
networkTypeDiv.append(networkType)
netAttr.append(networkTypeDiv);
@ -2683,7 +2686,7 @@ function openAddVswitchVlanDialog(hcp) {
hcp2zvm = getHcpZvmHash();
systemSelect.append($('<option value=""></option>'));
for (var hcp in hcp2zvm) {
systemSelect.append($('<option value="' + hcp2zvm[hcp] + '">' + hcp2zvm[hcp] + '</option>'));
systemSelect.append($('<option value="' + hcp2zvm[hcp] + '">' + hcp2zvm[hcp] + '</option>'));
}
var typeAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
@ -2708,38 +2711,38 @@ function openAddVswitchVlanDialog(hcp) {
});
advanced.append($('<div><label>Connection:</label><select name="connection" title="The real device connection">' +
'<option value="0">Unspecified</option>' +
'<option value="1">Activate real device connection</option>' +
'<option value="2">Do not activate real device connection</option>' +
'</select></div>'));
'<option value="0">Unspecified</option>' +
'<option value="1">Activate real device connection</option>' +
'<option value="2">Do not activate real device connection</option>' +
'</select></div>'));
advanced.append($('<div><label>QDIO buffer size:</label><input type="text" name="queueMemoryLimit" maxlength="1" value="8" title="A number between 1 and 8 specifying the QDIO buffer size in megabytes. If unspecified, the default is 8."/></div>'));
advanced.append($('<div><label>Routing:</label><select name="routingValue" title="Specifies whether the OSA-Express QDIO device will act as a router to the virtual switch">' +
'<option value="0">Unspecified</option>' +
'<option value="1">NONROUTER</option>' +
'<option value="2">PRIROUTER</option>' +
'</select></div>'));
'<option value="0">Unspecified</option>' +
'<option value="1">NONROUTER</option>' +
'<option value="2">PRIROUTER</option>' +
'</select></div>'));
advanced.append($('<div><label>Transport:</label><select name="transportType" title="Specifies the transport mechanism to be used for the virtual switch">' +
'<option value="0">Unspecified</option>' +
'<option value="1">IP</option>' +
'<option value="2">ETHERNET</option>' +
'</select></div>'));
'<option value="0">Unspecified</option>' +
'<option value="1">IP</option>' +
'<option value="2">ETHERNET</option>' +
'</select></div>'));
advanced.append($('<div><label>VLAN ID:</label><input type="text" name="vlanId" value="-1" title="Specifies the VLAN ID"/></div>'));
advanced.append($('<div><label>Port type:</label><select name="portType" title="Specifies the port type">' +
'<option value="0">Unspecified</option>' +
'<option value="1">ACCESS</option>' +
'<option value="2">TRUNK</option>' +
'</select></div>'));
'<option value="0">Unspecified</option>' +
'<option value="1">ACCESS</option>' +
'<option value="2">TRUNK</option>' +
'</select></div>'));
advanced.append($('<div><label>Update sysconfig:</label><select name="updateSysConfig" title="Specifies whether to add the virtual switch definition to the system configuration file">' +
'<option value="0">Unspecified</option>' +
'<option value="1">Create virtual switch</option>' +
'<option value="2">Create virtual switch and add definition to system configuration</option>' +
'<option value="3">Add virtual switch definition to system configuration</option>' +
'</select></div>'));
'<option value="0">Unspecified</option>' +
'<option value="1">Create virtual switch</option>' +
'<option value="2">Create virtual switch and add definition to system configuration</option>' +
'<option value="3">Add virtual switch definition to system configuration</option>' +
'</select></div>'));
advanced.append($('<div><label>GVRP:</label><select name="gvrp" title="GVRP will run only on 802.1Q trunk ports and is used primarily to prune traffic from VLANs that does not need to be passed between trunking switches">' +
'<option value="0">Unspecified</option>' +
'<option value="1">GVRP</option>' +
'<option value="2">NOGVRP</option>' +
'</select></div>'));
'<option value="0">Unspecified</option>' +
'<option value="1">GVRP</option>' +
'<option value="2">NOGVRP</option>' +
'</select></div>'));
advanced.append($('<div><label>Native VLAN ID:</label><input type="text" name="nativeVlanId" value="-1" title="The native VLAN ID"/></div>'));
// Create VLAN parameters
@ -2763,24 +2766,24 @@ function openAddVswitchVlanDialog(hcp) {
typeAttr.append(vswitchOptions, vlanOptions);
networkType.change(function() {
typeFS.show();
typeFS.show();
if ($(this).val() == "vswitch") {
typeFS.find("legend").text("vSwitch");
vswitchOptions.show();
vlanOptions.hide();
typeFS.find("legend").text("vSwitch");
vswitchOptions.show();
vlanOptions.hide();
} else if ($(this).val() == "vlan") {
typeFS.find("legend").text("VLAN");
vswitchOptions.hide();
vlanOptions.show();
typeFS.find("legend").text("VLAN");
vswitchOptions.hide();
vlanOptions.show();
} else {
typeFS.find("legend").text("");
vswitchOptions.hide();
vlanOptions.hide();
typeFS.hide();
typeFS.find("legend").text("");
vswitchOptions.hide();
vlanOptions.hide();
typeFS.hide();
}
});
// Generate tooltips
// Generate tooltips
addVswitchForm.find('div input[title],select[title]').tooltip({
position: "center right",
offset: [-2, 10],
@ -2837,10 +2840,10 @@ function openAddVswitchVlanDialog(hcp) {
var args = new Array('select[name=system]', 'input[name=switchName]', 'input[name=deviceAddress]', 'input[name=controllerName]');
for (var i in args) {
if (!$(this).find(args[i]).val()) {
$(this).find(args[i]).css('border', 'solid #FF0000 1px');
$(this).find(args[i]).css('border', 'solid #FF0000 1px');
ready = false;
} else {
$(this).find(args[i]).css('border', 'solid #BDBDBD 1px');
$(this).find(args[i]).css('border', 'solid #BDBDBD 1px');
}
}
@ -2911,10 +2914,10 @@ function openAddVswitchVlanDialog(hcp) {
var args = new Array('select[name=system]', 'input[name=vlanName]', 'input[name=vlanOwner]', 'select[name=vlanType]', 'select[name=vlanTransport]');
for (var i in args) {
if (!$(this).find(args[i]).val()) {
$(this).find(args[i]).css('border', 'solid #FF0000 1px');
$(this).find(args[i]).css('border', 'solid #FF0000 1px');
ready = false;
} else {
$(this).find(args[i]).css('border', 'solid #BDBDBD 1px');
$(this).find(args[i]).css('border', 'solid #BDBDBD 1px');
}
}
@ -3014,7 +3017,7 @@ function openRemoveVswitchVlanDialog(networkList) {
infoMsg = data.rsp;
}
openDialog("info", infoMsg);
openDialog("info", infoMsg);
}
});
} else if (type.indexOf("LAN") != -1) {
@ -3029,7 +3032,7 @@ function openRemoveVswitchVlanDialog(networkList) {
},
success: function(data) {
var infoMsg;
var infoMsg;
// Create info message
if (jQuery.isArray(data.rsp)) {
@ -3041,7 +3044,7 @@ function openRemoveVswitchVlanDialog(networkList) {
infoMsg = data.rsp;
}
openDialog("info", infoMsg);
openDialog("info", infoMsg);
}
});
}
@ -3234,8 +3237,8 @@ function getDiskPool(data) {
} // End of if
} // End of for
} else {
// Load empty table
loadDiskPoolTable();
// Load empty table
loadDiskPoolTable();
}
}
@ -3321,25 +3324,25 @@ function loadDiskPoolTable(data) {
var hcp2zvm = new Object();
var args, hcp, pool, stat, tmp;
if (data) {
// Do not continue if the call failed
if (!data.rsp.length && data.rsp[0].indexOf("Failed") > 0) {
return;
}
// Obtain mapping for zHCP to zVM system
hcp2zvm = getHcpZvmHash();
args = data.msg.split(';');
hcp = args[0].replace('hcp=', '');
pool = args[1].replace('pool=', '');
stat = args[2].replace('stat=', '');
tmp = data.rsp[0].split(hcp + ': ');
// Do not continue if the call failed
if (!data.rsp.length && data.rsp[0].indexOf("Failed") > 0) {
return;
}
// Obtain mapping for zHCP to zVM system
hcp2zvm = getHcpZvmHash();
args = data.msg.split(';');
hcp = args[0].replace('hcp=', '');
pool = args[1].replace('pool=', '');
stat = args[2].replace('stat=', '');
tmp = data.rsp[0].split(hcp + ': ');
} else {
// Provide empty values so the table will be generated
hcp = '';
pool = '';
stat = '';
tmp = new Array();
// Provide empty values so the table will be generated
hcp = '';
pool = '';
stat = '';
tmp = new Array();
}
// Resource tab ID
@ -3515,23 +3518,23 @@ function loadZfcpPoolTable(data) {
var hcp2zvm = new Object();
var args, hcp, pool, tmp;
if (data) {
// Do not continue if the call failed
if (!data.rsp.length && data.rsp[0].indexOf("Failed") > 0) {
return;
}
// Obtain mapping for zHCP to zVM system
hcp2zvm = getHcpZvmHash();
args = data.msg.split(';');
hcp = args[0].replace('hcp=', '');
pool = args[1].replace('pool=', '');
tmp = data.rsp[0].split(hcp + ': ');
// Do not continue if the call failed
if (!data.rsp.length && data.rsp[0].indexOf("Failed") > 0) {
return;
}
// Obtain mapping for zHCP to zVM system
hcp2zvm = getHcpZvmHash();
args = data.msg.split(';');
hcp = args[0].replace('hcp=', '');
pool = args[1].replace('pool=', '');
tmp = data.rsp[0].split(hcp + ': ');
} else {
// Provide empty values so the table will be generated
hcp = '';
pool = ''
tmp = new Array();
// Provide empty values so the table will be generated
hcp = '';
pool = ''
tmp = new Array();
}
// Resource tab ID
@ -3573,7 +3576,7 @@ function loadZfcpPoolTable(data) {
if (data) {
// Skip index 0 and 1 because it contains nothing
var key = "";
var key = "";
for ( var i = 2; i < tmp.length; i++) {
tmp[i] = jQuery.trim(tmp[i]);
var diskAttrs = tmp[i].split(',');
@ -3671,26 +3674,26 @@ function openRemoveDiskFromPoolDialog(disks2remove) {
var dialogId = 'zvmDeleteDiskFromPool';
var deleteDiskForm = $('<div id="' + dialogId + '" class="form"></div>');
// Obtain mapping for zHCP to zVM system
// Obtain mapping for zHCP to zVM system
var hcp2zvm = new Object();
hcp2zvm = getHcpZvmHash();
var disks = new Array();
if (disks2remove.indexOf(',') > -1)
disks = disks2remove.split(',');
disks = disks2remove.split(',');
else
disks.push(disks2remove);
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('-');
args = disks[i].split('-');
tgtHcp = args[0];
tgtPool = args[1];
tgtVol += args[2] + ',';
}
// Strip out last comma
// Strip out last comma
tgtVol = tgtVol.slice(0, -1);
// Create info bar
@ -3718,7 +3721,7 @@ function openRemoveDiskFromPoolDialog(disks2remove) {
// Append options for hardware control points
systemSelect.append($('<option value=""></option>'));
for (var hcp in hcp2zvm) {
systemSelect.append($('<option value="' + hcp2zvm[hcp] + '">' + hcp2zvm[hcp] + '</option>'));
systemSelect.append($('<option value="' + hcp2zvm[hcp] + '">' + hcp2zvm[hcp] + '</option>'));
}
systemSelect.val(tgtHcp);
@ -3736,7 +3739,7 @@ function openRemoveDiskFromPoolDialog(disks2remove) {
}
});
// Generate tooltips
// Generate tooltips
deleteDiskForm.find('div input[title],select[title]').tooltip({
position: "center right",
offset: [-2, 10],
@ -3781,10 +3784,10 @@ function openRemoveDiskFromPoolDialog(disks2remove) {
var args = new Array('select[name=system]', 'select[name=action]', 'input[name=region]', 'input[name=group]');
for (var i in args) {
if (!$(this).find(args[i]).val()) {
$(this).find(args[i]).css('border', 'solid #FF0000 1px');
$(this).find(args[i]).css('border', 'solid #FF0000 1px');
ready = false;
} else {
$(this).find(args[i]).css('border', 'solid #BDBDBD 1px');
$(this).find(args[i]).css('border', 'solid #BDBDBD 1px');
}
}
@ -3860,10 +3863,10 @@ function openAddDisk2PoolDialog() {
// Append options for hardware control points
systemSelect.append($('<option value=""></option>'));
for (var hcp in hcp2zvm) {
systemSelect.append($('<option value="' + hcp2zvm[hcp] + '">' + hcp2zvm[hcp] + '</option>'));
systemSelect.append($('<option value="' + hcp2zvm[hcp] + '">' + hcp2zvm[hcp] + '</option>'));
}
// Generate tooltips
// Generate tooltips
addDiskForm.find('div input[title],select[title]').tooltip({
position: "center right",
offset: [-2, 10],
@ -3908,10 +3911,10 @@ function openAddDisk2PoolDialog() {
var args = new Array('select[name=system]', 'select[name=action]', 'input[name=volume]', 'input[name=group]');
for (var i in args) {
if (!$(this).find(args[i]).val()) {
$(this).find(args[i]).css('border', 'solid #FF0000 1px');
$(this).find(args[i]).css('border', 'solid #FF0000 1px');
ready = false;
} else {
$(this).find(args[i]).css('border', 'solid #BDBDBD 1px');
$(this).find(args[i]).css('border', 'solid #BDBDBD 1px');
}
}
@ -4005,11 +4008,11 @@ function openRemoveZfcpFromPoolDialog(devices2remove) {
// Append options for hardware control points
systemSelect.append($('<option value=""></option>'));
for (var hcp in hcp2zvm) {
systemSelect.append($('<option value="' + hcp2zvm[hcp] + '">' + hcp2zvm[hcp] + '</option>'));
systemSelect.append($('<option value="' + hcp2zvm[hcp] + '">' + hcp2zvm[hcp] + '</option>'));
}
systemSelect.val(tgtHcp);
// Generate tooltips
// Generate tooltips
deleteDiskForm.find('div input[title],select[title]').tooltip({
position: "center right",
offset: [-2, 10],
@ -4053,10 +4056,10 @@ function openRemoveZfcpFromPoolDialog(devices2remove) {
var args = new Array('select[name=system]', 'input[name=zfcpPool]', 'input[name=zfcpUnitNo]');
for (var i in args) {
if (!$(this).find(args[i]).val()) {
$(this).find(args[i]).css('border', 'solid #FF0000 1px');
$(this).find(args[i]).css('border', 'solid #FF0000 1px');
ready = false;
} else {
$(this).find(args[i]).css('border', 'solid #BDBDBD 1px');
$(this).find(args[i]).css('border', 'solid #BDBDBD 1px');
}
}
@ -4074,7 +4077,7 @@ function openRemoveZfcpFromPoolDialog(devices2remove) {
var args = '--removezfcpfrompool;' + pool + ';' + unitNo;
if (portName) {
args += ';' + portName;
args += ';' + portName;
}
$.ajax({
url : 'lib/cmd.php',
@ -4130,10 +4133,10 @@ function openAddZfcp2PoolDialog() {
systemSelect.append($('<option value=""></option>'));
// Append options for hardware control points
for (var hcp in hcp2zvm) {
systemSelect.append($('<option value="' + hcp2zvm[hcp] + '">' + hcp2zvm[hcp] + '</option>'));
systemSelect.append($('<option value="' + hcp2zvm[hcp] + '">' + hcp2zvm[hcp] + '</option>'));
}
// Generate tooltips
// Generate tooltips
addDiskForm.find('div input[title],select[title]').tooltip({
position: "center right",
offset: [-2, 10],
@ -4186,10 +4189,10 @@ function openAddZfcp2PoolDialog() {
var args = new Array('select[name=system]', 'input[name=zfcpPool]', 'select[name=zfcpStatus]', 'input[name=zfcpPortName]', 'input[name=zfcpUnitNo]');
for (var i in args) {
if (!$(this).find(args[i]).val()) {
$(this).find(args[i]).css('border', 'solid #FF0000 1px');
$(this).find(args[i]).css('border', 'solid #FF0000 1px');
ready = false;
} else {
$(this).find(args[i]).css('border', 'solid #BDBDBD 1px');
$(this).find(args[i]).css('border', 'solid #BDBDBD 1px');
}
}
@ -4205,13 +4208,21 @@ function openAddZfcp2PoolDialog() {
'Close': function() {$(this).dialog("close");}
});
// zFCP range and owner are optional
var args = '--addzfcp2pool||' + tgtPool + '||' + tgtStatus + '||"' + tgtPortName + '"||' + tgtUnitNo + '||' + tgtSize;
if (tgtRange) {
args += '||' + tgtRange;
} if (tgtOwner) {
args += '||' + tgtOwner;
}
$.ajax( {
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'chhypervisor',
tgt : tgtSystem,
args : '--addzfcp2pool||' + tgtPool + '||' + tgtStatus + '||"' + tgtPortName + '"||' + tgtUnitNo + '||' + tgtSize + '||' + tgtRange + '||' + tgtOwner,
args : args,
msg : dialogId
},
@ -4326,10 +4337,10 @@ function loadNetworkTable(data) {
zvm = args[0].toLowerCase();
if (args[1].indexOf('.') != -1) {
tmp = args[1].split('.');
iHcp = tmp[0];
tmp = args[1].split('.');
iHcp = tmp[0];
} else {
iHcp = args[1];
iHcp = args[1];
}
hcp2zvm[iHcp] = zvm;
@ -4395,7 +4406,7 @@ function loadNetworkTable(data) {
// Determine the OSI layer
var layer = "3";
if (details.indexOf("ETHERNET") != -1) {
layer = "2";
layer = "2";
}
// Find the vSwitch/VLAN owner
@ -4409,7 +4420,7 @@ function loadNetworkTable(data) {
var controllers = "";
match = "";
while (match = regex.exec(details)) {
controllers += match[1] + ",";
controllers += match[1] + ",";
}
controllers = controllers.substring(0, controllers.length - 1); // Delete last two characters
@ -5271,11 +5282,11 @@ function createZProvisionNew(inst) {
var thisUserId = $('#' + thisTabId + ' input[name=userId]:visible');
var pos = thisUserEntry.val().indexOf('USER ' + thisUserId.val().toUpperCase());
if (pos < 0) {
pos = thisUserEntry.val().indexOf('IDENTITY ' + thisUserId.val().toUpperCase());
pos = thisUserEntry.val().indexOf('IDENTITY ' + thisUserId.val().toUpperCase());
if (pos < 0) {
errMsg = errMsg + 'The directory entry does not contain the correct user/identity ID.<br>';
ready = false;
errMsg = errMsg + 'The directory entry does not contain the correct user/identity ID.<br>';
ready = false;
}
}
@ -5713,7 +5724,7 @@ function setGoldenImagesCookies(data) {
var tmp = data.rsp[0].split(",");
for ( var i = 0; i < tmp.length; i++) {
if (tmp[i] != null && tmp[i] != "") {
copies.push(tmp[i]);
copies.push(tmp[i]);
}
}
@ -5764,6 +5775,20 @@ function setZfcpPoolCookies(data) {
}
}
/**
* Set a cookie for zHCP host names
*
* @param zhcps List of zHCPs known
*/
function setzHcpCookies(zhcps) {
if (zhcps.length) {
// Set cookie to expire in 60 minutes
var exDate = new Date();
exDate.setTime(exDate.getTime() + (240 * 60 * 1000));
$.cookie('zhcps', zhcps, { expires: exDate });
}
}
/**
* Create virtual machine (service page)
*
@ -5887,7 +5912,7 @@ function configProfilePanel(panelId) {
deleteLnk.click(function() {
var profiles = getNodesChecked(tableId);
if (profiles) {
deleteProfileDialog(profiles);
deleteProfileDialog(profiles);
}
});
@ -6054,7 +6079,7 @@ function profileDialog() {
profileForm.append('<div><label>Disk size (ECKD):</label><input type="text" name="disk_size_eckd" title="The default size of the disk, which can be given as G, M, or number of cylinders."/></div>');
profileForm.append('<div><label style="vertical-align: top;">Directory entry:</label><textarea name="directory_entry" title="The default directory entry for a node. The default user ID must be set to LXUSR."/></div>');
// Generate tooltips
// Generate tooltips
profileForm.find('div input[title],textarea[title],select[title]').tooltip({
position: "center right",
offset: [-2, 10],
@ -6235,7 +6260,7 @@ function editProfileDialog(profile, pool, size, entry) {
profileForm.find('input[name=disk_size_eckd]').val(size);
profileForm.find('textarea[name=directory_entry]').val(entry);
// Generate tooltips
// Generate tooltips
profileForm.find('div input[title],textarea[title],select[title]').tooltip({
position: "center right",
offset: [-2, 10],
@ -6336,7 +6361,7 @@ function editProfileDialog(profile, pool, size, entry) {
* @returns Hash map containing the zHCP to z/VM system mapping
*/
function getHcpZvmHash() {
// Get zVM host names
// Get zVM host names
if (!$.cookie('zvms')) {
$.ajax({
url : 'lib/cmd.php',
@ -6363,10 +6388,10 @@ function getHcpZvmHash() {
zvm = args[0].toLowerCase();
if (args[1].indexOf('.') != -1) {
tmp = args[1].split('.');
iHcp = tmp[0];
tmp = args[1].split('.');
iHcp = tmp[0];
} else {
iHcp = args[1];
iHcp = args[1];
}
hcp2zvm[iHcp] = zvm;

View File

@ -418,31 +418,31 @@ function mkAddNodeLink() {
var plugin;
switch(mgt) {
case "kvm":
plugin = new kvmPlugin();
break;
case "esx":
plugin = new esxPlugin();
break;
case "blade":
plugin = new bladePlugin();
break;
case "hmc":
plugin = new hmcPlugin();
break;
case "ipmi":
plugin = new ipmiPlugin();
break;
case "zvm":
plugin = new zvmPlugin();
break;
case "kvm":
plugin = new kvmPlugin();
break;
case "esx":
plugin = new esxPlugin();
break;
case "blade":
plugin = new bladePlugin();
break;
case "hmc":
plugin = new hmcPlugin();
break;
case "ipmi":
plugin = new ipmiPlugin();
break;
case "zvm":
plugin = new zvmPlugin();
break;
}
$(this).dialog('destroy').remove();
plugin.addNode();
},
'Cancel': function(){
$(this).dialog('destroy').remove();
$(this).dialog('destroy').remove();
}
}
});
@ -695,15 +695,15 @@ function loadNodes(data) {
// Create an instance of the plugin
var plugin;
switch(mgt) {
case "kvm":
plugin = new kvmPlugin();
break;
case "esx":
plugin = new esxPlugin();
break;
case "zvm":
plugin = new zvmPlugin();
break;
case "kvm":
plugin = new kvmPlugin();
break;
case "esx":
plugin = new esxPlugin();
break;
case "zvm":
plugin = new zvmPlugin();
break;
}
plugin.loadClonePage(tgtNodes[i]);
@ -732,7 +732,7 @@ function loadNodes(data) {
var scriptLnk = $('<a>Run script</a>');
scriptLnk.click(function() {
var tgtNodes = getNodesChecked(nodesTableId);
if (tgtNodes) {
if (tgtNodes) {
loadScriptPage(tgtNodes);
}
});
@ -740,21 +740,21 @@ function loadNodes(data) {
// Migrate VM
var migrateLnk = $('<a>Migrate</a>');
migrateLnk.click(function() {
var tgtNodes = getNodesChecked(nodesTableId).split(',');
var mgt = "", tmp = "";
var tgtNodes = getNodesChecked(nodesTableId).split(',');
var mgt = "", tmp = "";
for (var i in tgtNodes) {
tmp = getNodeAttr(tgtNodes[i], 'mgt');
tmp = getNodeAttr(tgtNodes[i], 'mgt');
if (!mgt) {
mgt = tmp
mgt = tmp
} else {
if (tmp != mgt) {
openDialog('warn', "You can pick only one type (mgt) of node to migrate!");
return;
}
if (tmp != mgt) {
openDialog('warn', "You can pick only one type (mgt) of node to migrate!");
return;
}
}
}
// Create an instance of the plugin
// Create an instance of the plugin
var plugin;
switch(mgt) {
// Only hypervisors support migration
@ -855,24 +855,24 @@ function loadNodes(data) {
// Create an instance of the plugin
var plugin;
switch(mgt) {
case "kvm":
plugin = new kvmPlugin();
break;
case "esx":
plugin = new esxPlugin();
break;
case "blade":
plugin = new bladePlugin();
break;
case "hmc":
plugin = new hmcPlugin();
break;
case "ipmi":
plugin = new ipmiPlugin();
break;
case "zvm":
plugin = new zvmPlugin();
break;
case "kvm":
plugin = new kvmPlugin();
break;
case "esx":
plugin = new esxPlugin();
break;
case "blade":
plugin = new bladePlugin();
break;
case "hmc":
plugin = new hmcPlugin();
break;
case "ipmi":
plugin = new ipmiPlugin();
break;
case "zvm":
plugin = new zvmPlugin();
break;
}
plugin.loadLogPage(tgtNodes[i]);
@ -1636,24 +1636,24 @@ function loadNode(e) {
// Create an instance of the plugin
var plugin;
switch(mgt) {
case "kvm":
plugin = new kvmPlugin();
break;
case "esx":
plugin = new esxPlugin();
break;
case "blade":
plugin = new bladePlugin();
break;
case "hmc":
plugin = new hmcPlugin();
break;
case "ipmi":
plugin = new ipmiPlugin();
break;
case "zvm":
plugin = new zvmPlugin();
break;
case "kvm":
plugin = new kvmPlugin();
break;
case "esx":
plugin = new esxPlugin();
break;
case "blade":
plugin = new bladePlugin();
break;
case "hmc":
plugin = new hmcPlugin();
break;
case "ipmi":
plugin = new ipmiPlugin();
break;
case "zvm":
plugin = new zvmPlugin();
break;
}
// Get tab area where a new tab will be inserted
@ -1758,13 +1758,13 @@ function loadUnlockPage(tgtNodes) {
*/
var unlockBtn = createButton('Unlock');
unlockBtn.css({
'width': '80px',
'display': 'block'
'width': '80px',
'display': 'block'
});
unlockBtn.click(function() {
// Remove any warning messages
$(this).parents('.ui-tabs-panel').find('.ui-state-error').remove();
// Remove any warning messages
$(this).parents('.ui-tabs-panel').find('.ui-state-error').remove();
// If a password is given
var password = $('#' + newTabId + ' input[name=password]').css('border', 'solid #BDBDBD 1px');
if (password.val()) {
@ -1822,7 +1822,7 @@ function loadScriptPage(tgtNodes) {
// Create remote script form
var scriptForm = $('<div class="form"></div>');
// Create status bar
// Create status bar
var barId = 'scriptStatusBar' + inst;
var statBar = createStatusBar(barId);
statBar.hide();
@ -1896,12 +1896,12 @@ function loadScriptPage(tgtNodes) {
*/
var runBtn = createButton('Run');
runBtn.css({
'width': '80px'
'width': '80px'
});
runBtn.click(function() {
// Remove any warning messages
$(this).parents('.ui-tabs-panel').find('.ui-state-error').remove();
// Remove any warning messages
$(this).parents('.ui-tabs-panel').find('.ui-state-error').remove();
// Get script to run
var textarea = $('#' + newTabId + ' textarea').css('border', 'solid #BDBDBD 1px');
@ -2010,7 +2010,7 @@ function loadDeletePage(tgtNodes) {
// Create delete form
var deleteForm = $('<div class="form"></div>');
// Create status bar, hide on load
// Create status bar, hide on load
var statBarId = 'deleteStatusBar' + inst;
var statBar = createStatusBar(statBarId).hide();
@ -2041,12 +2041,12 @@ function loadDeletePage(tgtNodes) {
*/
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";
}
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',
@ -2164,7 +2164,7 @@ function updateStatusBar(data) {
*/
function updatePowerStatus(data) {
// Hide power loader
var powerCol = $('#' + nodesTableId + '_wrapper .dataTables_scrollHead .datatable thead tr th:eq(3)');
var powerCol = $('#' + nodesTableId + '_wrapper .dataTables_scrollHead .datatable thead tr th:eq(3)');
powerCol.find('img').hide();
// Get datatable
@ -2218,8 +2218,8 @@ function runScript(inst) {
var statBarId = 'scriptStatusBar' + inst;
$('#' + statBarId).show(); // Show status bar
$('#' + statBarId + ' img').show(); // Show loader
$('#' + statBarId + ' p').remove(); // Clear status bar
$('#' + statBarId + ' img').show(); // Show loader
$('#' + statBarId + ' p').remove(); // Clear status bar
// Disable all fields
$('#' + tabId + ' input').attr('disabled', 'true');
@ -3250,14 +3250,16 @@ function advancedLoad(group){
}
var args;
var shortzHcps = new Array();
for (var h in hcps) {
// Get node without domain name
args = h.split('.');
shortzHcps.push(args[0]);
// If there are no disk pools or network names cookie for this hcp
if (!$.cookie(args[0] + 'diskpools') || !$.cookie(args[0] + 'networks')) {
// Check if SMAPI is online
$.ajax( {
$.ajax({
url : 'lib/cmd.php',
dataType : 'json',
data : {
@ -3270,10 +3272,13 @@ function advancedLoad(group){
// Load hardware control point specific info
// Get disk pools and network names
success : loadHcpInfo
});
});
}
} // End of for
// Save zHCPs as a cookie
setzHcpCookies(shortzHcps);
// Retrieve z/VM hypervisors and their zHCPs
if (!$.cookie('zvms')) {
$.ajax( {

View File

@ -536,7 +536,7 @@ function loadNodesTable(data) {
}
});
// Power softoff
// Power softoff
var powerSoftoffLnk = $('<a>Shutdown</a>');
powerSoftoffLnk.click(function() {
var tgtNodes = getNodesChecked(nodesDTId);

View File

@ -419,7 +419,7 @@ sub web_unlock {
my $password = $request->{arg}->[2];
# Unlock a node by setting up the SSH keys
my $out = `DSH_REMOTE_PASSWORD=$password xdsh $node -K`;
my $out = `DSH_REMOTE_PASSWORD=$password /opt/xcat/bin/xdsh $node -K`;
$callback->( { data => $out } );
}
@ -429,7 +429,7 @@ sub web_gangliastatus {
# Get node range
my $nr = $request->{arg}->[1];
my $out = `xdsh $nr "service gmond status"`;
my $out = `/opt/xcat/bin/xdsh $nr "service gmond status"`;
# Parse output, and use $callback to send back to the web interface
# Output looks like:
@ -466,21 +466,21 @@ sub web_gangliaconf() {
my $output;
# Add gangliamon to the monitoring table (if not already)
$output = `monadd gangliamon`;
$output = `/opt/xcat/bin/monadd gangliamon`;
# Run the ganglia configuration script on node
if ($nr) {
$output = `moncfg gangliamon $nr -r`;
$output = `/opt/xcat/bin/moncfg gangliamon $nr -r`;
}
else {
# If no node range is given, then assume all nodes
# Handle localhost (this needs to be 1st)
$output = `moncfg gangliamon`;
$output = `/opt/xcat/bin/moncfg gangliamon`;
# Handle remote nodes
$output .= `moncfg gangliamon -r`;
$output .= `/opt/xcat/bin/moncfg gangliamon -r`;
}
my @lines = split( '\n', $output );
@ -504,28 +504,28 @@ sub web_gangliastart() {
my $output;
# Add gangliamon to the monitoring table (if not already)
$output = `monadd gangliamon`;
$output = `/opt/xcat/bin/monadd gangliamon`;
# Start the gmond daemon on node
if ($nr) {
$output = `moncfg gangliamon $nr -r`;
$output .= `monstart gangliamon $nr -r`;
$output = `/opt/xcat/bin/moncfg gangliamon $nr -r`;
$output .= `/opt/xcat/bin/monstart gangliamon $nr -r`;
}
else {
# If no node range is given, then assume all nodes
# Handle localhost (this needs to be 1st)
$output = `moncfg gangliamon`;
$output = `/opt/xcat/bin/moncfg gangliamon`;
# Handle remote nodes
$output .= `moncfg gangliamon -r`;
$output .= `/opt/xcat/bin/moncfg gangliamon -r`;
# Handle localhost (this needs to be 1st)
$output .= `monstart gangliamon`;
$output .= `/opt/xcat/bin/monstart gangliamon`;
# Handle remote nodes
$output .= `monstart gangliamon -r`;
$output .= `/opt/xcat/bin/monstart gangliamon -r`;
}
my @lines = split( '\n', $output );
@ -550,17 +550,17 @@ sub web_gangliastop() {
# Stop the gmond daemon on node
if ($nr) {
$output = `monstop gangliamon $nr -r`;
$output = `/opt/xcat/bin/monstop gangliamon $nr -r`;
}
else {
# If no node range is given, then assume all nodes
# Handle localhost (this needs to be 1st)
$output = `monstop gangliamon`;
$output = `/opt/xcat/bin/monstop gangliamon`;
# Handle remote nodes
$output .= `monstop gangliamon -r`;
$output .= `/opt/xcat/bin/monstop gangliamon -r`;
}
my @lines = split( '\n', $output );
@ -585,7 +585,7 @@ sub web_gangliacheck() {
# Check if ganglia RPMs are installed
my $info;
my $info = `xdsh $nr "rpm -q ganglia-gmond libganglia libconfuse"`;
my $info = `/opt/xcat/bin/xdsh $nr "rpm -q ganglia-gmond libganglia libconfuse"`;
$callback->( { info => $info } );
return;
}
@ -686,7 +686,7 @@ sub web_installganglia() {
# Install Ganglia RPMs using updatenode
$callback->( { info => "$_: Installing Ganglia..." } );
$info = `updatenode $_ -S`;
$info = `/opt/xcat/bin/updatenode $_ -S`;
$callback->( { info => "$info" } );
}
@ -2032,9 +2032,9 @@ sub web_addnode {
}
if ( 'hmc' eq $nodetype ) {
`chdef -t node -o $hcpname username=$username password=$passwd mgt=hmc nodetype=$nodetype ip=$ip groups=all`;
`/opt/xcat/bin/chdef -t node -o $hcpname username=$username password=$passwd mgt=hmc nodetype=$nodetype ip=$ip groups=all`;
} else {
`chdef -t node -o $hcpname username=$username password=$passwd mgt=blade mpa=$hcpname nodetype=$nodetype id=0 groups=mm,all`;
`/opt/xcat/bin/chdef -t node -o $hcpname username=$username password=$passwd mgt=blade mpa=$hcpname nodetype=$nodetype id=0 groups=mm,all`;
}
return;
}
@ -2052,7 +2052,7 @@ sub web_addnode {
$temphash{ $tempArray[$i] } = $tempArray[ $i + 1 ];
}
`rscan $hcpname -z > /tmp/rscanall.tmp`;
`/opt/xcat/bin/rscan $hcpname -z > /tmp/rscanall.tmp`;
unless ( -e '/tmp/rscanall.tmp' ) {
return;
@ -2292,7 +2292,7 @@ sub web_passwd() {
my $encrypted = `perl -e "print crypt($password, $random)"`;
# Save in xCAT passwd table
`chtab username=$user passwd.key=xcat passwd.password=$encrypted`;
`/opt/xcat/sbin/chtab username=$user passwd.key=xcat passwd.password=$encrypted`;
my $info = "User password successfully updated";
$callback->( { info => $info } );
@ -2307,7 +2307,7 @@ sub web_policy() {
my $args = $request->{arg}->[2];
# Save in xCAT passwd and policy tables
my $out = `chtab priority=$priority $args`;
my $out = `/opt/xcat/sbin/chtab priority=$priority $args`;
my $info = "User policy successfully updated";
$callback->( { info => $info } );
@ -2323,8 +2323,8 @@ sub web_deleteuser() {
# Delete user from xCAT passwd and policy tables
foreach (@users) {
`chtab -d username=$_ passwd`;
`chtab -d name=$_ policy`;
`/opt/xcat/sbin/chtab -d username=$_ passwd`;
`/opt/xcat/sbin/chtab -d name=$_ policy`;
}
my $info = "User successfully deleted";
@ -2467,8 +2467,8 @@ sub web_updateosimage() {
my $provMethod = $request->{arg}->[7];
my $comments = $request->{arg}->[8];
`chtab -d imagename=$name osimage`;
`chtab osimage.imagename=$name osimage.imagetype=$type osimage.osarch=$arch osimage.osname=$osName osimage.osvers=$osVersion osimage.profile=$profile osimage.provmethod=$provMethod osimage.comments=$comments`;
`/opt/xcat/sbin/chtab -d imagename=$name osimage`;
`/opt/xcat/sbin/chtab osimage.imagename=$name osimage.imagetype=$type osimage.osarch=$arch osimage.osname=$osName osimage.osvers=$osVersion osimage.profile=$profile osimage.provmethod=$provMethod osimage.comments=$comments`;
my $info = "Image successfully updated";
$callback->( { info => $info } );
}
@ -2483,7 +2483,7 @@ sub web_rmosimage() {
# Delete user from xCAT passwd and policy tables
foreach (@names) {
`chtab -d imagename=$_ osimage`;
`/opt/xcat/sbin/chtab -d imagename=$_ osimage`;
}
my $info = "Image successfully deleted";
@ -2505,8 +2505,8 @@ sub web_updategroup() {
my $comments = $request->{arg}->[4];
$comments =~ s/'//g;
`chtab -d node=$name hosts`;
`chtab node=$name hosts.ip="$ip" hosts.hostnames="$hostnames" hosts.comments="$comments"`;
`/opt/xcat/sbin/chtab -d node=$name hosts`;
`/opt/xcat/sbin/chtab node=$name hosts.ip="$ip" hosts.hostnames="$hostnames" hosts.comments="$comments"`;
my $info = "Group successfully updated";
$callback->( { info => $info } );
@ -2522,7 +2522,7 @@ sub web_rmgroup() {
# Delete user from xCAT passwd and policy tables
foreach (@names) {
`chtab -d node=$_ hosts`;
`/opt/xcat/sbin/chtab -d node=$_ hosts`;
`rm -rf /var/opt/xcat/ippool/$_.pool`;
}

View File

@ -105,11 +105,11 @@ sub provzlinux {
}
# Check the max # of virtual machines allowed
my $out = `tabdump nodetype -w nodetype.comments=~"owner:$owner"`;
my $out = `/opt/xcat/sbin/tabdump nodetype -w nodetype.comments=~"owner:$owner"`;
my @tmp = split( /\n/, $out );
my $usrVM = scalar(@tmp) - 1;
$out = `webportal getmaxvm $owner`;
$out = `/opt/xcat/bin/webportal getmaxvm $owner`;
$out =~ s/Max allowed: //g;
my $maxVM = int($out);
@ -230,15 +230,15 @@ sub provzlinux {
# Set node definitions
# Also put node into all group
if ($group eq 'all') {
$out = `mkdef -t node -o $node userid=$userid hcp=$hcp mgt=zvm groups=$group`;
$out = `/opt/xcat/bin/mkdef -t node -o $node userid=$userid hcp=$hcp mgt=zvm groups=$group`;
} else {
# Put node in all group
$out = `mkdef -t node -o $node userid=$userid hcp=$hcp mgt=zvm groups=$group`;
$out = `/opt/xcat/bin/mkdef -t node -o $node userid=$userid hcp=$hcp mgt=zvm groups=$group`;
}
println( $callback, "$out" );
# Set nodetype definitions
$out = `chtab node=$node hosts.ip=$ip hosts.hostnames=$hostname noderes.netboot=zvm nodetype.nodetype=osi nodetype.provmethod=install nodetype.os=$os nodetype.arch=$arch nodetype.profile=$profile nodetype.comments="owner:$owner"`;
$out = `/opt/xcat/sbin/chtab node=$node hosts.ip=$ip hosts.hostnames=$hostname noderes.netboot=zvm nodetype.nodetype=osi nodetype.provmethod=install nodetype.os=$os nodetype.arch=$arch nodetype.profile=$profile nodetype.comments="owner:$owner"`;
# Create user directory entry replacing LXUSR with user ID
# Use /opt/zhcp/conf/default.direct on zHCP as the template
@ -246,7 +246,7 @@ sub provzlinux {
# INCLUDE LNXDFLT
# COMMAND SET VSWITCH VSW2 GRANT LXUSR
$out = `sed $default_direct -e s/LXUSR/$userid/g > /tmp/$node-direct.txt`;
$out = `mkvm $node /tmp/$node-direct.txt`;
$out = `/opt/xcat/bin/mkvm $node /tmp/$node-direct.txt`;
`rm -rf /tmp/$node-direct.txt`;
println( $callback, "$out" );
if ( $out =~ m/Error/i ) {
@ -286,7 +286,7 @@ sub provzlinux {
foreach (@$type) {
# Add ECKD disk
if ( $_ =~ m/dasd_eckd_mod/i ) {
$out = `chvm $node --add3390 $disk_pool $virt_addr $eckd_size MR`;
$out = `/opt/xcat/bin/chvm $node --add3390 $disk_pool $virt_addr $eckd_size MR`;
println( $callback, "$out" );
if ( $out =~ m/Error/i ) {
return;
@ -317,7 +317,7 @@ sub provzlinux {
# Add ECKD disk for each device found
for $dev ( keys %devices ) {
$out = `chvm $node --add3390 $disk_pool $virt_addr $eckd_size MR`;
$out = `/opt/xcat/bin/chvm $node --add3390 $disk_pool $virt_addr $eckd_size MR`;
println( $callback, "$out" );
if ( $out =~ m/Error/i ) {
return;
@ -328,36 +328,35 @@ sub provzlinux {
}
}
# Update hosts table and DNS
`makehosts`;
`makedns`;
# Update hosts table
`/opt/xcat/sbin/makehosts`;
# Update DHCP
`makedhcp -a`;
# Toggle node power so COMMAND SET will get executed
`rpower $node on`;
`rpower $node off`;
`/opt/xcat/bin/rpower $node on`;
`/opt/xcat/bin/rpower $node off`;
# Punch kernel, initrd, and ramdisk to node reader
$out = `nodeset $node install`;
$out = `/opt/xcat/sbin/nodeset $node install`;
println( $callback, "$out" );
if ( $out =~ m/Error/i ) {
return;
}
# IPL reader and begin installation
$out = `rnetboot $node ipl=00C`;
$out = `/opt/xcat/bin/rnetboot $node ipl=00C`;
println( $callback, "$out" );
if ( $out =~ m/Error/i ) {
return;
}
# Configure Ganglia monitoring
$out = `moncfg gangliamon $node -r`;
$out = `/opt/xcat/bin/moncfg gangliamon $node -r`;
# Show node information, e.g. IP, hostname, and root password
$out = `lsdef $node -i ip,hostnames | egrep "ip=|hostnames="`;
$out = `/opt/xcat/bin/lsdef $node -i ip,hostnames | egrep "ip=|hostnames="`;
my $rootpw = getsysrootpw();
println( $callback, "Your virtual machine is ready. It may take a few minutes before you can logon using VNC ($node:1). Below is your VM attributes." );
println( $callback, "$out" );
@ -569,7 +568,7 @@ sub gennodename {
}
# 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/100% packet loss/)) {
while (`/opt/xcat/bin/nodels $hostname` || `cat /etc/hosts | grep "$ipaddr "` || !(`ping -c 4 $ipaddr` =~ m/100% packet loss/)) {
# Base digit invalid if over 254
if ($base_digit > $range_high) {
last;
@ -603,11 +602,11 @@ sub clonezlinux {
my $owner = $request->{arg}->[3];
# Check the max # of virtual machines allowed
my $out = `tabdump nodetype -w nodetype.comments=~"owner:$owner"`;
my $out = `/opt/xcat/sbin/tabdump nodetype -w nodetype.comments=~"owner:$owner"`;
my @tmp = split( /\n/, $out );
my $usrVM = scalar(@tmp) - 1;
$out = `webportal getmaxvm $owner`;
$out = `/opt/xcat/bin/webportal getmaxvm $owner`;
$out =~ s/Max allowed: //g;
my $maxVM = int($out);
@ -688,34 +687,34 @@ sub clonezlinux {
my $userid = $node;
# Set node definitions
$out = `mkdef -t node -o $node userid=$userid hcp=$hcp mgt=zvm groups=$group`;
$out = `/opt/xcat/bin/mkdef -t node -o $node userid=$userid hcp=$hcp mgt=zvm groups=$group`;
println( $callback, "$out" );
# Set nodetype definitions
$out = `chtab node=$node hosts.ip=$ip hosts.hostnames=$hostname noderes.netboot=zvm nodetype.nodetype=osi nodetype.provmethod=install nodetype.os=$os nodetype.arch=$arch nodetype.profile=$profile nodetype.comments="owner:$owner"`;
$out = `/opt/xcat/sbin/chtab node=$node hosts.ip=$ip hosts.hostnames=$hostname noderes.netboot=zvm nodetype.nodetype=osi nodetype.provmethod=install nodetype.os=$os nodetype.arch=$arch nodetype.profile=$profile nodetype.comments="owner:$owner"`;
# Update hosts table and DNS
# Update hosts table
sleep(5); # Time needed to update /etc/hosts
`makehosts`;
`makedns`;
`/opt/xcat/sbin/makehosts`;
`/opt/xcat/sbin/makedns`;
# Update DHCP
`makedhcp -a`;
`/opt/xcat/sbin/makedhcp -a`;
println( $callback, "hosts table, DHCP, and DNS updated" );
# Clone virtual machine
sleep(5); # Time needed to update /etc/hosts
$out = `mkvm $node $src_node pool=$disk_pool`;
$out = `/opt/xcat/bin/mkvm $node $src_node pool=$disk_pool`;
println( $callback, "$out" );
if ( $out =~ m/Error/i || $out =~ m/Failed/i ) {
return;
}
# Configure Ganglia monitoring
$out = `moncfg gangliamon $node -r`;
$out = `/opt/xcat/bin/moncfg gangliamon $node -r`;
# Show node information, e.g. IP, hostname, and root password
$out = `lsdef $node | egrep "ip=|hostnames="`;
$out = `/opt/xcat/bin/lsdef $node | egrep "ip=|hostnames="`;
my $rootpw = getsysrootpw();
println( $callback, "Your virtual machine is ready. It may take a few minutes before you can logon. Below is your VM attributes." );
println( $callback, "$out" );
@ -864,7 +863,7 @@ sub findfreenode {
if ($node && $ipaddr && $hostname) {
# Check against xCAT tables, /etc/hosts, and ping to see if hostname is already used
if (`nodels $node` || `cat /etc/hosts | grep "$ipaddr "` || !(`ping -c 4 $ipaddr` =~ m/100% packet loss/)) {
if (`/opt/xcat/bin/nodels $node` || `cat /etc/hosts | grep "$ipaddr "` || !(`ping -c 4 $ipaddr` =~ m/100% packet loss/)) {
next;
} else {
$found = 1;