Checked if SMAPI is running before getting disk pools and network names. If SMAPI is offline, then allow the user to restart it.

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8021 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
phamt 2010-11-03 16:23:54 +00:00
parent 54a3d48079
commit d485f74ed3
2 changed files with 133 additions and 22 deletions

View File

@ -46,6 +46,129 @@ function setNetworkDataTable(table) {
networkDatatable = table;
}
/**
* Load HCP specific info
*
* @param data
* Data from HTTP request
* @return Nothing
*/
function loadHcpInfo(data) {
var args = data.msg.split(';');
// Get group
var group = args[0].replace('group=', '');
// Get hardware control point
var hcp = args[1].replace('hcp=', '');
// Get user directory entry
var userEntry = data.rsp;
if (userEntry) {
// Get disk pools
$.ajax( {
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'lsvm',
tgt : hcp,
args : '--diskpoolnames',
msg : hcp
},
success : setDiskPoolCookies
});
// Get network names
$.ajax( {
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'lsvm',
tgt : hcp,
args : '--getnetworknames',
msg : hcp
},
success : setNetworkCookies
});
} else {
// Create warning dialog
var warnDialog = $('<div class="ui-state-error ui-corner-all">'
+ '<p><span class="ui-icon ui-icon-alert"></span>'
+ 'z/VM SMAPI is not responding to ' + hcp + '. It needs to be reset.</p>'
+ '</div>');
// Open dialog
warnDialog.dialog({
modal: true,
width: 400,
buttons: {
"Reset": function(){
$(this).dialog("close");
// Reset SMAPI
$.ajax( {
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'chvm',
tgt : hcp,
args : '--resetsmapi',
msg : 'group=' + group + ';hcp=' + hcp
},
/**
* Refresh group tab
*
* @param data
* Data from HTTP request
* @return Nothing
*/
success : function(data) {
var args = data.msg.split(';');
// Get group
var group = args[0].replace('group=', '');
// Get hardware control point
var hcp = args[1].replace('hcp=', '');
// Clear nodes division
$('#nodes').children().remove();
// Create loader
var loader = $('<center></center>').append(createLoader());
// Create a tab for this group
var tab = new Tab();
setNodesTab(tab);
tab.init();
$('#nodes').append(tab.object());
tab.add('nodesTab', 'Nodes', loader, false);
// Get nodes within selected group
$.ajax( {
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'lsdef',
tgt : '',
args : group,
msg : group
},
success : loadNodes
});
} // End of function
});
},
"Ignore": function() {
$(this).dialog("close");
}
}
});
}
}
/**
* Load user entry of a given node
*

View File

@ -563,36 +563,24 @@ function loadNodes(data) {
for ( var h in hcps) {
// Get node without domain name
args = h.split('.');
// Get disk pools
// Check if SMAPI is online
$.ajax( {
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'lsvm',
tgt : args[0],
args : '--diskpoolnames',
msg : args[0]
args : '',
msg : 'group=' + group + ';hcp=' + args[0]
},
success : setDiskPoolCookies
});
// Get network names
$.ajax( {
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'lsvm',
tgt : args[0],
args : '--getnetworknames',
msg : args[0]
},
success : setNetworkCookies
});
}
}
// Load hardware control point (HCP) specific info
// Get disk pools and network names
success : loadHcpInfo
});
} // End of for
} // End of if
}
/**