From 4d707f6c8f3fff4fa4d9d72e3311e9ede1349517 Mon Sep 17 00:00:00 2001 From: lissav Date: Tue, 9 Oct 2012 19:14:06 +0000 Subject: [PATCH] add getpostbootscripts routine and put a small fix in getsynclists routine git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@13967 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/perl/xCAT/SvrUtils.pm | 76 ++++++++++++++++++++++----- 1 file changed, 62 insertions(+), 14 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/SvrUtils.pm b/xCAT-server/lib/perl/xCAT/SvrUtils.pm index 278b2652c..39d105dbc 100644 --- a/xCAT-server/lib/perl/xCAT/SvrUtils.pm +++ b/xCAT-server/lib/perl/xCAT/SvrUtils.pm @@ -313,7 +313,7 @@ sub getsynclistfile() } return \%node_syncfile; - } + } # end isAIX # if does not specify the $node param, default consider for genimage command if ($nodes) { @@ -326,14 +326,14 @@ sub getsynclistfile() } my $nodetype_v = $nodetype_t->getNodesAttribs($nodes, ['profile','os','arch','provmethod']); - foreach my $node (@$nodes) { - my $provmethod=$nodetype_v->{$node}->[0]->{'provmethod'}; - if (($provmethod) && ( $provmethod ne "install") && ($provmethod ne "netboot") && ($provmethod ne "statelite")) { - # get the syncfiles base on the osimage my $osimage_t = xCAT::Table->new('osimage'); unless ($osimage_t) { return ; } + foreach my $node (@$nodes) { + my $provmethod=$nodetype_v->{$node}->[0]->{'provmethod'}; + if (($provmethod) && ( $provmethod ne "install") && ($provmethod ne "netboot") && ($provmethod ne "statelite")) { + # get the syncfiles base on the osimage my $synclist = $osimage_t->getAttribs({imagename=>$provmethod}, 'synclists'); if ($synclist && $synclist->{'synclists'}) { $node_syncfile{$node} = $synclist->{'synclists'}; @@ -1601,18 +1601,66 @@ sub update_osdistro_table } +#----------------------------------------------------------------------------- + + +=head3 getpostbootscripts + Get the the postbootscript list for the Linux nodes as defined in + the osimage table postbootscripts attribute + + Arguments: + $nodes - array of nodes + Returns: + reference of a hash of node=>postbootscripts comma separated list + Globals: + none + Error: + Example: + my $node_postbootscripts=xCAT::SvrUtils->getpostbootscripts($nodes); + Comments: + none + +=cut + +#----------------------------------------------------------------------------- + + +sub getpostbootscripts() +{ + my $nodes = shift; + if (($nodes) && ($nodes =~ /xCAT::SvrUtils/)) + { + $nodes = shift; + } + my %node_postbootscript = (); + my %osimage_postbootscript = (); + # get the profile attributes for the nodes + my $nodetype_t = xCAT::Table->new('nodetype'); + unless ($nodetype_t) { + return ; + } + my $nodetype_v = $nodetype_t->getNodesAttribs($nodes, ['provmethod']); + my @osimages; + my $osimage_t = xCAT::Table->new('osimage'); + unless ($osimage_t) { + return ; + } + foreach my $node (@$nodes) { + my $provmethod=$nodetype_v->{$node}->[0]->{'provmethod'}; + if (($provmethod) && ( $provmethod ne "install") && ($provmethod ne "netboot") && ($provmethod ne "statelite")) { + # then get the postbootscripts from the osimage + my $postbootscripts = $osimage_t->getAttribs({imagename=>$provmethod}, 'postbootscripts'); + if ($postbootscripts && $postbootscripts->{'postbootscripts'}) { + $node_postbootscript{$node} = $postbootscripts->{'postbootscripts'}; + } + } - - - - - - - - - + + } + return \%node_postbootscript; + } 1;