fix bugs 3386134, parse_lparname function is not located at a correct position

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@10230 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
zhaoertao 2011-08-05 06:52:14 +00:00
parent 9e6febdc7e
commit e5643353eb

View File

@ -59,7 +59,7 @@ sub chvm_parse_lparname {
return "'$cmd' not support";
}
if (!defined($value)) {
return "value not specify";
return "value not specified";
}
$opt->{$cmd} = $value;
if ($value && $value ne '*' && $value !~ /^[a-zA-Z0-9-_]+$/) {
@ -107,26 +107,6 @@ sub chvm_parse_args {
return(usage( "Missing option: -" ));
}
####################################
# Check for an extra argument
####################################
if ( defined( $ARGV[0] )) {
my $check_chvm_lpar_arg = chvm_parse_lparname(\@ARGV, \%opt);
if (defined($check_chvm_lpar_arg)) {
return (usage("Invalid argument: $check_chvm_lpar_arg"));
} elsif (($opt{lparname} ne '*') && (scalar(@{$request->{node}}) > '1')){
return(usage( "Invalid argument: must specify '*' for more than one node" ));
} else {
my $len = rindex $opt{lparname}."\$", "\$";
if ($len > '47') {
return (usage("Invalid lparname '$opt{lparname}', name is too long, max 47 characters"));
}
}
if (exists($opt{lparname}) &&
(exists($opt{p}) || exists($opt{i}) || exists($opt{m}) || exists($opt{r}))) {
return (usage("lparname should NOT be used with -p, -i, -m or -r."));
}
}
####################################
# Configuration file required
####################################
#if ( !exists( $opt{p}) ) {
@ -310,6 +290,26 @@ sub chvm_parse_args {
$request->{node} = [$other_p];
$request->{noderange} = $other_p;
}
####################################
# Check for an extra argument
####################################
if ( defined( $ARGV[0] )) {
my $check_chvm_lpar_arg = chvm_parse_lparname(\@ARGV, \%opt);
if (defined($check_chvm_lpar_arg)) {
return (usage("Invalid argument: $check_chvm_lpar_arg"));
} elsif (($opt{lparname} ne '*') && (scalar(@{$request->{node}}) > '1')){
return(usage( "Invalid argument: must specify '*' for more than one node" ));
} else {
my $len = rindex $opt{lparname}."\$", "\$";
if ($len > '47') {
return (usage("Invalid lparname '$opt{lparname}', name is too long, max 47 characters"));
}
}
if (exists($opt{lparname}) &&
(exists($opt{p}) || exists($opt{i}) || exists($opt{m}) || exists($opt{r}))) {
return (usage("lparname should NOT be used with -p, -i, -m or -r."));
}
}
####################################
# No operands - add command name