Added real-time output to service page.

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@10768 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
phamt 2011-10-14 00:02:12 +00:00
parent b0cd72a3ac
commit 7091d1ecaa
4 changed files with 38 additions and 81 deletions

View File

@ -22,35 +22,14 @@ var zvmPlugin = function() {
* Node to clone
* @return Nothing
*/
zvmPlugin.prototype.serviceClone = function(node) {
var statBar = createStatusBar(node + 'CloneStat');
var loader = createLoader('');
statBar.find('div').append(loader);
statBar.prependTo($('#manageTab'));
zvmPlugin.prototype.serviceClone = function(node) {
var owner = $.cookie('srv_usrname');
var group = getUserNodeAttr(node, 'groups');
// Submit request to clone VM
// webportal clonezlinux [src node] [group] [owner]
$.ajax({
url : 'lib/srv_cmd.php',
dataType : 'json',
data : {
cmd : 'webportal',
tgt : '',
args : 'clonezlinux;' + node + ';' + group + ';' + owner,
msg : ''
},
success:function(data) {
// Remove loader
statBar.find('img').remove();
// Append output to status bar
for (var i in data.rsp) {
statBar.find('div').append($('<pre></pre>').append(data.rsp[i]));
}
}
});
var iframe = createIFrame('lib/srv_cmd.php?cmd=webportal&tgt=&args=clonezlinux;' + node + ';' + group + ';' + owner + '&msg=&opts=flush');
iframe.prependTo($('#manageTab'));
};
/**

View File

@ -2803,43 +2803,8 @@ function setDiskPoolCookies(data) {
* @return Nothing
*/
function createzVM(tabId, group, hcp, img, owner) {
var statBar = createStatusBar('zvmProvsionStatBar');
var loader = createLoader('zvmProvisionLoader');
statBar.find('div').append(loader);
statBar.prependTo($('#' + tabId));
// Submit request to create VM
// webportal provzlinux [group] [hcp] [image] [owner]
$.ajax({
url : 'lib/srv_cmd.php',
dataType : 'json',
data : {
cmd : 'webportal',
tgt : '',
args : 'provzlinux;' + group + ';' + hcp + ';' + img + ';' + owner,
msg : ''
},
success:function(data){
$('#zvmProvisionLoader').remove();
for(var i in data.rsp){
$('#zvmProvsionStatBar').find('div').append('<pre>' + data.rsp[i] + '</pre>');
}
// Refresh nodes table
$.ajax( {
url : 'lib/srv_cmd.php',
dataType : 'json',
data : {
cmd : 'tabdump',
tgt : '',
args : 'nodetype',
msg : ''
},
success : function(data) {
setUserNodes(data);
}
});
}
});
var iframe = createIFrame('lib/srv_cmd.php?cmd=webportal&tgt=&args=provzlinux;' + group + ';' + hcp + ';' + img + ';' + owner + '&msg=&opts=flush');
iframe.prependTo($('#' + tabId));
}

View File

@ -94,7 +94,25 @@ function loadServicePage() {
var manageTabId = 'manageTab';
serviceTabs.add(manageTabId, 'Manage', '', false);
loadManagePage(manageTabId);
// Get nodes owned by user
$.ajax( {
url : 'lib/srv_cmd.php',
dataType : 'json',
data : {
cmd : 'tabdump',
tgt : '',
args : 'nodetype',
msg : ''
},
success : function(data) {
setUserNodes(data);
getUserNodesDef();
getNodesCurrentLoad();
loadManagePage(manageTabId);
}
});
var provTabId = 'provisionTab';
serviceTabs.add(provTabId, 'Provision', '', false);
@ -137,24 +155,6 @@ function loadServicePage() {
}
});
}
// Get nodes owned by user
$.ajax( {
url : 'lib/srv_cmd.php',
dataType : 'json',
data : {
cmd : 'tabdump',
tgt : '',
args : 'nodetype',
msg : ''
},
success : function(data) {
setUserNodes(data);
getUserNodesDef();
getNodesCurrentLoad();
}
});
}
/**

View File

@ -100,7 +100,19 @@ sub provzlinux {
my $eckd_size;
my $fba_size;
my $default_conf = '/opt/zhcp/conf/default.conf';
my $default_direct = '/opt/zhcp/conf/default.direct';
my $default_direct = "/opt/zhcp/conf/$group.direct";
# Check if a group based directory entry exists, else use default one
if ( !(`ssh $hcp "test -e /opt/zhcp/conf/$group.direct && echo Exists"`) ) {
$default_direct = '/opt/zhcp/conf/default.direct';
println( $callback, "$group.direct does not exist. Using default.direct to generate directory entry." );
# Exit if default.direct does not exist
if ( !(`ssh $hcp "test -e /opt/zhcp/conf/default.direct && echo Exists"`) ) {
println( $callback, '(Error) $default_direct does not exists' );
return;
}
}
# Exit if default.conf does not exist
if ( !(`ssh $hcp "test -e $default_conf && echo Exists"`) ) {
@ -439,6 +451,7 @@ sub clonezlinux {
# Update DHCP
`makedhcp -a`;
println( $callback, "hosts table, DHCP, and DNS updated" );
# Clone virtual machine
$out = `mkvm $node $src_node pool=$disk_pool`;