diff --git a/xCAT-server/lib/xcat/plugins/aixinstall.pm b/xCAT-server/lib/xcat/plugins/aixinstall.pm index d9d47bb85..bef9b5794 100644 --- a/xCAT-server/lib/xcat/plugins/aixinstall.pm +++ b/xCAT-server/lib/xcat/plugins/aixinstall.pm @@ -7831,6 +7831,19 @@ sub prenimnodeset return (1); } + # + # Get a list of all the nim resrouces defined. + # + $cmd = qq~/usr/sbin/lsnim | /usr/bin/cut -f1 -d' ' 2>/dev/null~; + my @nimres = xCAT::InstUtils->xcmd($callback, $subreq, "xdsh", $nimprime, $cmd, 1); + if ($::RUNCMD_RC != 0) + { + my $rsp; + push @{$rsp->{data}}, "Could not get NIM resources on $nimprime."; + xCAT::MsgUtils->message("E", $rsp, $callback); + return (1); + } + # # get the image defs from the DB # @@ -8097,6 +8110,15 @@ sub prenimnodeset foreach my $res (@reslist) { + # before get location, we need to validate if the nimres exists + unless (grep (/^$res$/, @nimres)) + { + my $rsp; + push @{$rsp->{data}}, "NIM resource $res is not defined on $nimprime.\n"; + xCAT::MsgUtils->message("E", $rsp, $callback); + return 1; + + } # go to primary NIM master to get resource defs and # pick out locations