Fix some minor bugs and add msg
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.7@13418 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
c45549830f
commit
5f58bb8dc8
@ -79,22 +79,10 @@ sub process_request {
|
||||
$callback = shift;
|
||||
$docmd = shift;
|
||||
%searchmacs=();
|
||||
%flexchassismap = ();
|
||||
my $srvtypes = [ qw/service:management-hardware.IBM:chassis-management-module service:management-hardware.IBM:management-module service:management-hardware.IBM:integrated-management-module2/ ];
|
||||
xCAT::SLP::dodiscover(SrvTypes=>$srvtypes,Callback=>\&handle_new_slp_entity);
|
||||
$macmap = xCAT::MacMap->new();
|
||||
$macmap->refresh_table();
|
||||
my @toconfig;
|
||||
foreach my $mac (keys(%searchmacs)) {
|
||||
my $node = $macmap->find_mac($mac,1);
|
||||
unless ($node) {
|
||||
next;
|
||||
}
|
||||
my $data = $searchmacs{$mac};
|
||||
$data->{nodename}=$node;
|
||||
$data->{macaddress}=$mac;
|
||||
$chassisbyuuid{$data->{attributes}->{"enclosure-uuid"}->[0]}=$node;
|
||||
push @toconfig,$data;
|
||||
}
|
||||
|
||||
my $mpatab=xCAT::Table->new("mpa",-create=>0);
|
||||
my @mpaentries;
|
||||
$mpahash={};
|
||||
@ -117,13 +105,13 @@ sub process_request {
|
||||
}
|
||||
my $mactab = xCAT::Table->new("mac");
|
||||
my %machash;
|
||||
my %node2machash;
|
||||
my %macuphash;
|
||||
my @maclist = $mactab->getAllNodeAttribs([qw/node mac/]);
|
||||
foreach (@maclist) {
|
||||
$machash{$_->{node}}=$_->{mac};
|
||||
$node2machash{$_->{mac}} = $_->{node};
|
||||
}
|
||||
|
||||
|
||||
|
||||
my $mptab = xCAT::Table->new('mp');
|
||||
if ($mptab) {
|
||||
@ -132,7 +120,26 @@ sub process_request {
|
||||
$nodebymp{$_->{mpa}}->{$_->{id}}=$_->{node};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$macmap = xCAT::MacMap->new();
|
||||
$macmap->refresh_table();
|
||||
my @toconfig;
|
||||
foreach my $mac (keys(%searchmacs)) {
|
||||
my $node = $macmap->find_mac($mac,1);
|
||||
unless ($node) {
|
||||
if (defined $node2machash{$mac}) {
|
||||
$node = $node2machash{$mac};
|
||||
} else {
|
||||
next;
|
||||
}
|
||||
}
|
||||
my $data = $searchmacs{$mac};
|
||||
$data->{nodename}=$node;
|
||||
$data->{macaddress}=$mac;
|
||||
$chassisbyuuid{$data->{attributes}->{"enclosure-uuid"}->[0]}=$node;
|
||||
push @toconfig,$data;
|
||||
}
|
||||
|
||||
foreach my $data (@toconfig) {
|
||||
my $mac = $data->{macaddress};
|
||||
my $nodename = $data->{nodename};
|
||||
@ -141,13 +148,16 @@ sub process_request {
|
||||
$addr .= "%".$data->{scopeid};
|
||||
}
|
||||
$flexchassisuuid{$nodename}=$data->{attributes}->{"enclosure-uuid"}->[0];
|
||||
setup_cmm_pass($nodename);
|
||||
if ($machash{$nodename} =~ /$mac/i) { #ignore prospects already known to mac table
|
||||
configure_hosted_elements($nodename);
|
||||
next;
|
||||
}
|
||||
|
||||
if ($data->{SrvType} eq "service:management-hardware.IBM:chassis-management-module") {
|
||||
sendmsg(":Found ".$data->{SrvType}." at address $addr",$callback,$nodename);
|
||||
|
||||
setup_cmm_pass($nodename);
|
||||
if ($machash{$nodename} =~ /$mac/i) { #ignore prospects already known to mac table
|
||||
configure_hosted_elements($nodename);
|
||||
next;
|
||||
}
|
||||
|
||||
unless (do_blade_setup($data,curraddr=>$addr)) {
|
||||
next;
|
||||
}
|
||||
@ -172,14 +182,21 @@ sub setupIMM {
|
||||
my $newaddr;
|
||||
if ($ient) {
|
||||
my $bmcid=$ient->{bmcid};
|
||||
if ($bmcid and $slpdata->{macaddress} =~ /$bmcid/) { return; } #skip configuration, we already know this one
|
||||
if ($bmcid and $slpdata->{macaddress} =~ /$bmcid/) {
|
||||
sendmsg("The IMM ".$node." has been configured (ipmi.bmcid). Skipped.",$callback);
|
||||
return;
|
||||
} #skip configuration, we already know this one
|
||||
$newaddr = $ient->{bmc};
|
||||
}
|
||||
my @ips;
|
||||
if ($newaddr) {
|
||||
@ips = xCAT::NetworkUtils::getipaddr($newaddr,GetAllAddresses=>1);
|
||||
}
|
||||
sendmsg(":Configuration of ".$node." commencing, configuration may take a few minutes to take effect",$callback);
|
||||
if (!@ips) {
|
||||
sendmsg(":Cannot find the IP attribute for bmc",$callback,$node);
|
||||
return;
|
||||
}
|
||||
sendmsg(":Configuration of ".$node."[".join(',',@ips)."] commencing, configuration may take a few minutes to take effect",$callback);
|
||||
#ok, with all ip addresses in hand, time to enable IPMI and set all the ip addresses (still static only, TODO: dhcp
|
||||
my $ssh = new xCAT::SSHInteract(-username=>$args{username},
|
||||
-password=>$args{password},
|
||||
@ -210,8 +227,8 @@ sub configure_hosted_elements {
|
||||
my $node;
|
||||
my $immdata;
|
||||
my $slot;
|
||||
my $user = $passwordmap{$cmm}->{username};
|
||||
my $pass = $passwordmap{$cmm}->{password};
|
||||
my $user = $passwordmap{$cmm}->{username};
|
||||
my $pass = $passwordmap{$cmm}->{password};
|
||||
foreach $immdata (@{$flexchassismap{$uuid}}) {
|
||||
$slot=$immdata->{attributes}->{slot}->[0];
|
||||
if ($node = $nodebymp{$cmm}->{$slot}) {
|
||||
@ -232,10 +249,10 @@ sub setup_cmm_pass {
|
||||
my $localpass=$defaultbladepass;
|
||||
if ($mpahash->{$nodename}) {
|
||||
if ($mpahash->{$nodename}->{username}) {
|
||||
$localuser = $mpahash->{$nodename}->[0]->{username};
|
||||
$localuser = $mpahash->{$nodename}->{username};
|
||||
}
|
||||
if ($mpahash->{$nodename}->{password}) {
|
||||
$localuser = $mpahash->{$nodename}->[0]->{password};
|
||||
$localpass = $mpahash->{$nodename}->{password};
|
||||
}
|
||||
}
|
||||
$passwordmap{$nodename}->{username}=$localuser;
|
||||
|
Loading…
Reference in New Issue
Block a user