From da87b45dd109ba3a62238fb0109d9a86c7996224 Mon Sep 17 00:00:00 2001 From: nott Date: Wed, 25 Jun 2008 19:36:36 +0000 Subject: [PATCH] Add check for NIM machine ready state. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1763 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/aixinstall.pm | 35 +++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/aixinstall.pm b/xCAT-server/lib/xcat/plugins/aixinstall.pm index 0c92e2b03..272219034 100644 --- a/xCAT-server/lib/xcat/plugins/aixinstall.pm +++ b/xCAT-server/lib/xcat/plugins/aixinstall.pm @@ -338,6 +338,39 @@ ll~; next; } + # check if node is in ready state + my $shorthost; + ($shorthost = $node) =~ s/\..*$//; + chomp $shorthost; + my $cstate = &get_nim_attr_val($shorthost, "Cstate", $callback); + if ( defined($cstate) && (!($cstate =~ /ready/)) ){ + if ($::FORCE) { + # if it's not in a ready state then reset it + my $rcmd = "/usr/sbin/nim -Fo reset $shorthost;/usr/sbin/nim -Fo deallocate -a subclass=all $shorthost"; + my $output = xCAT::Utils->runcmd("$rcmd", -1); + if ($::RUNCMD_RC != 0) { + my $rsp; + push @{$rsp->{data}}, "Could not reset the existing NIM object named \'$shorthost\'.\n"; + if ($::VERBOSE) { + push @{$rsp->{data}}, "$output"; + } + xCAT::MsgUtils->message("E", $rsp, $callback); + $error++; + push(@nodesfailed, $node); + next; + } + } else { + + my $rsp; + push @{$rsp->{data}}, "The NIM machine named $shorthost is not in the ready state and cannot be initialized.\n"; + xCAT::MsgUtils->message("E", $rsp, $callback); + $error++; + push(@nodesfailed, $node); + next; + + } + } + # set the NIM machine type my $type="standalone"; if ($imagehash{$image_name}{nimtype} ) { @@ -1976,7 +2009,7 @@ sub get_nim_attr_val { chomp $attr; $attr =~ s/\s*//g; # remove blanks chomp $value; - $value =~ s/\s*//g; # remove blanks + $value =~ s/^\s*//; if ($attr eq $attrname) { return $value; }