enhance for p8 hardware discovery
This commit is contained in:
parent
4e008d7895
commit
87840527c2
@ -2142,38 +2142,21 @@ sub findme {
|
||||
my $request = shift;
|
||||
my $callback = shift;
|
||||
my $subreq = shift;
|
||||
my $vpdtab = xCAT::Table->new('vpd');
|
||||
if (!defined $request->{'mtm'} or !defined $request->{'serial'}) {
|
||||
xCAT::MsgUtils->message("S", "Discovery Error: 'mtm' or 'serial' not found.");
|
||||
return;
|
||||
}
|
||||
unless ($vpdtab) {
|
||||
xCAT::MsgUtils->message("S", "Discovery Error: Could not open table: vpd.");
|
||||
return;
|
||||
}
|
||||
my @attr_array = ();
|
||||
push @attr_array, "mtm==$request->{mtm}->[0]";
|
||||
push @attr_array, "serial==$request->{serial}->[0]";
|
||||
|
||||
my @tmp_nodes = $vpdtab->getAllAttribsWhere(\@attr_array, 'node');
|
||||
my $mtms = $request->{'mtm'}->[0]."*".$request->{'serial'}->[0];
|
||||
my $tmp_nodes = $::XCATVPDHASH{$mtms};
|
||||
my @nodes = ();
|
||||
my $pbmc_node;
|
||||
my %nodes_hash = ();
|
||||
foreach (@tmp_nodes) {
|
||||
$nodes_hash{$_->{node}} = '1';
|
||||
}
|
||||
@nodes = keys (%nodes_hash);
|
||||
# remove the pbmc node defined by lsslp from the node groups
|
||||
my $ppctab = xCAT::Table->new('ppc');
|
||||
if ($ppctab) {
|
||||
my $ppchash = $ppctab->getNodesAttribs(\@nodes, ['node', 'nodetype']);
|
||||
foreach (@nodes) {
|
||||
if (defined($ppchash->{$_}->[0]) && defined($ppchash->{$_}->[0]->{'nodetype'}) && $ppchash->{$_}->[0]->{'nodetype'} eq 'pbmc') {
|
||||
delete $nodes_hash{$_};
|
||||
$pbmc_node = $_;
|
||||
}
|
||||
foreach (@$tmp_nodes) {
|
||||
if ($::XCATPPCHASH{$_}) {
|
||||
$pbmc_node = $_;
|
||||
} else {
|
||||
push @nodes, $_;
|
||||
}
|
||||
@nodes = keys (%nodes_hash);
|
||||
}
|
||||
my $nodenum = $#nodes;
|
||||
if ($nodenum < 0) {
|
||||
|
@ -130,6 +130,17 @@ sub findme {
|
||||
$node = $allnodes[0];
|
||||
}
|
||||
}
|
||||
my $pbmc_node = undef;
|
||||
if ($request->{'mtm'}->[0] and $request->{'serial'}->[0]) {
|
||||
my $mtms = $request->{'mtm'}->[0]."*".$request->{'serial'}->[0];
|
||||
my $tmp_nodes = $::XCATVPDHASH{$mtms};
|
||||
foreach (@$tmp_nodes) {
|
||||
if ($::XCATPPCHASH{$_}) {
|
||||
$pbmc_node = $_;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($node) {
|
||||
my $skiphostip;
|
||||
@ -363,8 +374,13 @@ sub findme {
|
||||
}
|
||||
|
||||
# call the discovered command to update the discovery request to a node
|
||||
|
||||
$request->{command}=['discovered'];
|
||||
$request->{noderange} = [$node];
|
||||
if ($pbmc_node) {
|
||||
$request->{pbmc_node} = [$pbmc_node];
|
||||
}
|
||||
|
||||
$request->{discoverymethod} = ['sequential'];
|
||||
$request->{updateswitch} = ['yes'];
|
||||
$subreq->($request);
|
||||
|
@ -157,6 +157,16 @@ sub process_request {
|
||||
if ($node) { last; }
|
||||
}
|
||||
}
|
||||
my $pbmc_node = undef;
|
||||
if ($req->{'mtm'}->[0] and $req->{'serial'}->[0]) {
|
||||
my $mtms = $req->{'mtm'}->[0]."*".$req->{'serial'}->[0];
|
||||
my $tmp_nodes = $::XCATVPDHASH{$mtms};
|
||||
foreach (@$tmp_nodes) {
|
||||
if ($::XCATPPCHASH{$_}) {
|
||||
$pbmc_node = $_;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($node) {
|
||||
my $mactab = xCAT::Table->new('mac',-create=>1);
|
||||
@ -169,6 +179,9 @@ sub process_request {
|
||||
#$doreq->(\%request);
|
||||
$req->{command}=['discovered'];
|
||||
$req->{noderange} = [$node];
|
||||
if ($pbmc_node) {
|
||||
$req->{pbmc_node} = [$pbmc_node];
|
||||
}
|
||||
$req->{discoverymethod} = ['switch'];
|
||||
$doreq->($req);
|
||||
%{$req}=();#Clear req structure, it's done..
|
||||
|
Loading…
Reference in New Issue
Block a user