From 9c6cc52d49ccf12a5ea404f6dd36e345bb14eae1 Mon Sep 17 00:00:00 2001 From: sjing Date: Wed, 11 Apr 2012 04:50:30 +0000 Subject: [PATCH] check if nim resources exist before copying them to SN. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.7@12191 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/aixinstall.pm | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) 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