From 6ed9c4c9b1f11be7075eebee9dc71df0a2358eaa Mon Sep 17 00:00:00 2001 From: jjhua Date: Thu, 1 Nov 2012 02:10:01 +0000 Subject: [PATCH] pre-create mypostscript enhancement: get_nodeset_state uses the values of the noderes.net boot noderes.tftpdir which were got ahead of time git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@14188 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/perl/xCAT/SvrUtils.pm | 41 ++++++++++++++++++--------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/SvrUtils.pm b/xCAT-server/lib/perl/xCAT/SvrUtils.pm index 39d105dbc..a5a07c49c 100644 --- a/xCAT-server/lib/perl/xCAT/SvrUtils.pm +++ b/xCAT-server/lib/perl/xCAT/SvrUtils.pm @@ -160,24 +160,37 @@ sub get_nodeset_state my $state = "undefined"; my $tftpdir; + my $boottype; + if( defined(%::GLOBAL_TAB_HASH) && defined($::GLOBAL_TAB_HASH{noderes}) && defined($::GLOBAL_TAB_HASH{noderes}{$node}) ) { + $tftpdir = $::GLOBAL_TAB_HASH{noderes}{$node}{tftpdir}; + $boottype = $::GLOBAL_TAB_HASH{noderes}{$node}{netboot}; + + } else { + #get boot type (pxe, yaboot or aixinstall) for the node + my $noderestab = xCAT::Table->new('noderes', -create => 0); + my $ent = $noderestab->getNodeAttribs($node, [qw(netboot tftpdir)],%gnopts); + + #get tftpdir from the noderes table, if not defined get it from site talbe + if ($ent && $ent->{tftpdir}) { + $tftpdir=$ent->{tftpdir}; + } + if (!$tftpdir) { + if ($::XCATSITEVALS{tftpdir}) { + $tftpdir=$::XCATSITEVALS{tftpdir}; + } + } + + if ($ent && $ent->{netboot}) + { + $boottype = $ent->{netboot}; + } - #get boot type (pxe, yaboot or aixinstall) for the node - my $noderestab = xCAT::Table->new('noderes', -create => 0); - my $ent = $noderestab->getNodeAttribs($node, [qw(netboot tftpdir)],%gnopts); - #get tftpdir from the noderes table, if not defined get it from site talbe - if ($ent && $ent->{tftpdir}) { - $tftpdir=$ent->{tftpdir}; - } - if (!$tftpdir) { - if ($::XCATSITEVALS{tftpdir}) { - $tftpdir=$::XCATSITEVALS{tftpdir}; - } } - if ($ent && $ent->{netboot}) + if ( defined($boottype) ) { - my $boottype = $ent->{netboot}; + #my $boottype = $ent->{netboot}; #get nodeset state from corresponding files if ($boottype eq "pxe") @@ -212,7 +225,7 @@ sub get_nodeset_state require xCAT_plugin::aixinstall; $state = xCAT_plugin::aixinstall::getNodesetState($node); } - + #get the nodeset state from the chain table as a backup. if ($state eq "undefined") {