check length of NIM machine object name

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8783 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
nott 2011-02-01 19:56:36 +00:00
parent 5ca2668846
commit 62f559eae9
2 changed files with 22 additions and 3 deletions

View File

@ -1178,6 +1178,7 @@ sub spot_updates
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
}
else
{
@ -1492,7 +1493,6 @@ srvnode.";
return 0;
}
#----------------------------------------------------------------------------
=head3 chkosimage
@ -4022,7 +4022,6 @@ sub mk_bosinst_data
Only if the node "domain" & "nameservers" attrs are set!
Returns:
0 - OK
1 - error
=cut
@ -7849,7 +7848,7 @@ sub mkdsklsnode
{
my $rsp;
push @{$rsp->{data}},
"The resource named \'$imagehash{$img}{shared_root}\' is currently allocated. It will not be updated.\n";
"The resource named \'$imagehash{$img}{shared_root}\' is currently allocated. It will not be re-synchronized.\n";
xCAT::MsgUtils->message("I", $rsp, $callback);
next;
}
@ -7936,6 +7935,17 @@ sub mkdsklsnode
my $toinit = 0;
my $toremove = 0;
# NIM has a limit of 39 characters for a macine name
my $len = length($nim_name);
if ($len > 39) {
my $rsp;
push @{$rsp->{data}}, "$Sname: Could not define \'$nim_name\'. A NIM machine name can be no longer then 39 characters.\n";
xCAT::MsgUtils->message("E", $rsp, $callback);
push(@nodesfailed, $node);
$error++;
next;
}
# see if it's already defined first
if (grep(/^$nim_name$/, @machines))
{

View File

@ -873,6 +873,15 @@ sub mkclientdef
# need short host name for NIM client defs
($shorthost = $node) =~ s/\..*$//;
# NIM has a limit of 39 characters for a machine name
my $len = length($shorthost);
if ($len > 39) {
my $rsp;
push @{$rsp->{data}}, "$::msgstr Could not define \'$shorthost\'. A NIM machine name can be no longer then 39 characters.\n";
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
}
# don't update an existing def unless they say so!
if ($::client_exists && !$::opt_u) {