mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-10-31 03:12:30 +00:00 
			
		
		
		
	-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:
		| @@ -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!'; | ||||
|                 #} | ||||
|             } | ||||
|         } | ||||
|   | ||||
| @@ -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') { | ||||
|   | ||||
| @@ -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!'; | ||||
|                 #} | ||||
|             } | ||||
|         } | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user