From 0ab7c79a916109eaf5168c30a22148967362ef88 Mon Sep 17 00:00:00 2001 From: sjing Date: Thu, 5 Apr 2012 14:15:08 +0000 Subject: [PATCH] Fixed the bug -f does not work if the Cstate of nim machine is ready. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.7@12133 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/aixinstall.pm | 72 ++++++++++------------ 1 file changed, 33 insertions(+), 39 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/aixinstall.pm b/xCAT-server/lib/xcat/plugins/aixinstall.pm index d65625326..d9d47bb85 100644 --- a/xCAT-server/lib/xcat/plugins/aixinstall.pm +++ b/xCAT-server/lib/xcat/plugins/aixinstall.pm @@ -954,55 +954,49 @@ sub nimnodeset my $shorthost; ($shorthost = $node) =~ s/\..*$//; chomp $shorthost; - - # need to pass in this server name - my $cstate = xCAT::InstUtils->get_nim_attr_val($shorthost, "Cstate", $callback, "$Sname", $subreq); - - if (defined($cstate) && (!($cstate =~ /ready/))) + + if ($::FORCE) { - if ($::FORCE) + if ($::VERBOSE) { - - # if it's not in a ready state then reset it - if ($::VERBOSE) - { - my $rsp; - push @{$rsp->{data}}, - "$Sname: Reseting NIM definition for $shorthost.\n"; - xCAT::MsgUtils->message("I", $rsp, $callback); - } - - my $rcmd = - "/usr/sbin/nim -Fo reset -a force=yes $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}}, - "$Sname: 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}}, - "$Sname: The NIM machine named $shorthost is not in the ready state and cannot be initialized.\n"; + "$Sname: Reseting NIM definition for $shorthost.\n"; + xCAT::MsgUtils->message("I", $rsp, $callback); + } + + my $rcmd = + "/usr/sbin/nim -Fo reset -a force=yes $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}}, + "$Sname: 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; - } } + + # need to pass in this server name + my $cstate = xCAT::InstUtils->get_nim_attr_val($shorthost, "Cstate", $callback, "$Sname", $subreq); + if (defined($cstate) && (!($cstate =~ /ready/))) + { + my $rsp; + push @{$rsp->{data}}, + "$Sname: The NIM machine named $shorthost is not in the ready state and cannot be initialized. Use -f flag to forcely initialize it.\n"; + xCAT::MsgUtils->message("E", $rsp, $callback); + $error++; + push(@nodesfailed, $node); + next; + + } # set the NIM machine type $type = "standalone";