-Add a 'secret' findmac command. fleshing out to a real command TBD

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6900 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2010-07-28 19:23:51 +00:00
parent a6eeb5d139
commit 261d06acc3

View File

@ -11,6 +11,7 @@ sub handled_commands {
$macmap = xCAT::MacMap->new();
return {
findme => 'switch',
findmac => 'switch',
};
}
@ -18,6 +19,14 @@ sub process_request {
my $req = shift;
my $cb = shift;
my $doreq = shift;
my $node;
my $mac = '';
if ($req->{command}->[0] eq 'findmac') {
$mac = $req->{arg}->[0];
$node = $macmap->find_mac($mac,0);
$cb->({node=>[{name=>$node,data=>$mac}]});
return;
}
my $ip = $req->{'_xcat_clientip'};
if (defined $req->{nodetype} and $req->{nodetype}->[0] eq 'virtual') {
#Don't attempt switch discovery of a VM Guest
@ -28,7 +37,6 @@ sub process_request {
#discovery working. Food for thought.
return;
}
my $mac = '';
my $arptable = `/sbin/arp -n`;
my @arpents = split /\n/,$arptable;
foreach (@arpents) {
@ -37,7 +45,6 @@ sub process_request {
last;
}
}
my $node;
my $firstpass=1;
if ($mac) {
$node = $macmap->find_mac($mac,$req->{cacheonly}->[0]);