diff --git a/perl-xCAT/xCAT/MacMap.pm b/perl-xCAT/xCAT/MacMap.pm index 34f303aaa..2a1931397 100644 --- a/perl-xCAT/xCAT/MacMap.pm +++ b/perl-xCAT/xCAT/MacMap.pm @@ -510,7 +510,7 @@ sub refresh_table { # if we are doing switch discovery and the node is not a switch, skip # if we are NOT doing switch discovery, and the node is a switch, skip my $ntype = $typehash->{$entry->{node}}->[0]->{nodetype}; - if ( (($discover_switch) and ( $ntype ne "switch")) + if ( (($discover_switch) and ($ntype ne "switch") and ($ntype ne "pdu") ) or ( !($discover_switch) and ( $ntype eq "switch")) ){ xCAT::MsgUtils->trace(0, "d", "refresh_table: skip node=$entry->{node} switch=$entry->{switch} discover_switch=$discover_switch nodetype=$ntype\n"); next; diff --git a/perl-xCAT/xCAT/data/switchinfo.pm b/perl-xCAT/xCAT/data/switchinfo.pm index 1a8986877..b5793f01c 100644 --- a/perl-xCAT/xCAT/data/switchinfo.pm +++ b/perl-xCAT/xCAT/data/switchinfo.pm @@ -42,6 +42,8 @@ our %global_switch_type = ( Cumulus => "onie", cumulus => "onie", Edgecore => "onie", + sLEN => "irpdu", + sIBM => "irpdu", coral => "crpdu" ); diff --git a/xCAT-server/lib/xcat/plugins/pdu.pm b/xCAT-server/lib/xcat/plugins/pdu.pm index 852bdd816..363f61b4b 100644 --- a/xCAT-server/lib/xcat/plugins/pdu.pm +++ b/xCAT-server/lib/xcat/plugins/pdu.pm @@ -913,7 +913,7 @@ sub showMFR { foreach my $pdu (@$noderange) { unless ($pduhash->{$pdu}->[0]->{pdutype} eq "crpdu") { - xCAT::SvrUtils::sendmsg("This command only supports CONSTELLATION PDU with pdutype=crpdu", $callback,$pdu); + rinv_for_irpdu($pdu, $callback); next; } @@ -942,6 +942,61 @@ sub showMFR { } } +sub rinv_for_irpdu +{ + my $pdu = shift; + my $callback = shift; + my $output; + + my $session = connectTopdu($pdu,$callback); + if (!$session) { + $callback->({ errorcode => [1],error => "Couldn't connect to $pdu"}); + next; + } + my $line = "**********************************************************"; + xCAT::SvrUtils::sendmsg("$line", $callback,$pdu); + xCAT::SvrUtils::sendmsg("MFR Info List", $callback,$pdu); + xCAT::SvrUtils::sendmsg("$line", $callback,$pdu); + #ibmPduSoftwareVersion + $output = $session->get(".1.3.6.1.4.1.2.6.223.7.3.0"); + if ($output) { + xCAT::SvrUtils::sendmsg("PDU Software Version: $output", $callback,$pdu); + } + #ibmPduMachineType + $output = $session->get(".1.3.6.1.4.1.2.6.223.7.4.0"); + if ($output) { + xCAT::SvrUtils::sendmsg("PDU Machine Type: $output", $callback,$pdu); + } + #ibmPduModelNumber + $output = $session->get(".1.3.6.1.4.1.2.6.223.7.5.0"); + if ($output) { + xCAT::SvrUtils::sendmsg("PDU Model Number: $output", $callback,$pdu); + } + #ibmPduPartNumber + $output = $session->get(".1.3.6.1.4.1.2.6.223.7.6.0"); + if ($output) { + xCAT::SvrUtils::sendmsg("PDU Part Number: $output", $callback,$pdu); + } + #ibmPduName + $output = $session->get(".1.3.6.1.4.1.2.6.223.7.7.0"); + if ($output) { + xCAT::SvrUtils::sendmsg("PDU Name: $output", $callback,$pdu); + } + #ibmPduSerialNumber + $output = $session->get(".1.3.6.1.4.1.2.6.223.7.9.0"); + if ($output) { + xCAT::SvrUtils::sendmsg("PDU Serial Number: $output", $callback,$pdu); + } + #ibmPduDescription + $output = $session->get(".1.3.6.1.4.1.2.6.223.7.10.0"); + if ($output) { + xCAT::SvrUtils::sendmsg("PDU Description: $output", $callback,$pdu); + } + xCAT::SvrUtils::sendmsg("$line", $callback,$pdu); + +} + + #------------------------------------------------------- diff --git a/xCAT-server/lib/xcat/plugins/switchdiscover.pm b/xCAT-server/lib/xcat/plugins/switchdiscover.pm index d7374d9d3..7c3277154 100644 --- a/xCAT-server/lib/xcat/plugins/switchdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/switchdiscover.pm @@ -434,6 +434,7 @@ sub process_request { } if (exists($globalopt{setup})) { + send_msg(\%request, 0, "Configure $device ...."); switchsetup($predefineswitch, \%request, $sub_req); } @@ -1151,7 +1152,7 @@ sub get_switchtype { return $xCAT::data::switchinfo::global_switch_type{$key}; } else { if (exists($globalopt{pdu})) { - return "irpdu"; + return "crpdu"; } return $key; } @@ -1397,8 +1398,8 @@ sub matchPredefineSwitch { } my $stype = get_switchtype($vendor); - if (exists($globalopt{pdu})) { - $stype="pdu"; + if (exists($globalopt{pdu}) and !stype ) { + $stype="crpdu"; } send_msg($request, 0, "$device discovered and matched: $dswitch to $node" ); @@ -1432,34 +1433,39 @@ sub switchsetup { my $request = shift; my $sub_req = shift; if (exists($globalopt{pdu})) { - my $mytype = "pdu"; - my $nodetab = xCAT::Table->new('hosts'); - my $nodehash = $nodetab->getNodesAttribs(\@{${nodes_to_config}->{$mytype}},['ip','otherinterfaces']); # get netmask from network table my $nettab = xCAT::Table->new("networks"); my @nets; if ($nettab) { @nets = $nettab->getAllAttribs('net','mask'); } - - foreach my $pdu(@{${nodes_to_config}->{$mytype}}) { - my $cmd = "rspconfig $pdu sshcfg"; - xCAT::Utils->runcmd($cmd, 0); - my $ip = $nodehash->{$pdu}->[0]->{ip}; - my $mask; - foreach my $net (@nets) { - if (xCAT::NetworkUtils::isInSameSubnet( $net->{'net'}, $ip, $net->{'mask'}, 0)) { - $mask=$net->{'mask'}; + foreach my $mytype (keys %$nodes_to_config) { + if ( $mytype eq "irpdu" ) { + send_msg($request, 0, "the setup options for irpdu is not support yet\n"); + } elsif ( $mytype eq "crpdu" ) { + my $nodetab = xCAT::Table->new('hosts'); + my $nodehash = $nodetab->getNodesAttribs(\@{${nodes_to_config}->{$mytype}},['ip','otherinterfaces']); + foreach my $pdu(@{${nodes_to_config}->{$mytype}}) { + my $cmd = "rspconfig $pdu sshcfg"; + xCAT::Utils->runcmd($cmd, 0); + my $ip = $nodehash->{$pdu}->[0]->{ip}; + my $mask; + foreach my $net (@nets) { + if (xCAT::NetworkUtils::isInSameSubnet( $net->{'net'}, $ip, $net->{'mask'}, 0)) { + $mask=$net->{'mask'}; + } + } + $cmd = "rspconfig $pdu hostname=$pdu ip=$ip netmask=$mask"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC == 0) { + xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$pdu,"ip=$ip","otherinterfaces="] }, $sub_req, 0, 1); + } else { + send_msg($request, 0, "Failed to run rspconfig command to set ip/netmask\n"); + } } - } - $cmd = "rspconfig $pdu hostname=$pdu ip=$ip netmask=$mask"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC == 0) { - xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$pdu,"ip=$ip","otherinterfaces="] }, $sub_req, 0, 1); } else { - send_msg($request, 0, "Failed to run rspconfig command to set ip/netmask\n"); + send_msg($request, 0, "the pdu type $mytype is not support\n"); } - } return; }