unlinked files for nodeset <noderange> offline

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@7993 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
cjhardee 2010-11-01 17:56:57 +00:00
parent 1fd4ce4ba1
commit ee5d016666
2 changed files with 48 additions and 0 deletions

View File

@ -496,6 +496,50 @@ sub process_request {
}
}
#unlink the files for 'offline' command
if($args[0] eq 'offline') {
foreach my $node (@nodes) {
my %ipaddrs;
unless (inet_aton($node)) {
syslog("local1|err","xCAT unable to resolve IP in pxe plugin");
return;
}
my $ip = inet_ntoa(inet_aton($node));;
unless ($ip) {
syslog("local1|err","xCAT unable to resolve IP in pxe plugin");
return;
}
$ipaddrs{$ip} = 1;
if ($mactab) {
my $ment = $machash{$node}->[0]; #$mactab->getNodeAttribs($node,['mac']);
if ($ment and $ment->{mac}) {
my @macs = split(/\|/,$ment->{mac});
foreach (@macs) {
if (/!(.*)/) {
if (inet_aton($1)) {
$ipaddrs{inet_ntoa(inet_aton($1))} = 1;
}
}
}
}
}
my $hassymlink = eval { symlink("",""); 1 };
unlink($tftpdir."/pxelinux.cfg/".$node);
foreach $ip (keys %ipaddrs) {
my @ipa=split(/\./,$ip);
my $pname = sprintf("%02X%02X%02X%02X",@ipa);
unlink($tftpdir."/pxelinux.cfg/".$pname);
#if ($hassymlink) {
#symlink($node,$tftpdir."/pxelinux.cfg/".$pname);
#} else {
#link($tftpdir."/pxelinux.cfg/".$node,$tftpdir."/pxelinux.cfg/".$pname);
#}
}
}
}
#now run the end part of the prescripts
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact')
$errored=0;

View File

@ -509,6 +509,10 @@ sub process_request {
$response{node}->[0]->{errorc}->[0]= $errstr;
$callback->(\%response);
}
if($args[0] eq 'offline') {
unlink($tftpdir."/xcat/xnba/nodes/".$node);
unlink($tftpdir."/xcat/xnba/nodes/".$node.".pxelinux");
}
}
}