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
This commit is contained in:
sjing 2012-04-11 04:50:30 +00:00
parent c5c13da285
commit 9c6cc52d49

View File

@ -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