Fixed argument passing delimiter. Added warnings to the UI. Added check for userprefix file.
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@15111 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
1616e26c94
commit
aba74b7d52
@ -323,7 +323,7 @@ function openCreateUserDialog(data) {
|
||||
data : {
|
||||
cmd : 'webrun',
|
||||
tgt : '',
|
||||
args : 'policy|' + priority + '|' + args,
|
||||
args : 'policy||' + priority + '||' + args,
|
||||
msg : dialogId
|
||||
},
|
||||
|
||||
@ -337,7 +337,7 @@ function openCreateUserDialog(data) {
|
||||
data : {
|
||||
cmd : 'webrun',
|
||||
tgt : '',
|
||||
args : 'passwd|' + usrName + '|' + password,
|
||||
args : 'passwd||' + usrName + '||' + password,
|
||||
msg : dialogId
|
||||
},
|
||||
|
||||
@ -455,7 +455,7 @@ function openDeleteUserDialog(users) {
|
||||
data : {
|
||||
cmd : 'webrun',
|
||||
tgt : '',
|
||||
args : 'deleteuser|' + users,
|
||||
args : 'deleteuser||' + users,
|
||||
msg : dialogId
|
||||
},
|
||||
success : updatePanel
|
||||
|
@ -70,6 +70,15 @@ esxPlugin.prototype.loadConfigPage = function(tabId) {
|
||||
profileLnk.trigger('click');
|
||||
};
|
||||
|
||||
/**
|
||||
* Migrate node
|
||||
*
|
||||
* @param node Node to migrate
|
||||
*/
|
||||
esxPlugin.prototype.loadMigratePage = function(node) {
|
||||
openDialog('info', 'Not yet supported');
|
||||
};
|
||||
|
||||
/**
|
||||
* Clone node (service page)
|
||||
*
|
||||
|
@ -68,6 +68,15 @@ kvmPlugin.prototype.loadConfigPage = function(tabId) {
|
||||
profileLnk.trigger('click');
|
||||
};
|
||||
|
||||
/**
|
||||
* Migrate node
|
||||
*
|
||||
* @param node Node to migrate
|
||||
*/
|
||||
kvmPlugin.prototype.loadMigratePage = function(node) {
|
||||
openDialog('info', 'Not yet supported');
|
||||
};
|
||||
|
||||
/**
|
||||
* Clone node (service page)
|
||||
*
|
||||
|
@ -2394,18 +2394,16 @@ zvmPlugin.prototype.loadMigratePage = function(tgtNode) {
|
||||
if (maxQuiesce.val() <= 0) {
|
||||
args = args + "max_quiesce=NOLIMIT;";
|
||||
} else {
|
||||
args = args + "'max_quiesce=" + maxQuiesce.val() + "';";
|
||||
args = args + "max_quiesce=" + maxQuiesce.val() + ";";
|
||||
}
|
||||
|
||||
// Append force argument
|
||||
if ($("input[name=force]:checked").length > 0) {
|
||||
args = args + "'force="
|
||||
$("input[name=force]:checked").each(function() {
|
||||
args = args + $(this).val() + ' ';
|
||||
args += $(this).val() + ' ';
|
||||
});
|
||||
args = args + "';";
|
||||
} else {
|
||||
args = args + ";";
|
||||
args += "';";
|
||||
}
|
||||
|
||||
var statBarId = 'migrateStatusBar' + inst;
|
||||
|
@ -1993,7 +1993,7 @@ function openAddScsi2SystemDialog(hcp) {
|
||||
data : {
|
||||
cmd : 'chhypervisor',
|
||||
tgt : hcp,
|
||||
args : "--addscsi|" + num + "|" + pathArray + "|" + option + "|" + persist,
|
||||
args : "--addscsi||" + num + "||" + pathArray + "||" + option + "||" + persist,
|
||||
msg : dialogId
|
||||
},
|
||||
|
||||
@ -2707,7 +2707,7 @@ function removeZfcp(node, address, wwpn, lun) {
|
||||
data : {
|
||||
cmd : 'chvm',
|
||||
tgt : node,
|
||||
args : '--removezfcp;' + address + ';' + wwpn + ';' + lun,
|
||||
args : '--removezfcp||' + address + '||' + wwpn + '||' + lun,
|
||||
msg : node
|
||||
},
|
||||
|
||||
@ -3624,7 +3624,7 @@ function openAddZfcp2PoolDialog() {
|
||||
data : {
|
||||
cmd : 'chvm',
|
||||
tgt : tgtHcp,
|
||||
args : '--addzfcp2pool|' + tgtPool + '|' + tgtStatus + '|"' + tgtPortName + '"|' + tgtUnitNo + '|' + tgtSize + "| " + tgtRange + '|' + tgtOwner,
|
||||
args : '--addzfcp2pool||' + tgtPool + '||' + tgtStatus + '||"' + tgtPortName + '"||' + tgtUnitNo + '||' + tgtSize + '||' + tgtRange + '||' + tgtOwner,
|
||||
msg : dialogId
|
||||
},
|
||||
|
||||
|
@ -418,24 +418,24 @@ 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;
|
||||
}
|
||||
|
||||
plugin.addNode();
|
||||
@ -686,24 +686,15 @@ function loadNodes(data) {
|
||||
// Create an instance of the plugin
|
||||
var plugin;
|
||||
switch(mgt) {
|
||||
case "blade":
|
||||
plugin = new bladePlugin();
|
||||
break;
|
||||
case "fsp":
|
||||
plugin = new fspPlugin();
|
||||
break;
|
||||
case "hmc":
|
||||
plugin = new hmcPlugin();
|
||||
break;
|
||||
case "ipmi":
|
||||
plugin = new ipmiPlugin();
|
||||
break;
|
||||
case "ivm":
|
||||
plugin = new ivmPlugin();
|
||||
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]);
|
||||
@ -741,34 +732,35 @@ function loadNodes(data) {
|
||||
var migrateLnk = $('<a>Migrate</a>');
|
||||
migrateLnk.click(function() {
|
||||
var tgtNodes = getNodesChecked(nodesTableId).split(',');
|
||||
var mgt = "", tmp = "";
|
||||
for (var i in tgtNodes) {
|
||||
var mgt = getNodeAttr(tgtNodes[i], 'mgt');
|
||||
|
||||
// Create an instance of the plugin
|
||||
var plugin;
|
||||
switch(mgt) {
|
||||
case "blade":
|
||||
plugin = new bladePlugin();
|
||||
break;
|
||||
case "fsp":
|
||||
plugin = new fspPlugin();
|
||||
break;
|
||||
case "hmc":
|
||||
plugin = new hmcPlugin();
|
||||
break;
|
||||
case "ipmi":
|
||||
plugin = new ipmiPlugin();
|
||||
break;
|
||||
case "ivm":
|
||||
plugin = new ivmPlugin();
|
||||
break;
|
||||
case "zvm":
|
||||
plugin = new zvmPlugin();
|
||||
break;
|
||||
tmp = getNodeAttr(tgtNodes[i], 'mgt');
|
||||
if (!mgt) {
|
||||
mgt = tmp
|
||||
} else {
|
||||
if (tmp != mgt) {
|
||||
openDialog('warn', "You can pick only one type (mgt) of node to migrate!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
plugin.loadMigratePage(tgtNodes[i]);
|
||||
}
|
||||
|
||||
// Create an instance of the plugin
|
||||
var plugin;
|
||||
switch(mgt) {
|
||||
// Only hypervisors support migration
|
||||
case "kvm":
|
||||
plugin = new kvmPlugin();
|
||||
break;
|
||||
case "esx":
|
||||
plugin = new esxPlugin();
|
||||
break;
|
||||
case "zvm":
|
||||
plugin = new zvmPlugin();
|
||||
break;
|
||||
}
|
||||
|
||||
plugin.loadMigratePage(tgtNodes);
|
||||
});
|
||||
|
||||
// Update
|
||||
@ -854,24 +846,24 @@ function loadNodes(data) {
|
||||
// Create an instance of the plugin
|
||||
var plugin;
|
||||
switch(mgt) {
|
||||
case "blade":
|
||||
plugin = new bladePlugin();
|
||||
break;
|
||||
case "fsp":
|
||||
plugin = new fspPlugin();
|
||||
break;
|
||||
case "hmc":
|
||||
plugin = new hmcPlugin();
|
||||
break;
|
||||
case "ipmi":
|
||||
plugin = new ipmiPlugin();
|
||||
break;
|
||||
case "ivm":
|
||||
plugin = new ivmPlugin();
|
||||
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]);
|
||||
@ -1635,24 +1627,24 @@ function loadNode(e) {
|
||||
// Create an instance of the plugin
|
||||
var plugin;
|
||||
switch(mgt) {
|
||||
case "blade":
|
||||
plugin = new bladePlugin();
|
||||
break;
|
||||
case "fsp":
|
||||
plugin = new fspPlugin();
|
||||
break;
|
||||
case "hmc":
|
||||
plugin = new hmcPlugin();
|
||||
break;
|
||||
case "ipmi":
|
||||
plugin = new ipmiPlugin();
|
||||
break;
|
||||
case "ivm":
|
||||
plugin = new ivmPlugin();
|
||||
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
|
||||
|
@ -858,18 +858,15 @@ function loadNode(e) {
|
||||
// Create an instance of the plugin
|
||||
var plugin;
|
||||
switch (mgt) {
|
||||
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 "zvm":
|
||||
plugin = new zvmPlugin();
|
||||
break;
|
||||
}
|
||||
|
||||
// Select tab
|
||||
@ -1317,18 +1314,15 @@ function cloneNode(tgtNodes) {
|
||||
// Create an instance of the plugin
|
||||
var plugin;
|
||||
switch (hw) {
|
||||
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 "zvm":
|
||||
plugin = new zvmPlugin();
|
||||
break;
|
||||
}
|
||||
|
||||
// Clone node
|
||||
|
@ -676,21 +676,21 @@ function writeRsp(rsp, pattern) {
|
||||
* @param msg Message to show
|
||||
*/
|
||||
function openDialog(type, msg) {
|
||||
var msgDialog;
|
||||
var msgDialog = $('<div></div>');
|
||||
var title = "";
|
||||
if (type == "warn") {
|
||||
// Create warning message
|
||||
msgDialog = $('<div class="ui-state-error ui-corner-all">'
|
||||
+ '<p><span class="ui-icon ui-icon-alert"></span>' + msg + '</p>'
|
||||
+ '</div>');
|
||||
msgDialog.append(createWarnBar(msg));
|
||||
title = "Warning";
|
||||
} else {
|
||||
// Create info message
|
||||
msgDialog = $('<div class="ui-state-highlight ui-corner-all">'
|
||||
+ '<p><span class="ui-icon ui-icon-info"></span>' + msg + '</p>'
|
||||
+'</div>');
|
||||
msgDialog.append(createInfoBar(msg));
|
||||
title = "Info";
|
||||
}
|
||||
|
||||
// Open dialog
|
||||
msgDialog.dialog({
|
||||
title: title,
|
||||
modal: true,
|
||||
close: function(){
|
||||
$(this).remove();
|
||||
|
@ -41,14 +41,14 @@ if (isset($_GET["cmd"])) {
|
||||
}
|
||||
|
||||
// If no $args are given, set $args_array to NULL
|
||||
// Separators used are: | or ;
|
||||
// Separators used are: || or ;
|
||||
$args_array = array();
|
||||
if ($args) {
|
||||
// If $args contains multiple arguments, split it into an array
|
||||
if (strpos($args, "|")) {
|
||||
if (strpos($args, "||")) {
|
||||
// Split the arguments into an array
|
||||
$args_array = array();
|
||||
$args_array = explode("|", $args);
|
||||
$args_array = explode("||", $args);
|
||||
} else if (strpos($args, ";")) {
|
||||
// Split the arguments into an array
|
||||
$args_array = array();
|
||||
|
@ -45,11 +45,11 @@ if (isset($_GET["cmd"])) {
|
||||
}
|
||||
|
||||
// If $args contains multiple arguments, split it into an array
|
||||
// Separators used are: | or ;
|
||||
if (strpos($args, "|")) {
|
||||
// Separators used are: || or ;
|
||||
if (strpos($args, "||")) {
|
||||
// Split the arguments into an array
|
||||
$arr = array();
|
||||
$arr = explode("|", $args);
|
||||
$arr = explode("||", $args);
|
||||
} else if (strpos($args, ";")) {
|
||||
// Split the arguments into an array
|
||||
$arr = array();
|
||||
|
@ -138,6 +138,9 @@ sub process_request {
|
||||
# Directory where executables are on zHCP
|
||||
$::DIR = "/opt/zhcp/bin";
|
||||
|
||||
# Directory where system config is on zHCP
|
||||
$::SYSCONF = "/opt/zhcp/conf";
|
||||
|
||||
# Directory where zFCP disk pools are on zHCP
|
||||
$::ZFCPPOOL = "/var/opt/zhcp/zfcp";
|
||||
|
||||
@ -2874,71 +2877,80 @@ sub makeVM {
|
||||
$macId = xCAT::zvmUtils->replaceStr( $macId, ":", "" );
|
||||
$macId = substr( $macId, 6 );
|
||||
} else {
|
||||
my $prefix;
|
||||
if (`ssh -o ConnectTimeout=5 $::SUDOER\@$hcp "$::SUDO test -f $::SYSCONF/userprefix && echo Exists"`) {
|
||||
$prefix = `ssh -o ConnectTimeout=5 $::SUDOER\@$hcp "$::SUDO cat $::SYSCONF/userprefix"`;
|
||||
$prefix =~ s/\s*$//;
|
||||
$prefix =~ s/^\s*//;
|
||||
}
|
||||
|
||||
# Get zHCP MAC address
|
||||
# The MAC address prefix is the same for all network devices
|
||||
$out = `ssh -o ConnectTimeout=5 $::SUDOER\@$hcp "/sbin/modprobe vmcp"`;
|
||||
$out = `ssh -o ConnectTimeout=5 $::SUDOER\@$hcp "$::SUDO /sbin/vmcp q v nic" | grep "MAC:"`;
|
||||
if ($out) {
|
||||
@lines = split( "\n", $out );
|
||||
@words = split( " ", $lines[0] );
|
||||
|
||||
# Extract MAC prefix
|
||||
my $prefix = $words[1];
|
||||
$prefix = xCAT::zvmUtils->replaceStr( $prefix, "-", "" );
|
||||
$prefix = substr( $prefix, 0, 6 );
|
||||
|
||||
# Generate MAC address
|
||||
my $mac;
|
||||
while ($generateNew) {
|
||||
|
||||
# If no MACID is found, get one
|
||||
$macId = xCAT::zvmUtils->getMacID($::SUDOER, $hcp);
|
||||
if ( !$macId ) {
|
||||
xCAT::zvmUtils->printLn( $callback, "$node: (Error) Could not generate MACID" );
|
||||
return;
|
||||
}
|
||||
|
||||
# Create MAC address
|
||||
$mac = $prefix . $macId;
|
||||
|
||||
# If length is less than 12, append a zero
|
||||
if ( length($mac) != 12 ) {
|
||||
$mac = "0" . $mac;
|
||||
}
|
||||
|
||||
# Format MAC address
|
||||
$mac =
|
||||
substr( $mac, 0, 2 ) . ":"
|
||||
. substr( $mac, 2, 2 ) . ":"
|
||||
. substr( $mac, 4, 2 ) . ":"
|
||||
. substr( $mac, 6, 2 ) . ":"
|
||||
. substr( $mac, 8, 2 ) . ":"
|
||||
. substr( $mac, 10, 2 );
|
||||
|
||||
# Check 'mac' table for MAC address
|
||||
my $tab = xCAT::Table->new( 'mac', -create => 1, -autocommit => 0 );
|
||||
my @entries = $tab->getAllAttribsWhere( "mac = '" . $mac . "'", 'node' );
|
||||
|
||||
# If MAC address exists
|
||||
if (@entries) {
|
||||
# Generate new MACID
|
||||
$out = xCAT::zvmUtils->generateMacId($::SUDOER, $hcp);
|
||||
$generateNew = 1;
|
||||
} else {
|
||||
$generateNew = 0;
|
||||
|
||||
# Save MAC address in 'mac' table
|
||||
xCAT::zvmUtils->setNodeProp( 'mac', $node, 'mac', $mac );
|
||||
|
||||
# Generate new MACID
|
||||
$out = xCAT::zvmUtils->generateMacId($::SUDOER, $hcp);
|
||||
}
|
||||
} # End of while ($generateNew)
|
||||
} else {
|
||||
xCAT::zvmUtils->printLn( $callback, "$node: (Error) Could not find the MAC address of the zHCP" );
|
||||
xCAT::zvmUtils->printLn( $callback, "$node: (Solution) Verify that the node's zHCP($hcp) is correct, the node is online, and the SSH keys are setup for the zHCP" );
|
||||
if (!$prefix) {
|
||||
$out = `ssh -o ConnectTimeout=5 $::SUDOER\@$hcp "/sbin/modprobe vmcp"`;
|
||||
$out = `ssh -o ConnectTimeout=5 $::SUDOER\@$hcp "$::SUDO /sbin/vmcp q v nic" | grep "MAC:"`;
|
||||
if ($out) {
|
||||
@lines = split( "\n", $out );
|
||||
@words = split( " ", $lines[0] );
|
||||
|
||||
# Extract MAC prefix
|
||||
$prefix = $words[1];
|
||||
$prefix = xCAT::zvmUtils->replaceStr( $prefix, "-", "" );
|
||||
$prefix = substr( $prefix, 0, 6 );
|
||||
} else {
|
||||
xCAT::zvmUtils->printLn( $callback, "$node: (Error) Could not find the MAC address of the zHCP" );
|
||||
xCAT::zvmUtils->printLn( $callback, "$node: (Solution) Verify that the node's zHCP($hcp) is correct, the node is online, and the SSH keys are setup for the zHCP" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
# Generate MAC address
|
||||
my $mac;
|
||||
while ($generateNew) {
|
||||
|
||||
# If no MACID is found, get one
|
||||
$macId = xCAT::zvmUtils->getMacID($::SUDOER, $hcp);
|
||||
if ( !$macId ) {
|
||||
xCAT::zvmUtils->printLn( $callback, "$node: (Error) Could not generate MACID" );
|
||||
return;
|
||||
}
|
||||
|
||||
# Create MAC address
|
||||
$mac = $prefix . $macId;
|
||||
|
||||
# If length is less than 12, append a zero
|
||||
if ( length($mac) != 12 ) {
|
||||
$mac = "0" . $mac;
|
||||
}
|
||||
|
||||
# Format MAC address
|
||||
$mac =
|
||||
substr( $mac, 0, 2 ) . ":"
|
||||
. substr( $mac, 2, 2 ) . ":"
|
||||
. substr( $mac, 4, 2 ) . ":"
|
||||
. substr( $mac, 6, 2 ) . ":"
|
||||
. substr( $mac, 8, 2 ) . ":"
|
||||
. substr( $mac, 10, 2 );
|
||||
|
||||
# Check 'mac' table for MAC address
|
||||
my $tab = xCAT::Table->new( 'mac', -create => 1, -autocommit => 0 );
|
||||
my @entries = $tab->getAllAttribsWhere( "mac = '" . $mac . "'", 'node' );
|
||||
|
||||
# If MAC address exists
|
||||
if (@entries) {
|
||||
# Generate new MACID
|
||||
$out = xCAT::zvmUtils->generateMacId($::SUDOER, $hcp);
|
||||
$generateNew = 1;
|
||||
} else {
|
||||
$generateNew = 0;
|
||||
|
||||
# Save MAC address in 'mac' table
|
||||
xCAT::zvmUtils->setNodeProp( 'mac', $node, 'mac', $mac );
|
||||
|
||||
# Generate new MACID
|
||||
$out = xCAT::zvmUtils->generateMacId($::SUDOER, $hcp);
|
||||
}
|
||||
} # End of while ($generateNew)
|
||||
}
|
||||
|
||||
# Create virtual server
|
||||
|
Loading…
Reference in New Issue
Block a user