From d8f935df65fe5ed3b97e13edab187338bec8b203 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Sat, 28 Mar 2009 05:57:08 +0000 Subject: [PATCH] -Institute new plugin phase 'init_plugin' and move AAsn to using it (have a function to request peer plugin action git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3028 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/AAsn.pm | 19 ++++++++++--------- xCAT-server/sbin/xcatd | 9 +++++++++ 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/AAsn.pm b/xCAT-server/lib/xcat/plugins/AAsn.pm index 3b420014b..c8804cc08 100644 --- a/xCAT-server/lib/xcat/plugins/AAsn.pm +++ b/xCAT-server/lib/xcat/plugins/AAsn.pm @@ -50,9 +50,10 @@ else if on the Management Node #------------------------------------------------------- sub handled_commands - +{ return; } +sub init_plugin { - + my $doreq = shift; # If called in XCATBYPASS mode, don't do any setup if ($ENV{'XCATBYPASS'}) @@ -157,7 +158,7 @@ sub handled_commands if (grep(/$service/, @servicelist)) { - $rc = &setup_TFTP($nodename); # setup TFTP + $rc = &setup_TFTP($nodename,$doreq); # setup TFTP if ($rc == 0) { xCAT::Utils->update_xCATSN($service); @@ -860,7 +861,8 @@ sub setup_SSH #----------------------------------------------------------------------------- sub setup_TFTP { - my ($nodename) = @_; + my ($nodename, $doreq) = @_; + my $rc = 0; my $cmd; my $master; @@ -940,11 +942,11 @@ sub setup_TFTP use xCAT_plugin::mknb; $cmdref->{command}->[0] = "mknb"; $cmdref->{arg}->[0] = "ppc64"; - ${"xCAT_plugin::mknb::"}{process_request}->($cmdref, \&xCAT::Client::handle_response); + $doreq->($cmdref,\&xCAT::Client::handle_response); $cmdref->{arg}->[0] = "x86"; - ${"xCAT_plugin::mknb::"}{process_request}->($cmdref, \&xCAT::Client::handle_response); + $doreq->($cmdref,\&xCAT::Client::handle_response); $cmdref->{arg}->[0] = "x86_64"; - ${"xCAT_plugin::mknb::"}{process_request}->($cmdref, \&xCAT::Client::handle_response); + $doreq->($cmdref,\&xCAT::Client::handle_response); #now, run nodeset enact on my $mactab = xCAT::Table->new('mac'); my $hmtab = xCAT::Table->new('noderes'); @@ -968,8 +970,7 @@ sub setup_TFTP my $plugins_dir=$::XCATROOT.'/lib/perl/xCAT_plugin'; foreach my $modname (keys %netmethods) { $cmdref->{node} = $netmethods{$modname}; - require "$plugins_dir/$modname.pm"; - ${"xCAT_plugin::" . $modname . "::"}{process_request}->($cmdref, \&xCAT::Client::handle_response); + $doreq->($cmdref,\&xCAT::Client::handle_response); } } diff --git a/xCAT-server/sbin/xcatd b/xCAT-server/sbin/xcatd index c1acc43c9..0b28db62f 100755 --- a/xCAT-server/sbin/xcatd +++ b/xCAT-server/sbin/xcatd @@ -423,6 +423,15 @@ sub scan_plugins { } } } + my @plugins=glob($plugins_dir."/*.pm"); + foreach (@plugins) { + /.*\/([^\/]*).pm$/; + my $modname = $1; + unless (defined(${"xCAT_plugin::".$modname."::"}{init_plugin})) { + next; + } + ${"xCAT_plugin::".$modname."::"}{init_plugin}->(); + } } scan_plugins; eval {