defect 2947784: use getTftpDir to get the tftp dir

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5285 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
daniceexi 2010-02-24 09:25:29 +00:00
parent 11cbdc7291
commit 08eed9957e
2 changed files with 26 additions and 6 deletions

View File

@ -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`;
}
}

View File

@ -4,6 +4,13 @@
# usage: rmnodecfg <noderange>
# 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`;
}