From 61113c2fe08d938a344b4570531056996e8e491f Mon Sep 17 00:00:00 2001 From: nott Date: Thu, 2 Apr 2009 17:38:43 +0000 Subject: [PATCH] mknimimage problem with multiple installp_bundles - bug - 2725452 git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3071 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/aixinstall.pm | 80 ++++++++++++++-------- 1 file changed, 51 insertions(+), 29 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/aixinstall.pm b/xCAT-server/lib/xcat/plugins/aixinstall.pm index 62bdeb65b..82f512e31 100644 --- a/xCAT-server/lib/xcat/plugins/aixinstall.pm +++ b/xCAT-server/lib/xcat/plugins/aixinstall.pm @@ -1329,22 +1329,22 @@ sub mknimimage return 1; } } - # - # get spot resource - # - $spot_name=&mk_spot($lpp_source_name, $callback); - chomp $spot_name; - $newres{spot} = $spot_name; - if ( !defined($spot_name)) { - my $rsp; - push @{$rsp->{data}}, "Could not create spot definition.\n"; - xCAT::MsgUtils->message("E", $rsp, $callback); - return 1; - } + # + # get spot resource + # + $spot_name=&mk_spot($lpp_source_name, $callback); + chomp $spot_name; + $newres{spot} = $spot_name; + if ( !defined($spot_name)) { + my $rsp; + push @{$rsp->{data}}, "Could not create spot definition.\n"; + xCAT::MsgUtils->message("E", $rsp, $callback); + return 1; + } - # - # create resolv_conf - # + # + # create resolv_conf + # my $resolv_conf_name = &mk_resolv_conf($callback); if (defined($resolv_conf_name)) { chomp $resolv_conf_name; @@ -1363,18 +1363,27 @@ sub mknimimage $osimagedef{$::image_name}{nimmethod}=$::METHOD; } - # get resources from the original osimage if provided - if ($::opt_i) { + # + # get resources from the original osimage if provided + # + if ($::opt_i) { - foreach my $type (keys %{$::imagedef{$::opt_i}}) { + foreach my $type (keys %{$::imagedef{$::opt_i}}) { + # could be comma list!! + my $include = 1; + my @reslist = split(/,/, $::imagedef{$::opt_i}{$type}); + foreach my $res (@reslist) { + if (!grep(/^$res$/, @::nimresources)) { + my $include = 0; + last; + } + } - if (grep(/^$::imagedef{$::opt_i}{$type}$/, @::nimresources)) { - # if this is a resource then add it to the new osimage - # ex. type=spot, name = myspot + if ($include) { $osimagedef{$::image_name}{$type}=$::imagedef{$::opt_i}{$type}; } } - } + } if (defined(%newres)) { @@ -1384,15 +1393,28 @@ sub mknimimage } } + # + # overwrite with anything provided on the command line + # if (defined(%::attrres)) { - # add overlay/any additional from the cmd line if provided - foreach my $type (keys %::attrres) { - if (grep(/^$::attrres{$type}$/, @::nimresources)) { - $osimagedef{$::image_name}{$type}=$::attrres{$type}; - } - } - } + # add overlay/any additional from the cmd line if provided + foreach my $type (keys %::attrres) { + # could be comma list!! + my $include = 1; + my @reslist = split(/,/, $::attrres{$type}); + foreach my $res (@reslist) { + if (!grep(/^$res$/, @::nimresources)) { + my $include = 0; + last; + } + } + + if ($include) { + $osimagedef{$::image_name}{$type}=$::attrres{$type}; + } + } + } # create the osimage def if (xCAT::DBobjUtils->setobjdefs(\%osimagedef) != 0)