From 74ff7bb8e32ab33e4e5251ed952e3aa5f05dd414 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Sat, 28 Mar 2009 04:25:03 +0000 Subject: [PATCH] -Implement rebuild of tftp directory contents if appropriate in AAsn git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3023 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/AAsn.pm | 38 +++++++++++++++++++++++++ xCAT-server/lib/xcat/plugins/destiny.pm | 20 ++++++++++++- xCAT-server/lib/xcat/plugins/pxe.pm | 2 +- xCAT-server/lib/xcat/plugins/yaboot.pm | 2 +- 4 files changed, 59 insertions(+), 3 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/AAsn.pm b/xCAT-server/lib/xcat/plugins/AAsn.pm index 245e9014e..2fdbe614f 100644 --- a/xCAT-server/lib/xcat/plugins/AAsn.pm +++ b/xCAT-server/lib/xcat/plugins/AAsn.pm @@ -933,6 +933,44 @@ sub setup_TFTP xCAT::MsgUtils->message("S", "Error $cmd"); } } + } else { #if not mounting, have to regenerate.... + #first, run mknb to get nbfs and such going? + my $cmdref; + $cmdref->{command}->[0] = "mknb"; + $cmdref->{arg}->[0] = "ppc64"; + ${"xCAT_plugin::mknb::"}{process_request}->($cmdref, \&xCAT::Client::handle_response); + $cmdref->{arg}->[0] = "x86"; + ${"xCAT_plugin::mknb::"}{process_request}->($cmdref, \&xCAT::Client::handle_response); + $cmdref->{arg}->[0] = "x86_64"; + ${"xCAT_plugin::mknb::"}{process_request}->($cmdref, \&xCAT::Client::handle_response); + #now, run nodeset enact on + #now, run nodeset enact on + my $mactab = xCAT::Table->new('mac'); + my $hmtab = xCAT::Table->new('nodehm'); + if ($mactab and $hmtab) { + my @mentries = ($mactab->getAllNodeAttribs([qw(node mac)])); #nodeset fails if no mac entry, filter on discovered nodes first... + my %netmethods; + my @tnodes; + foreach (@mentries) { + unless (defined $_->{mac}) { next; } + push @tnodes,$_->{node}; + } + my %hmhash = %{$hmtab->getNodesAttribs(\@tnodes,[qw(node netboot)])}; + foreach (@tnodes) { + if ($hmhash{$_}->[0]->{netboot}) { + push $netmethods{$hmhash{$_}->[0]->{netboot}},$_; + } + } + $cmdref->{command}->[0] = "nodeset"; + $cmdref->{arg}->[0] = "enact"; + $cmdref->{cwd}->[0] = "/opt/xcat/sbin"; + foreach my $modname (keys %netmethods) { + $cmdref->{node} = $netmethods{$modname}; + print Dumper($cmdref); + ${"xCAT_plugin::" . $modname . "::"}{process_request}->($cmdref, \&xCAT::Client::handle_response); + } + + } } # start atftp diff --git a/xCAT-server/lib/xcat/plugins/destiny.pm b/xCAT-server/lib/xcat/plugins/destiny.pm index 64abf0190..eb1adc0f9 100644 --- a/xCAT-server/lib/xcat/plugins/destiny.pm +++ b/xCAT-server/lib/xcat/plugins/destiny.pm @@ -74,12 +74,29 @@ sub relay_response { sub setdestiny { my $req=shift; my $flag=shift; + my $noupdate=shift; $chaintab = xCAT::Table->new('chain',-create=>1); my @nodes=@{$req->{node}}; my $state = $req->{arg}->[0]; my %nstates; - if ($state eq "next") { + if ($state eq "enact") { + my %nodestates; + my %stents = %{$chaintab->getNodesAttribs($req->{node},"currstate")}; + my $state; + foreach (@{$req->{node}}) { #First, build a hash of all of the states to attempt to keep things as aggregated as possible + if ($stents{$_}->[0]->{currstate}) { + $state = $stents{$_}->[0]->{currstate}; + $state =~ s/ .*//; + push $nodestates{$state},$_; + } + } + foreach (keys %nodestates) { + $req->{arg}->[0]=$_; + setdestiny($req,30,1); #ludicrous flag to denote no table updates can be inferred. + } + return; + } elsif ($state eq "next") { return nextdestiny($flag + 1); #this is special case where updateflag is called } elsif ($state eq "iscsiboot") { my $iscsitab=xCAT::Table->new('iscsi'); @@ -190,6 +207,7 @@ sub setdestiny { $callback->({error=>["Unknown state $state requested"],errorcode=>[1]}); return; } + if ($noupdate) { return; } #skip table manipulation if just doing 'enact' foreach (@nodes) { my $lstate = $state; if ($nstates{$_}) { diff --git a/xCAT-server/lib/xcat/plugins/pxe.pm b/xCAT-server/lib/xcat/plugins/pxe.pm index 48e89825b..67639c12a 100644 --- a/xCAT-server/lib/xcat/plugins/pxe.pm +++ b/xCAT-server/lib/xcat/plugins/pxe.pm @@ -310,7 +310,7 @@ sub process_request { } else { @args=($request->{arg}); } - unless ($args[0] eq 'stat' or $args[0] eq 'enact') { + unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') { $sub_req->({command=>['setdestiny'], node=>\@nodes, arg=>[$args[0]]},\&pass_along); diff --git a/xCAT-server/lib/xcat/plugins/yaboot.pm b/xCAT-server/lib/xcat/plugins/yaboot.pm index c58d2abbb..948075de4 100644 --- a/xCAT-server/lib/xcat/plugins/yaboot.pm +++ b/xCAT-server/lib/xcat/plugins/yaboot.pm @@ -289,7 +289,7 @@ sub process_request { return; } - unless ($args[0] eq 'stat' or $args[0] eq 'enact') { + unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') { $sub_req->({command=>['setdestiny'], node=>\@nodes, arg=>[$args[0]]},\&pass_along);