From d39e110af80f6006436bd4e1b2b79b73c886c63b Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Wed, 15 Feb 2012 21:04:42 +0000 Subject: [PATCH] Finish per-node/group tftpdir for NAS mount point managed sync up git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11589 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/anaconda.pm | 27 ++++++--- xCAT-server/lib/xcat/plugins/esx.pm | 23 +++++-- xCAT-server/lib/xcat/plugins/pxe.pm | 16 ++++- xCAT-server/lib/xcat/plugins/sles.pm | 77 +++++++++++++++--------- xCAT-server/lib/xcat/plugins/xnba.pm | 26 +++++--- xCAT-server/lib/xcat/plugins/yaboot.pm | 16 ++++- 6 files changed, 129 insertions(+), 56 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index c29ffe544..6ee5d7e5f 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -155,7 +155,7 @@ sub mknetboot if($req->{command}->[0] =~ 'mkstatelite'){ $statelite = "true"; } - my $tftpdir = "/tftpboot"; + my $globaltftpdir = "/tftpboot"; my $nodes = @{$req->{node}}; my @args = @{$req->{arg}}; my @nodes = @{$req->{node}}; @@ -183,7 +183,7 @@ sub mknetboot ($ref) = $sitetab->getAttribs({key => 'tftpdir'}, 'value'); if ($ref and $ref->{value}) { - $tftpdir = $ref->{value}; + $globaltftpdir = $ref->{value}; } } my %donetftp=(); @@ -195,7 +195,7 @@ sub mknetboot my $machash = $mactab->getNodesAttribs(\@nodes, ['interface','mac']); - my $reshash = $restab->getNodesAttribs(\@nodes, ['primarynic','tftpserver','xcatmaster','nfsserver','nfsdir', 'installnic']); + my $reshash = $restab->getNodesAttribs(\@nodes, ['primarynic','tftpserver','tftpdir','xcatmaster','nfsserver','nfsdir', 'installnic']); my $hmhash = $hmtab->getNodesAttribs(\@nodes, ['serialport', 'serialspeed', 'serialflow']); @@ -218,6 +218,13 @@ sub mknetboot my $dump; # for kdump, its format is "nfs:///" my $crashkernelsize; my $rootfstype; + my $tftpdir; + if ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{tftpdir}) { + $tftpdir = $reshash->{$node}->[0]->{tftpdir}; + } else { + $tftpdir = $globaltftpdir; + } + my $ent = $oents{$node}->[0]; #ostab->getNodeAttribs($node, ['os', 'arch', 'profile']); if ($ent and $ent->{provmethod} and ($ent->{provmethod} ne 'install') and ($ent->{provmethod} ne 'netboot') and ($ent->{provmethod} ne 'statelite')) { @@ -754,9 +761,9 @@ sub mkinstall my %img_hash=(); my $installroot; - my $tftpdir; + my $globaltftpdir; $installroot = "/install"; - $tftpdir = "/tftpboot"; + $globaltftpdir = "/tftpboot"; if ($sitetab) { @@ -768,7 +775,7 @@ sub mkinstall ($ref) = $sitetab->getAttribs({key => 'tftpdir'}, 'value'); if ($ref and $ref->{value}) { - $tftpdir = $ref->{value}; + $globaltftpdir = $ref->{value}; } } @@ -781,7 +788,7 @@ sub mkinstall my %osents = %{$ostab->getNodesAttribs(\@nodes, ['profile', 'os', 'arch', 'provmethod'])}; my %rents = %{$restab->getNodesAttribs(\@nodes, - ['nfsserver', 'primarynic', 'installnic'])}; + ['nfsserver', 'tftpdir', 'primarynic', 'installnic'])}; my %hents = %{$hmtab->getNodesAttribs(\@nodes, ['serialport', 'serialspeed', 'serialflow'])}; @@ -791,6 +798,7 @@ sub mkinstall foreach $node (@nodes) { my $os; + my $tftpdir; my $arch; my $profile; my $tmplfile; @@ -800,6 +808,11 @@ sub mkinstall my $platform; my $osinst; + if ($rents{$node}->[0] and $rents{$node}->[0]->{tftpdir}) { + $tftpdir = $rents{$node}->[0]->{tftpdir}; + } else { + $tftpdir = $globaltftpdir; + } my $ent = $osents{$node}->[0]; #$ostab->getNodeAttribs($node, ['profile', 'os', 'arch']); if ($ent and $ent->{provmethod} and ($ent->{provmethod} ne 'install') and ($ent->{provmethod} ne 'netboot') and ($ent->{provmethod} ne 'statelite')) { $imagename=$ent->{provmethod}; diff --git a/xCAT-server/lib/xcat/plugins/esx.pm b/xCAT-server/lib/xcat/plugins/esx.pm index d81602b0c..c3f3f3ffd 100644 --- a/xCAT-server/lib/xcat/plugins/esx.pm +++ b/xCAT-server/lib/xcat/plugins/esx.pm @@ -4293,7 +4293,7 @@ sub mkcommonboot { my $bootmode = shift; my $req = shift; my $doreq = shift; - my $tftpdir = "/tftpboot"; + my $globaltftpdir = "/tftpboot"; my @nodes = @{$req->{node}}; my $ostab = xCAT::Table->new('nodetype'); my $sitetab = xCAT::Table->new('site'); @@ -4306,7 +4306,7 @@ sub mkcommonboot { } ($ref) = $sitetab->getAttribs({key => 'tftpdir'}, 'value'); if ($ref and $ref->{value}) { - $tftpdir = $ref->{value}; + $globaltftpdir = $ref->{value}; } } my %donetftp=(); @@ -4317,6 +4317,11 @@ sub mkcommonboot { if ($nodehmtab) { $serialconfig = $nodehmtab->getNodesAttribs(\@nodes,['serialport','serialspeed']); } + my $restab = xCAT::Table->new('noderes',-create=>0); + my $resents; + if ($restab) { + $resents = $restab->getNodesAttribs(\@nodes,['tftpdir']); + } my %tablecolumnsneededforaddkcmdline; my %nodesubdata; @@ -4337,12 +4342,18 @@ sub mkcommonboot { } } - + my $osents = $ostab->getNodesAttribs(\@nodes, ['os', 'arch', 'profile']); foreach my $node (@nodes){ - my $ent = $ostab->getNodeAttribs($node, ['os', 'arch', 'profile']); + my $ent = $osents->{$node}->[0]; my $arch = $ent->{'arch'}; my $profile = $ent->{'profile'}; my $osver = $ent->{'os'}; + my $tftpdir; + if ($resents and $resents->{$node}->[0]->{tftpdir}) { + $tftpdir = $resents->{$node}->[0]->{tftpdir}; + } else { + $tftpdir = $globaltftpdir; + } #if($arch ne 'x86'){ # xCAT::SvrUtils::sendmsg([1,"VMware ESX hypervisors are x86, please change the nodetype.arch value to x86 instead of $arch for $node before proceeding: #e.g: nodech $node nodetype.arch=x86\n"]); @@ -4376,7 +4387,7 @@ sub mkcommonboot { $shortprofname =~ s/\/\z//; $shortprofname =~ s/.*\///; mkpath("$tftpdir/xcat/netboot/$osver/$arch/$shortprofname/"); - unless($donetftp{$osver,$arch}) { + unless($donetftp{$osver,$arch,$profile,$tftpdir}) { my $srcdir = "$installroot/$osver/$arch"; my $dest = "$tftpdir/xcat/netboot/$osver/$arch/$shortprofname"; cpNetbootImages($osver,$srcdir,$dest,$custprofpath,\%mods,bootmode=>$bootmode); @@ -4395,7 +4406,7 @@ sub mkcommonboot { mkpath("$dest/efi"); recursion_copy("$srcdir/efi","$dest/efi"); } - $donetftp{$osver,$arch,$profile} = 1; + $donetftp{$osver,$arch,$profile,$tftpdir} = 1; } my $tp = "xcat/netboot/$osver/$arch/$shortprofname"; my $kernel; diff --git a/xCAT-server/lib/xcat/plugins/pxe.pm b/xCAT-server/lib/xcat/plugins/pxe.pm index f5c7dbd41..70acfda59 100644 --- a/xCAT-server/lib/xcat/plugins/pxe.pm +++ b/xCAT-server/lib/xcat/plugins/pxe.pm @@ -11,7 +11,7 @@ my $addkcmdlinehandled; my $request; my $callback; my $dhcpconf = "/etc/dhcpd.conf"; -my $tftpdir = xCAT::Utils->getTftpDir(); +my $globaltftpdir = xCAT::Utils->getTftpDir(); #my $dhcpver = 3; my %usage = ( @@ -41,6 +41,7 @@ sub check_dhcp { sub getstate { my $node = shift; + my $tftpdir = shift; if (check_dhcp($node)) { if (-r $tftpdir . "/pxelinux.cfg/".$node) { my $fhand; @@ -69,6 +70,7 @@ sub setstate { my %chainhash = %{shift()}; my %machash = %{shift()}; my %nthash = %{shift()}; + my $tftpdir = shift; my $kern = $bphash{$node}->[0]; #$bptab->getNodeAttribs($node,['kernel','initrd','kcmdline']); if (not $addkcmdlinehandled->{$node} and $kern->{addkcmdline}) { @@ -460,18 +462,26 @@ sub process_request { my $chaintab = xCAT::Table->new('chain'); my $mactab = xCAT::Table->new('mac'); #to get all the hostnames my $typetab = xCAT::Table->new('nodetype'); + my $restab = xCAT::Table->new('noderes'); + my %nrhash = %{$restab->getNodesAttribs(\@nodes,[qw(tftpdir)])}; my %bphash = %{$bptab->getNodesAttribs(\@nodes,[qw(kernel initrd kcmdline addkcmdline)])}; my %chainhash = %{$chaintab->getNodesAttribs(\@nodes,[qw(currstate)])}; my %machash = %{$mactab->getNodesAttribs(\@nodes,[qw(mac)])}; my %nthash = %{$typetab->getNodesAttribs(\@nodes,[qw(os)])}; foreach (@nodes) { my %response; + my $tftpdir; + if ($nrhash{$_} and $nrhash{$_}->[0] and $nrhash{$_}->[0]->{tftpdir}) { + $tftpdir = $nrhash{$_}->[0]->{tftpdir}; + } else { + $tftpdir = $globaltftpdir; + } $response{node}->[0]->{name}->[0]=$_; if ($args[0] eq 'stat') { - $response{node}->[0]->{data}->[0]= getstate($_); + $response{node}->[0]->{data}->[0]= getstate($_,$tftpdir); $callback->(\%response); } elsif ($args[0]) { #If anything else, send it on to the destiny plugin, then setstate - ($rc,$errstr) = setstate($_,\%bphash,\%chainhash,\%machash,\%nthash); + ($rc,$errstr) = setstate($_,\%bphash,\%chainhash,\%machash,\%nthash,$tftpdir); if ($rc) { $response{node}->[0]->{errorcode}->[0]= $rc; $response{node}->[0]->{errorc}->[0]= $errstr; diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index 6771fec10..d60cfb01e 100644 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -23,7 +23,7 @@ use File::Temp qw/mkdtemp/; use Socket; -#use strict; +use strict; my @cpiopid; sub handled_commands @@ -47,7 +47,7 @@ sub mknetboot $statelite = "true"; } - my $tftpdir = "/tftpboot"; + my $globaltftpdir = "/tftpboot"; my $nodes = @{$req->{node}}; my @nodes = @{$req->{node}}; my $ostab = xCAT::Table->new('nodetype'); @@ -90,7 +90,7 @@ sub mknetboot my $machash = $mactab->getNodesAttribs(\@nodes, ['interface', 'mac']); my $restab = xCAT::Table->new('noderes'); - my $reshash = $restab->getNodesAttribs(\@nodes, ['primarynic', 'tftpserver', 'xcatmaster', 'nfsserver', 'nfsdir', 'installnic']); + my $reshash = $restab->getNodesAttribs(\@nodes, ['primarynic', 'tftpserver', 'tftpdir', 'xcatmaster', 'nfsserver', 'nfsdir', 'installnic']); my %donetftp=(); foreach my $node (@nodes) @@ -98,6 +98,7 @@ sub mknetboot my $osver; my $arch; my $profile; + my $provmethod; my $rootimgdir; my $nodebootif; # nodebootif will be used if noderes.installnic is not set my $rootfstype; @@ -140,6 +141,7 @@ sub mknetboot $profile = $ph->{profile}; $rootfstype = $ph->{rootfstype}; $nodebootif = $ph->{nodebootif}; + $provmethod = $ph->{provmethod}; $rootimgdir = $ph->{rootimgdir}; unless ($rootimgdir) { @@ -263,18 +265,25 @@ sub mknetboot next; } } + my $tftpdir; + if ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{tftpdir}) { + $tftpdir = $reshash->{$node}->[0]->{tftpdir}; + } else { + $tftpdir = $globaltftpdir; + } + mkpath("/$tftpdir/xcat/netboot/$osver/$arch/$profile/"); #TODO: only copy if newer... - unless ($donetftp{$osver,$arch,$profile}) { + unless ($donetftp{$osver,$arch,$profile,$tftpdir}) { copy("$rootimgdir/kernel", "/$tftpdir/xcat/netboot/$osver/$arch/$profile/"); if ($statelite) { copy("$rootimgdir/initrd-statelite.gz", "/$tftpdir/xcat/netboot/$osver/$arch/$profile/"); } else { copy("$rootimgdir/initrd-stateless.gz", "/$tftpdir/xcat/netboot/$osver/$arch/$profile/"); } - $donetftp{$osver,$arch,$profile} = 1; + $donetftp{$osver,$arch,$profile,$tftpdir} = 1; } if ($statelite) { @@ -533,6 +542,8 @@ sub mkinstall my $request = shift; my $callback = shift; my $doreq = shift; + my $globaltftpdir = xCAT::Utils->getTftpDir(); + my @nodes = @{$request->{node}}; my $node; my $ostab = xCAT::Table->new('nodetype'); @@ -544,6 +555,19 @@ sub mkinstall my %img_hash=(); my $installroot; $installroot = "/install"; + my $restab = xCAT::Table->new('noderes'); + my $bptab = xCAT::Table->new('bootparams',-create=>1); + my $hmtab = xCAT::Table->new('nodehm'); + my $resents = + $restab->getNodesAttribs( + \@nodes, + [ + 'nfsserver', 'tftpdir', + 'primarynic', 'installnic' + ] + ); + my $hments = + $hmtab->getNodesAttribs(\@nodes, ['serialport', 'serialspeed', 'serialflow']); if ($sitetab) { @@ -567,6 +591,12 @@ sub mkinstall my $osinst; my $ent = $ntents->{$node}->[0]; my $plat = ""; + my $tftpdir; + if ($resents->{$node} and $resents->{$node}->[0]->{tftpdir}) { + $tftpdir = $resents->{$node}->[0]->{tftpdir}; + } else { + $tftpdir = $globaltftpdir; + } if ($ent and $ent->{provmethod} and ($ent->{provmethod} ne 'install') and ($ent->{provmethod} ne 'netboot') and ($ent->{provmethod} ne 'statelite')) { my $imagename=$ent->{provmethod}; @@ -717,46 +747,35 @@ sub mkinstall my @dd_drivers; #TODO: driver slipstream, targetted for network. - unless ($doneimgs{"$os|$arch"}) + unless ($doneimgs{"$os|$arch|$tftpdir"}) { - mkpath("/tftpboot/xcat/$os/$arch"); + mkpath("/$tftpdir/xcat/$os/$arch"); if ($arch =~ /x86_64/) { copy("$pkgdir/1/boot/$arch/loader/linux", - "/tftpboot/xcat/$os/$arch/"); + "/$tftpdir/xcat/$os/$arch/"); copy("$pkgdir/1/boot/$arch/loader/initrd", - "/tftpboot/xcat/$os/$arch/"); - @dd_drivers = &insert_dd($callback, $os, $arch, "/tftpboot/xcat/$os/$arch/initrd"); + "/$tftpdir/xcat/$os/$arch/"); + @dd_drivers = &insert_dd($callback, $os, $arch, "/$tftpdir/xcat/$os/$arch/initrd"); } elsif ($arch =~ /x86/) { copy("$pkgdir/1/boot/i386/loader/linux", - "/tftpboot/xcat/$os/$arch/"); + "/$tftpdir/xcat/$os/$arch/"); copy("$pkgdir/1/boot/i386/loader/initrd", - "/tftpboot/xcat/$os/$arch/"); - @dd_drivers = &insert_dd($callback, $os, $arch, "/tftpboot/xcat/$os/$arch/initrd"); + "/$tftpdir/xcat/$os/$arch/"); + @dd_drivers = &insert_dd($callback, $os, $arch, "/$tftpdir/xcat/$os/$arch/initrd"); } elsif ($arch =~ /ppc/) { copy("$pkgdir/1/suseboot/inst64", - "/tftpboot/xcat/$os/$arch"); - @dd_drivers = &insert_dd($callback, $os, $arch, "/tftpboot/xcat/$os/$arch/inst64"); + "/$tftpdir/xcat/$os/$arch"); + @dd_drivers = &insert_dd($callback, $os, $arch, "/$tftpdir/xcat/$os/$arch/inst64"); } - $doneimgs{"$os|$arch"} = 1; + $doneimgs{"$os|$arch|$tftpdir"} = 1; } #We have a shot... - my $restab = xCAT::Table->new('noderes'); - my $bptab = xCAT::Table->new('bootparams',-create=>1); - my $hmtab = xCAT::Table->new('nodehm'); - my $ent = - $restab->getNodeAttribs( - $node, - [ - 'nfsserver', - 'primarynic', 'installnic' - ] - ); - my $sent = - $hmtab->getNodeAttribs($node, ['serialport', 'serialspeed', 'serialflow']); + my $ent = $resents->{$node}->[0]; + my $sent = $hments->{$node}->[0]; #hmtab->getNodeAttribs($node, ['serialport', 'serialspeed', 'serialflow']); my $netserver = '!myipfn!'; if ($ent and $ent->{nfsserver}) { diff --git a/xCAT-server/lib/xcat/plugins/xnba.pm b/xCAT-server/lib/xcat/plugins/xnba.pm index 1679f728a..bc9fdade5 100644 --- a/xCAT-server/lib/xcat/plugins/xnba.pm +++ b/xCAT-server/lib/xcat/plugins/xnba.pm @@ -12,7 +12,7 @@ my $request; my $callback; my $dhcpconf = "/etc/dhcpd.conf"; #my $tftpdir = "/tftpboot"; -my $tftpdir = xCAT::Utils->getTftpDir(); +my $globaltftpdir = xCAT::Utils->getTftpDir(); #my $dhcpver = 3; my %usage = ( @@ -42,6 +42,7 @@ sub check_dhcp { sub getstate { my $node = shift; + my $tftpdir = shift; if (check_dhcp($node)) { if (-r $tftpdir . "/xcat/xnba/nodes/".$node) { my $fhand; @@ -79,6 +80,7 @@ sub setstate { my %chainhash = %{shift()}; my %machash = %{shift()}; my %iscsihash = %{shift()}; + my $tftpdir = shift; my $kern = $bphash{$node}->[0]; #$bptab->getNodeAttribs($node,['kernel','initrd','kcmdline']); unless ($addkcmdlinehandled->{$node}) { #Tag to let us know the plugin had a special syntax implemented for addkcmdline if ($kern->{addkcmdline}) { @@ -450,15 +452,15 @@ sub process_request { } #back to normal business - if (! -r "$tftpdir/xcat/pxelinux.0") { + if (! -r "$globaltftpdir/xcat/pxelinux.0") { unless (-r $::XCATROOT."/share/xcat/netboot/syslinux/pxelinux.0") { $callback->({error=>["Unable to find pxelinux.0 at ".$::XCATROOT."/share/xcat/netboot/syslinux/pxelinux.0"],errorcode=>[1]}); return; } - copy($::XCATROOT."/share/xcat/netboot/syslinux/pxelinux.0","$tftpdir/xcat/pxelinux.0"); - chmod(0644,"$tftpdir/xcat/pxelinux.0"); + copy($::XCATROOT."/share/xcat/netboot/syslinux/pxelinux.0","$globaltftpdir/xcat/pxelinux.0"); + chmod(0644,"$globaltftpdir/xcat/pxelinux.0"); } - unless ( -r "$tftpdir/xcat/pxelinux.0" ) { + unless ( -r "$globaltftpdir/xcat/pxelinux.0" ) { $callback->({errror=>["Unable to find pxelinux.0 from syslinux"],errorcode=>[1]}); return; } @@ -479,7 +481,9 @@ sub process_request { #Time to actually configure the nodes, first extract database data with the scalable calls my $bptab = xCAT::Table->new('bootparams',-create=>1); my $chaintab = xCAT::Table->new('chain'); + my $noderestab = xCAT::Table->new('noderes'); #in order to detect per-node tftp directories my $mactab = xCAT::Table->new('mac'); #to get all the hostnames + my %nrhash = %{$noderestab->getNodesAttribs(\@nodes,[qw(tftpdir)])}; my %bphash = %{$bptab->getNodesAttribs(\@nodes,[qw(kernel initrd kcmdline addkcmdline)])}; my %chainhash = %{$chaintab->getNodesAttribs(\@nodes,[qw(currstate)])}; my %iscsihash; @@ -488,17 +492,23 @@ sub process_request { %iscsihash = %{$iscsitab->getNodesAttribs(\@nodes,[qw(server target)])}; } my %machash = %{$mactab->getNodesAttribs(\@nodes,[qw(mac)])}; - mkpath($tftpdir."/xcat/xnba/nodes/"); foreach (@nodes) { + my $tftpdir; + if ($nrhash{$_}->[0] and $nrhash{$_}->[0]->{tftpdir}) { + $tftpdir = $nrhash{$_}->[0]->{tftpdir}; + } else { + $tftpdir = $globaltftpdir; + } + mkpath($tftpdir."/xcat/xnba/nodes/"); my %response; $response{node}->[0]->{name}->[0]=$_; if ($args[0] eq 'stat') { - $response{node}->[0]->{data}->[0]= getstate($_); + $response{node}->[0]->{data}->[0]= getstate($_,$tftpdir); $callback->(\%response); } elsif ($args[0]) { #If anything else, send it on to the destiny plugin, then setstate my $rc; my $errstr; - ($rc,$errstr) = setstate($_,\%bphash,\%chainhash,\%machash,\%iscsihash); + ($rc,$errstr) = setstate($_,\%bphash,\%chainhash,\%machash,\%iscsihash,$tftpdir); #currently, it seems setstate doesn't return error codes... #if ($rc) { # $response{node}->[0]->{errorcode}->[0]= $rc; diff --git a/xCAT-server/lib/xcat/plugins/yaboot.pm b/xCAT-server/lib/xcat/plugins/yaboot.pm index 53cbbdcb3..09861d560 100644 --- a/xCAT-server/lib/xcat/plugins/yaboot.pm +++ b/xCAT-server/lib/xcat/plugins/yaboot.pm @@ -14,7 +14,7 @@ my %normalnodes; my $callback; my $sub_req; my $dhcpconf = "/etc/dhcpd.conf"; -my $tftpdir = "/tftpboot"; +my $globaltftpdir = "/tftpboot"; #my $dhcpver = 3; my %usage = ( @@ -44,6 +44,7 @@ sub check_dhcp { sub getstate { my $node = shift; + my $tftpdir = shift; if (check_dhcp($node)) { if (-r $tftpdir . "/etc/".$node) { my $fhand; @@ -71,6 +72,7 @@ sub setstate { my %bphash = %{shift()}; my %chainhash = %{shift()}; my %machash = %{shift()}; + my $tftpdir = shift; my $kern = $bphash{$node}->[0]; #$bptab->getNodeAttribs($node,['kernel','initrd','kcmdline']); if ($kern->{kcmdline} =~ /!myipfn!/) { my $ipfn = xCAT::Utils->my_ip_facing($node); @@ -447,6 +449,8 @@ sub process_request { my $bphash = $bptab->getNodesAttribs(\@nodes,['kernel','initrd','kcmdline','addkcmdline']); my $chaintab=xCAT::Table->new('chain',-create=>1); my $chainhash=$chaintab->getNodesAttribs(\@nodes,['currstate']); + my $noderestab=xCAT::Table->new('noderes',-create=>1); + my $nodereshash=$noderestab->getNodesAttribs(\@nodes,['tftpdir']); my $mactab=xCAT::Table->new('mac',-create=>1); my $machash=$mactab->getNodesAttribs(\@nodes,['mac']); my $rc; @@ -454,12 +458,18 @@ sub process_request { foreach (@nodes) { my %response; + my $tftpdir; + if ($nodereshash->{$_} and $nodereshash->{$_}->[0] and $nodereshash->{$_}->[0]->{tftpdir}) { + $tftpdir = $nodereshash->{$_}->[0]->{tftpdir}; + } else { + $tftpdir = $globaltftpdir; + } $response{node}->[0]->{name}->[0]=$_; if ($args[0] eq 'stat') { - $response{node}->[0]->{data}->[0]= getstate($_); + $response{node}->[0]->{data}->[0]= getstate($_,$tftpdir); $callback->(\%response); } elsif ($args[0]) { #If anything else, send it on to the destiny plugin, then setstate - ($rc,$errstr) = setstate($_,$bphash,$chainhash,$machash); + ($rc,$errstr) = setstate($_,$bphash,$chainhash,$machash,$tftpdir); if ($rc) { $response{node}->[0]->{errorcode}->[0]= $rc; $response{node}->[0]->{errorc}->[0]= $errstr;