diff --git a/xCAT-server/share/xcat/tools/rmblade b/xCAT-server/share/xcat/tools/rmblade index 4c3f6ba99..a06e9105c 100755 --- a/xCAT-server/share/xcat/tools/rmblade +++ b/xCAT-server/share/xcat/tools/rmblade @@ -7,12 +7,23 @@ ## 4. so if blade is placed in new slot or back in then xCAT goes ## through rediscover process again. +BEGIN +{ + $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; +} + +use lib "$::XCATROOT/lib/perl"; +use xCAT::Utils; use strict; use Socket; # for name resolution + my $ip=''; my $mm=''; my $slot=''; my $log = "/var/log/xcatsnmp"; +my $tftpdir = xCAT::Utils->getTftpDir(); + + open(FILE,">>$log") or die "Can't open log!!!"; my $date = `date`; @@ -27,11 +38,11 @@ sub rmblade { `chtab -d node=$blade mac`; print FILE "Running: makedhcp -d $blade\n"; `makedhcp -d $blade`; - print FILE "Running: rm /tftpboot/pxelinux.cfg/$blade\n"; - `rm /tftpboot/pxelinux.cfg/$blade`; + print FILE "Running: rm $tftpdir/pxelinux.cfg/$blade\n"; + `rm $tftpdir/pxelinux.cfg/$blade`; if($hex){ - print FILE "Running: rm /tftpboot/pxelinux.cfg/$hex\n"; - `rm /tftpboot/pxelinux.cfg/$hex`; + print FILE "Running: rm $tftpdir/pxelinux.cfg/$hex\n"; + `rm $tftpdir/pxelinux.cfg/$hex`; } } diff --git a/xCAT-server/share/xcat/tools/rmnodecfg b/xCAT-server/share/xcat/tools/rmnodecfg index e8728999f..990374392 100755 --- a/xCAT-server/share/xcat/tools/rmnodecfg +++ b/xCAT-server/share/xcat/tools/rmnodecfg @@ -4,6 +4,13 @@ # usage: rmnodecfg # this does not remove it completely from xCAT. You may want to do this # command before running noderm to completely purge the system of the node +BEGIN +{ + $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; +} + +use lib "$::XCATROOT/lib/perl"; +use xCAT::Utils; use strict; use Socket; @@ -13,6 +20,8 @@ if(! $blades) { exit; } +my $tftpdir = xCAT::Utils->getTftpDir(); + foreach my $blade (`/opt/xcat/bin/nodels $blades`){ chomp($blade); my $hex = ip2hex($blade); @@ -26,11 +35,11 @@ foreach my $blade (`/opt/xcat/bin/nodels $blades`){ $cmd = "makedhcp -d $blade"; print "$cmd\n"; `$cmd`; - $cmd = "rm /tftpboot/pxelinux.cfg/$blade"; + $cmd = "rm $tftpdir/pxelinux.cfg/$blade"; print "$cmd\n"; `$cmd`; if($hex){ - $cmd = "rm /tftpboot/pxelinux.cfg/$hex"; + $cmd = "rm $tftpdir/pxelinux.cfg/$hex"; print "$cmd\n"; `$cmd`; }