-Defer determination of ip facing managed node until write to tftp, to enable dynamic http load balance

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2930 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2009-03-18 14:11:30 +00:00
parent a17727ddd3
commit 71c9db8868
4 changed files with 25 additions and 14 deletions

View File

@ -302,12 +302,7 @@ sub mknetboot
#}
#else
#{
my $ipfn = xCAT::Utils->my_ip_facing($node);
if ($ipfn)
{
$imgsrv = $ipfn; #guessing self is second best
}
$imgsrv = '!myipfn!';
#}
}
}

View File

@ -66,6 +66,11 @@ sub setstate {
my %chainhash = %{shift()};
my %machash = %{shift()};
my $kern = $bphash{$node}->[0]; #$bptab->getNodeAttribs($node,['kernel','initrd','kcmdline']);
if ($kern->{kcmdline} =~ /!myipfn!/) {
my $ipfn = xCAT::Utils->my_ip_facing($node);
unless ($ipfn) { return (1,"Unable to identify IP facing client node"); }
$kern->{kcmdline} =~ s/!myipfn!/$ipfn/;
}
my $pcfg;
open($pcfg,'>',$tftpdir."/pxelinux.cfg/".$node);
my $cref=$chainhash{$node}->[0]; #$chaintab->getNodeAttribs($node,['currstate']);
@ -314,7 +319,12 @@ sub process_request {
$response{node}->[0]->{data}->[0]= getstate($_);
$callback->(\%response);
} elsif ($args[0]) { #If anything else, send it on to the destiny plugin, then setstate
setstate($_,\%bphash,\%chainhash,\%machash);
($rc,$errstr) = setstate($_,$bphash,$chainhash,$machash);
if ($rc) {
$response{node}->[0]->{errorcode}->[0]= $rc;
$response{node}->[0]->{errorc}->[0]= $errstr;
$callback->(\%response);
}
}
}
if ($args[0] ne 'stat') {

View File

@ -162,12 +162,7 @@ sub mknetboot
#}
#else
#{
my $ipfn = xCAT::Utils->my_ip_facing($node);
if ($ipfn)
{
$imgsrv = $ipfn; #guessing self is second best
}
$imgsrv = '!myipfn!';
#}
}
}

View File

@ -70,6 +70,11 @@ sub setstate {
my %chainhash = %{shift()};
my %machash = %{shift()};
my $kern = $bphash{$node}->[0]; #$bptab->getNodeAttribs($node,['kernel','initrd','kcmdline']);
if ($kern->{kcmdline} =~ /!myipfn!/) {
my $ipfn = xCAT::Utils->my_ip_facing($node);
unless ($ipfn) { return (1,"Unable to identify IP facing client node"); }
$kern->{kcmdline} =~ s/!myipfn!/$ipfn/;
}
my $pcfg;
unless (-d "$tftpdir/etc") {
mkpath("$tftpdir/etc");
@ -285,6 +290,8 @@ sub process_request {
my $chainhash=$chaintab->getNodesAttribs(\@nodes,['currstate']);
my $mactab=xCAT::Table->new('mac',-create=>1);
my $machash=$mactab->getNodesAttribs(\@nodes,['mac']);
my $rc;
my $errstr;
foreach (@nodes) {
my %response;
@ -293,7 +300,11 @@ sub process_request {
$response{node}->[0]->{data}->[0]= getstate($_);
$callback->(\%response);
} elsif ($args[0]) { #If anything else, send it on to the destiny plugin, then setstate
setstate($_,$bphash,$chainhash,$machash);
($rc,$errstr) = setstate($_,$bphash,$chainhash,$machash);
if ($rc) {
$response{node}->[0]->{errorcode}->[0]= $rc;
$response{node}->[0]->{errorc}->[0]= $errstr;
$callback->(\%response);
}
}
my @normalnodeset = keys %normalnodes;