From 62f559eae90c7e49387d558806d24651d0749d5b Mon Sep 17 00:00:00 2001 From: nott Date: Tue, 1 Feb 2011 19:56:36 +0000 Subject: [PATCH] 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 --- xCAT-server/lib/xcat/plugins/aixinstall.pm | 16 +++++++++++++--- xCAT-server/lib/xcat/plugins/xcat2nim.pm | 9 +++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/aixinstall.pm b/xCAT-server/lib/xcat/plugins/aixinstall.pm index 242a2193a..24232460c 100644 --- a/xCAT-server/lib/xcat/plugins/aixinstall.pm +++ b/xCAT-server/lib/xcat/plugins/aixinstall.pm @@ -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)) { diff --git a/xCAT-server/lib/xcat/plugins/xcat2nim.pm b/xCAT-server/lib/xcat/plugins/xcat2nim.pm index 67a076263..84bcb5331 100644 --- a/xCAT-server/lib/xcat/plugins/xcat2nim.pm +++ b/xCAT-server/lib/xcat/plugins/xcat2nim.pm @@ -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) {