From 540bf7da2143ba6777dd014cf14aa6891eae8183 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Tue, 15 Sep 2009 18:37:18 +0000 Subject: [PATCH] -Allow a site entry to enable service pruning where noderm actively removes data from related services rather than just xCAT configuration itself git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4139 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/Schema.pm | 1 + xCAT-server/lib/xcat/plugins/tabutils.pm | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index be3d49e49..63c226258 100644 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -556,6 +556,7 @@ site => { " ppcmaxp:\tThe max # of processes for PPC hw ctrl.\n\n". " ppcretry:\tThe max # of PPC hw connection attempts before failing.\n\n". " ppctimeout:\tThe timeout, in milliseconds, to use when communicating with PPC hw.\n\n". + " pruneservices:\tWhether to enable service pruning when noderm is run (i.e. removing DHCP entries when noderm is executed)\n\n". " sharedtftp:\tSet to no/0 if xCAT should not assume /tftpboot is mounted on all service nodes. Default is 1.\n\n". " timezone:\t(e.g. America/New_York)\n\n". " useSSHonAIX:\t(yes/1 or no/0). If yes, ssh/scp will be setup and used. If no, rsh/rcp will be setup and used on AIX.\n\n". diff --git a/xCAT-server/lib/xcat/plugins/tabutils.pm b/xCAT-server/lib/xcat/plugins/tabutils.pm index b0ed980ad..9ea715c81 100644 --- a/xCAT-server/lib/xcat/plugins/tabutils.pm +++ b/xCAT-server/lib/xcat/plugins/tabutils.pm @@ -15,6 +15,7 @@ use xCAT::NodeRange qw/noderange abbreviate_noderange/; use xCAT::Schema; use xCAT::Utils; use Getopt::Long; +my $requestcommand; 1; @@ -74,6 +75,7 @@ sub process_request my $request = shift; my $callback = shift; + $requestcommand = shift; my $nodes = $request->{node}; my $command = $request->{command}->[0]; my $args = $request->{arg}; @@ -243,6 +245,13 @@ sub noderm } if (!$nodes) { $noderm_usage->(1); return; } + my $sitetab = xCAT::Table->new('site'); + my $pdhcp = $sitetab->getAttribs({key=>'pruneservices'},['value']); + if ($pdhcp and $pdhcp->{value} and $pdhcp->{value} !~ /n(\z|o)/i) { + $executecommand->({command=>['makedhcp'],node=>$nodes,arg=>['-d']}); + } + + # Build the argument list for using the -d option of nodech to do our work for us my @tablist = ("-d");