Cleaned up code. Fixed bug where max-vm is not correctly retrieved.
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11630 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		@@ -1397,7 +1397,7 @@ function loadGangliaStatus(data) {
 | 
			
		||||
	// Get datatable
 | 
			
		||||
	var datatable = $('#' + nodesTableId).dataTable();
 | 
			
		||||
	var ganglia = data.rsp;
 | 
			
		||||
	var rowNum, node, status, args;
 | 
			
		||||
	var rowNum, node, status;
 | 
			
		||||
 | 
			
		||||
	for ( var i in ganglia) {
 | 
			
		||||
		// ganglia[0] = nodeName and ganglia[1] = state
 | 
			
		||||
@@ -2052,6 +2052,9 @@ function updateStatusBar(data) {
 | 
			
		||||
				dTable.fnDeleteRow(rowPos);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		// Adjust column size
 | 
			
		||||
		adjustColumnSize(nodesTableId);
 | 
			
		||||
	} else if (cmd == 'xdsh') {
 | 
			
		||||
		// Hide loader
 | 
			
		||||
		$('#' + statBarId).find('img').hide();
 | 
			
		||||
 
 | 
			
		||||
@@ -191,14 +191,20 @@ function loadServiceProvisionPage(tabId) {
 | 
			
		||||
	okBtn.bind('click', function(event) {
 | 
			
		||||
		var userName = $.cookie('srv_usrname');
 | 
			
		||||
		var tmp = $.cookie(userName + '_usrnodes');
 | 
			
		||||
		var nodes = tmp.split(',');
 | 
			
		||||
		var maxVM = parseInt($.cookie(userName + '_maxvm'));
 | 
			
		||||
		
 | 
			
		||||
		// Do not allow user to clone if the maximum number of VMs is reached
 | 
			
		||||
		if (nodes.length >= maxVM) {
 | 
			
		||||
			var warn = createWarnBar('You have reached the maximum number of VMs allowed.  Please de-allocate some existing VMs to free up space or contact your system administrator request more VMs.');
 | 
			
		||||
			warn.prependTo($('#' + tabId));
 | 
			
		||||
			return;
 | 
			
		||||
		// Get maximun number for nodes from cookie
 | 
			
		||||
		var nodes = '';
 | 
			
		||||
		var maxVM = 0;
 | 
			
		||||
		if (tmp.length) {
 | 
			
		||||
			nodes = tmp.split(',');
 | 
			
		||||
			maxVM = parseInt($.cookie(userName + '_maxvm'));
 | 
			
		||||
			
 | 
			
		||||
			// Do not allow user to clone if the maximum number of VMs is reached
 | 
			
		||||
			if (nodes.length >= maxVM) {
 | 
			
		||||
				var warn = createWarnBar('You have reached the maximum number of virtual machines allowed (' + maxVM + ').  Delete unused virtual machines or contact your system administrator request more virtual machines.');
 | 
			
		||||
				warn.prependTo($('#' + tabId));
 | 
			
		||||
				return;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		// Get hardware that was selected
 | 
			
		||||
@@ -276,8 +282,7 @@ function loadServiceProvisionPage(tabId) {
 | 
			
		||||
 */
 | 
			
		||||
function loadManagePage(tabId) {
 | 
			
		||||
	// Create manage form
 | 
			
		||||
	var loader = createLoader('');
 | 
			
		||||
	var manageForm = $('<div></div>').append(loader);
 | 
			
		||||
	var manageForm = $('<div></div>');
 | 
			
		||||
 | 
			
		||||
	// Append to manage tab
 | 
			
		||||
	$('#' + tabId).append(manageForm);
 | 
			
		||||
@@ -305,8 +310,7 @@ function getUserNodesDef() {
 | 
			
		||||
	    });
 | 
			
		||||
	} else {
 | 
			
		||||
		// Clear the tab before inserting the table
 | 
			
		||||
		$('#manageTab').children().remove();
 | 
			
		||||
		$('#manageTab').append(createWarnBar('Could not find any nodes that belong to you. Do you have any? Or did your session expire?'));
 | 
			
		||||
		$('#manageTab').append(createWarnBar('No nodes were found belonging to you!'));
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -1295,7 +1299,7 @@ function cloneNode(tgtNodes) {
 | 
			
		||||
	
 | 
			
		||||
	// Do not allow user to clone if the maximum number of VMs is reached
 | 
			
		||||
	if (usrNodes.length >= maxVM) {
 | 
			
		||||
		var warn = createWarnBar('You have reached the maximum number of VMs allowed.  Please de-allocate some existing VMs to free up space or contact your system administrator request more VMs.');
 | 
			
		||||
		var warn = createWarnBar('You have reached the maximum number of virtual machines allowed (' + maxVM + ').  Delete un-used virtual machines or contact your system administrator request more virtual machines.');
 | 
			
		||||
		warn.prependTo($('#manageTab'));
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -224,7 +224,7 @@ sub provzlinux {
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	my $userid = 'XCAT' . $base_digit;
 | 
			
		||||
	my $userid = $node;
 | 
			
		||||
 | 
			
		||||
	# Set node definitions
 | 
			
		||||
	# Also put node into all group
 | 
			
		||||
@@ -670,7 +670,7 @@ sub clonezlinux {
 | 
			
		||||
	# Create VM
 | 
			
		||||
	# e.g. webportal provzlinux [group] [hcp] [image]
 | 
			
		||||
	my ($node, $ip, $base_digit) = gennodename( $callback, $group );
 | 
			
		||||
	my $userid = 'XCAT' . $base_digit;
 | 
			
		||||
	my $userid = $node;
 | 
			
		||||
		
 | 
			
		||||
	# Set node definitions
 | 
			
		||||
	$out = `mkdef -t node -o $node userid=$userid hcp=$hcp mgt=zvm groups=$group`;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user