From cf1eb5011c6e01c1c63a8a4878d0b9263813be2b Mon Sep 17 00:00:00 2001 From: linggao Date: Tue, 24 Mar 2009 03:12:03 +0000 Subject: [PATCH] added a site table attribute 'nonodestatus' so that the node status updates can be turned off during the node deployment, node discovery and node power on/off git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2961 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/Schema.pm | 1 + xCAT-server/lib/perl/xCAT/PPC.pm | 10 +++++++++- xCAT-server/lib/xcat/plugins/blade.pm | 14 +++++++++++++- xCAT-server/lib/xcat/plugins/ipmi.pm | 11 ++++++++++- xCAT-server/lib/xcat/plugins/kvm.pm | 10 +++++++++- xCAT-server/lib/xcat/plugins/xen.pm | 11 ++++++++++- xCAT/postscripts/xcataixpost | 13 ++++++++++--- xCAT/postscripts/xcatdsklspost | 5 ++++- 8 files changed, 66 insertions(+), 9 deletions(-) diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 059364059..8e67b1be5 100644 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -532,6 +532,7 @@ site => { " master:\tThe hostname of the xCAT management node.\n\n". " maxssh:\tThe max # of SSH connections for hw ctrl purposes to PPC hw.\n\n". " nameservers:\tA comma delimited list of DNS servers for the cluster - often the xCAT management node.\n\n". + " nonodestatus:\tIf set to 1, the nodelist.status column will not be updated during the node deployment, node discovery and power operation.\n\n". " ntpservers:\tA comma delimited list of NTP servers for the cluster - often the xCAT management node.\n\n". " ppcmaxp:\tThe max # of processes for PPC hw ctrl.\n\n". " ppcretry:\tThw max # of PPC hw connection attempts before failing.\n\n". diff --git a/xCAT-server/lib/perl/xCAT/PPC.pm b/xCAT-server/lib/perl/xCAT/PPC.pm index e8bee9bb9..177e2822b 100644 --- a/xCAT-server/lib/perl/xCAT/PPC.pm +++ b/xCAT-server/lib/perl/xCAT/PPC.pm @@ -127,9 +127,17 @@ sub process_command { my %nodestat=(); my $check=0; my $newstat; + my $global_check=1; + if ($sitetab) { + (my $ref) = $sitetab->getAttribs({key => 'nonodestatus'}, 'value'); + if ($ref and $ref->{value}) { + if ($ref->{value} =~ /1|y|Y/) { $global_check=0; } + } + } + if ($request->{command} eq 'rpower') { my $subcommand=$request->{op}; - if (($subcommand ne 'stat') && ($subcommand ne 'status') && ($subcommand ne 'state')) { + if (($global_check) && ($subcommand ne 'stat') && ($subcommand ne 'status') && ($subcommand ne 'state')) { $check=1; my $noderange = $request->{node}; my @allnodes=@$noderange; diff --git a/xCAT-server/lib/xcat/plugins/blade.pm b/xCAT-server/lib/xcat/plugins/blade.pm index b41f93af7..1b89d1297 100644 --- a/xCAT-server/lib/xcat/plugins/blade.pm +++ b/xCAT-server/lib/xcat/plugins/blade.pm @@ -2826,8 +2826,18 @@ sub dompa { my $check=0; my $nsh={}; + my $global_check=1; + my $sitetab = xCAT::Table->new('site'); + if ($sitetab) { + (my $ref) = $sitetab->getAttribs({key => 'nonodestatus'}, 'value'); + if ($ref and $ref->{value}) { + if ($ref->{value} =~ /1|y|Y/) { $global_check=0; } + } + } + + if ($command eq 'rpower') { - if (($args->[0] ne 'stat') && ($args->[0] ne 'status')) { + if (($global_check) && ($args->[0] ne 'stat') && ($args->[0] ne 'status')) { $check=1; my @allnodes=keys %{$mpahash->{$mpa}->{nodes}}; @@ -2838,6 +2848,8 @@ sub dompa { } } } + #print "\nglobal_check=$global_check, check=$check\n"; + foreach $node (sort (keys %{$mpahash->{$mpa}->{nodes}})) { $curn = $node; diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index f6cb43f71..b7c94d73d 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -5880,8 +5880,16 @@ sub process_request { my %nodestat=(); my $check=0; my $newstat; + my $global_check=1; + if ($sitetab) { + (my $ref) = $sitetab->getAttribs({key => 'nonodestatus'}, 'value'); + if ($ref and $ref->{value}) { + if ($ref->{value} =~ /1|y|Y/) { $global_check=0; } + } + } + if ($command eq 'rpower') { - if (($extrargs->[0] ne 'stat') && ($extrargs->[0] ne 'status') && ($extrargs->[0] ne 'state')) { + if (($global_check) && ($extrargs->[0] ne 'stat') && ($extrargs->[0] ne 'status') && ($extrargs->[0] ne 'state')) { $check=1; my @allnodes; foreach (@donargs) { push(@allnodes, $_->[0]); } @@ -5905,6 +5913,7 @@ sub process_request { } } } + #foreach (keys %nodestat) { print "node=$_,status=" . $nodestat{$_} ."\n"; } #Ling:remove my $children = 0; diff --git a/xCAT-server/lib/xcat/plugins/kvm.pm b/xCAT-server/lib/xcat/plugins/kvm.pm index 77ad7a3bc..ba2391668 100644 --- a/xCAT-server/lib/xcat/plugins/kvm.pm +++ b/xCAT-server/lib/xcat/plugins/kvm.pm @@ -894,9 +894,17 @@ sub process_request { my %nodestat=(); my $check=0; my $newstat; + my $global_check=1; + if ($sitetab) { + (my $ref) = $sitetab->getAttribs({key => 'nonodestatus'}, 'value'); + if ($ref and $ref->{value}) { + if ($ref->{value} =~ /1|y|Y/) { $global_check=0; } + } + } + if ($command eq 'rpower') { my $subcommand=$exargs[0]; - if (($subcommand ne 'stat') && ($subcommand ne 'status')) { + if (($global_check) && ($subcommand ne 'stat') && ($subcommand ne 'status')) { $check=1; my @allnodes=@$noderange; if ($subcommand eq 'off') { $newstat=$::STATUS_POWERING_OFF; } diff --git a/xCAT-server/lib/xcat/plugins/xen.pm b/xCAT-server/lib/xcat/plugins/xen.pm index 8d4a8e021..d4a99c11d 100644 --- a/xCAT-server/lib/xcat/plugins/xen.pm +++ b/xCAT-server/lib/xcat/plugins/xen.pm @@ -754,9 +754,18 @@ sub process_request { my %nodestat=(); my $check=0; my $newstat; + my $global_check=1; + my $sitetab = xCAT::Table->new('site'); + if ($sitetab) { + (my $ref) = $sitetab->getAttribs({key => 'nonodestatus'}, 'value'); + if ($ref and $ref->{value}) { + if ($ref->{value} =~ /1|y|Y/) { $global_check=0; } + } + } + if ($command eq 'rpower') { my $subcommand=$exargs[0]; - if (($subcommand ne 'stat') && ($subcommand ne 'status')) { + if (($global_check) && ($subcommand ne 'stat') && ($subcommand ne 'status')) { $check=1; my @allnodes=@$noderange; if ($subcommand eq 'off') { $newstat=$::STATUS_POWERING_OFF; } diff --git a/xCAT/postscripts/xcataixpost b/xCAT/postscripts/xcataixpost index fce8d91a4..cc10334c6 100755 --- a/xCAT/postscripts/xcataixpost +++ b/xCAT/postscripts/xcataixpost @@ -140,9 +140,16 @@ if (-f $scriptname) } if (@ARGV<1) { - if (&updateflag($nodesetstat) != 0) { - print "$::sdate xcataixpost: Failed to update the xCAT server.\n"; - print $::LOG_FILE "$::sdate xcataixpost: Failed to update the xCAT server..\n"; + my $update=1; + if (-f $scriptname) { + my $CNS=`grep NONODESTATUS= $scriptname`; + if ((!$?) && ($CNS =~ /\'1\'|\'Y\'|\'y\'/)) { $update=0;} #only update is nonodestatus is not set in the site table + } + if ($update) { + if (&updateflag($nodesetstat) != 0) { + print "$::sdate xcataixpost: Failed to update the xCAT server.\n"; + print $::LOG_FILE "$::sdate xcataixpost: Failed to update the xCAT server..\n"; + } } } else { #called by updatenode, infrom user it is done diff --git a/xCAT/postscripts/xcatdsklspost b/xCAT/postscripts/xcatdsklspost index 3ee01a542..7d56c9135 100755 --- a/xCAT/postscripts/xcatdsklspost +++ b/xCAT/postscripts/xcatdsklspost @@ -94,7 +94,10 @@ fi if [ $# -eq 0 ]; then #notify the server that we are done with netbooting - echo "updateflag.awk \$MASTER 3002 \"installstatus booted\"" >> /tmp/mypostscript + CNS=`grep NONODESTATUS= /tmp/mypostscript |awk -F = '{print $2}'` + if [ -z "$CNS" ] || [ $CNS != "'1'" -a $CNS != "'Y'" -a $CNS != "'y'" ]; then + echo "updateflag.awk \$MASTER 3002 \"installstatus booted\"" >> /tmp/mypostscript + fi fi DHCP_TMP=`sed 's/\(DHCPINTERFACES=\)\(.*\)$/\1"\2"/' /tmp/mypostscript`