From 706b89520fb255392f6a1a7f58da09d19eed1a3a Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Mon, 6 Feb 2012 09:30:08 +0000 Subject: [PATCH] Use option '-D' of getmacs to determinate the operation mode of a pblade, -D for DFM, else for CMM git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11485 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/blade.pm | 40 +++++++++++++++++++++------ xCAT-server/lib/xcat/plugins/fsp.pm | 28 +++++++++++++++++-- 2 files changed, 58 insertions(+), 10 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/blade.pm b/xCAT-server/lib/xcat/plugins/blade.pm index b793807f8..02d6be705 100644 --- a/xCAT-server/lib/xcat/plugins/blade.pm +++ b/xCAT-server/lib/xcat/plugins/blade.pm @@ -3528,14 +3528,22 @@ sub preprocess_request { #parse the arguments for commands if ($command eq "getmacs") { - foreach my $arg (@exargs) { - if (defined($arg) && $arg !~ /^-V|--verbose|-d|--arp$/) { - $usage_string="Error arguments\n"; - $usage_string .=xCAT::Usage->getUsage($command); - $callback->({data=>$usage_string}); - $request = {}; - return; + my (@mpnodes, @fspnodes); + filter_nodes($request, \@mpnodes, \@fspnodes); + if (@mpnodes) { + $noderange = \@mpnodes; + foreach my $arg (@exargs) { + if (defined($arg) && $arg !~ /^-V|--verbose|-d|--arp$/) { + $usage_string= ":Error arguments\n"; + $usage_string .=xCAT::Usage->getUsage($command); + $callback->({data=>$usage_string}); + $request = {}; + return; + } } + } else { + $request = {}; + return; } } elsif ($command eq "renergy") { if (! @exargs) { @@ -3706,12 +3714,28 @@ sub filter_nodes{ push @{$mpnodes}, @mp; push @{$fspnodes}, @commonfsp; + ## TRACE_LINE print "Nodes filter: mpnodes [@{$mpnodes}], fspnodes [@{$fspnodes}]\n"; if (@args && ($cmd eq "rspconfig") && (grep /^(network|network=.*)$/, @args)) { push @{$mpnodes}, @ngpfsp; + } elsif($cmd eq "getmacs") { + if (@args && (grep /^-D$/,@args)) { + @mp = (); + foreach (@{$mpnodes}) { + if (defined($ppctabhash->{$_}->[0]->{'parent'})) { + push @{$fspnodes}, $_; + } else { + push @mp, $_; + } + } + push @{$fspnodes}, @ngpfsp; + @{$mpnodes} = ();; + push @{$mpnodes}, @mp; + } else { + push @{$mpnodes}, @ngpfsp; + } } else { push @{$fspnodes}, @ngpfsp; } - ## TRACE_LINE print "Nodes filter: mpnodes [@{$mpnodes}], fspnodes [@{$fspnodes}]\n"; return 0; } diff --git a/xCAT-server/lib/xcat/plugins/fsp.pm b/xCAT-server/lib/xcat/plugins/fsp.pm index 79778d365..4ed25bc2c 100644 --- a/xCAT-server/lib/xcat/plugins/fsp.pm +++ b/xCAT-server/lib/xcat/plugins/fsp.pm @@ -84,7 +84,16 @@ sub preprocess_request { return []; } } - + + if ($arg1->{command}->[0] eq "getmacs") { + my (@mpnodes, @fspnodes); + filter_nodes($arg1, \@mpnodes, \@fspnodes); + if (@fspnodes) { + $arg1->{noderange} = \@fspnodes; + } else { + return []; + } + } xCAT::PPC::preprocess_request(__PACKAGE__,@_); } @@ -160,10 +169,25 @@ sub filter_nodes{ push @{$fspnodes}, @commonfsp; if (@args && ($cmd eq "rspconfig") && (grep /^(network|network=.*)$/, @args)) { push @{$mpnodes}, @ngpfsp; + } elsif($cmd eq "getmacs") { + if (@args && (grep /^-D$/,@args)) { + @mp = (); + foreach (@{$mpnodes}) { + if (defined($ppctabhash->{$_}->[0]->{'parent'})) { + push @{$fspnodes}, $_; + } else { + push @mp, $_; + } + } + push @{$fspnodes}, @ngpfsp; + @{$mpnodes} = (); + push @{$mpnodes}, @mp; + } else { + push @{$mpnodes}, @ngpfsp; + } } else { push @{$fspnodes}, @ngpfsp; } - return 0; } ##########################################################################