diff --git a/docs/source/guides/admin-guides/references/man1/nodediscoverls.1.rst b/docs/source/guides/admin-guides/references/man1/nodediscoverls.1.rst index 8d1458b64..666477d78 100644 --- a/docs/source/guides/admin-guides/references/man1/nodediscoverls.1.rst +++ b/docs/source/guides/admin-guides/references/man1/nodediscoverls.1.rst @@ -19,7 +19,7 @@ SYNOPSIS ******** -\ **nodediscoverls**\ [\ **-t seq | profile | switch | blade | manual | undef | all**\ ] [\ **-l**\ ] +\ **nodediscoverls**\ [\ **-t seq | profile | switch | blade | manual | mtms | undef | all**\ ] [\ **-l**\ ] \ **nodediscoverls**\ [\ **-u**\ \ *uuid*\ ] [\ **-l**\ ] @@ -47,7 +47,7 @@ OPTIONS -\ **-t seq|profile|switch|blade|manual|undef|all**\ +\ **-t seq|profile|switch|blade|manual|mtms|undef|all**\ Display the nodes that have been discovered by the specified discovery method: @@ -72,6 +72,10 @@ OPTIONS + \* \ **mtms**\ - MTMS discovery (used when node mtm and serial fields are filled in). + + + \* \ **undef**\ - Display the nodes that were in the discovery pool, but for which xCAT has not yet received a discovery request. diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index f4f9965cc..c38db16d2 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -1551,14 +1551,14 @@ passed as argument rather than by table value', If multiple ip addresses are associated with each NIC: !|,!|,..., for example, eth0!-eth0|-eth0-ipv6,ib0!-ib0|-ib0-ipv6. The xCAT object definition commands support to use nichostnamesuffixes. as the sub attributes. - Note: According to DNS rules a hostname must be a text string up to 24 characters drawn from the alphabet (A-Z), digits (0-9), minus sign (-),and period (.). When you are specifying "nichostnamesuffixes" or "nicaliases" make sure the resulting hostnames will conform to this naming convention', + Note: According to DNS rules a hostname must be a text string up to 24 characters drawn from the alphabet (A-Z), digits (0-9) and minus sign (-). When you are specifying "nichostnamesuffixes" or "nicaliases" make sure the resulting hostnames will conform to this naming convention', nichostnameprefixes => 'Comma-separated list of hostname prefixes per NIC. If only one ip address is associated with each NIC: !,!,..., for example, eth0!eth0-,ib0!ib- If multiple ip addresses are associated with each NIC: !|,!|,..., for example, eth0!eth0-|eth0-ipv6i-,ib0!ib-|ib-ipv6-. The xCAT object definition commands support to use nichostnameprefixes. as the sub attributes. - Note: According to DNS rules a hostname must be a text string up to 24 characters drawn from the alphabet (A-Z), digits (0-9), minus sign (-),and period (.). When you are specifying "nichostnameprefixes" or "nicaliases" make sure the resulting hostnames will conform to this naming convention', + Note: According to DNS rules a hostname must be a text string up to 24 characters drawn from the alphabet (A-Z), digits (0-9) and minus sign (-). When you are specifying "nichostnameprefixes" or "nicaliases" make sure the resulting hostnames will conform to this naming convention', nictypes => 'Comma-separated list of NIC types per NIC. !,!, e.g. eth0!Ethernet,ib0!Infiniband. The xCAT object definition commands support to use nictypes. as the sub attributes.', niccustomscripts => 'Comma-separated list of custom scripts per NIC. !,!, e.g. eth0!configeth eth0, ib0!configib ib0. The xCAT object definition commands support to use niccustomscripts. as the sub attribute .', diff --git a/perl-xCAT/xCAT/data/switchinfo.pm b/perl-xCAT/xCAT/data/switchinfo.pm index 79c36abfa..cf8f1af80 100644 --- a/perl-xCAT/xCAT/data/switchinfo.pm +++ b/perl-xCAT/xCAT/data/switchinfo.pm @@ -18,7 +18,10 @@ our %global_mac_identity = ( "fc:cf:62" => "BNT G8124 switch", "7c:fe:90" => "Mellanox IB switch", "cc:37:ab" => "Edgecore Networks Switch", - "8c:ea:1b" => "Edgecore Networks Switch" + "8c:ea:1b" => "Edgecore Networks Switch", + "a8:2b:b5" => "Edgecore Networks Switch", + "3c:2c:99" => "Edgecore Networks Switch", + "70:72:cf" => "Edgecore Networks Switch" ); #the hash to lookup switch type with vendor diff --git a/xCAT-server/lib/xcat/plugins/dhcp.pm b/xCAT-server/lib/xcat/plugins/dhcp.pm index 6494e555e..62671753b 100644 --- a/xCAT-server/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server/lib/xcat/plugins/dhcp.pm @@ -1128,7 +1128,7 @@ sub preprocess_request $callback->({ error => [ "Hierarchy requested, therefore networks.dhcpserver must be set for net=" . $_->{net} . "" ], errorcode => [1] }); return []; } - push @dhcpsvrs, $_->{dhcpserver}; + push @dhcpsvrs, $_->{dhcpserver} if (xCAT::NetworkUtils->nodeonmynet($_->{dhcpserver})); xCAT::MsgUtils->trace($verbose_on_off, "d", "dhcp: dhcp server on $_->{net}: $_->{dhcpserver}"); } } diff --git a/xCAT-server/lib/xcat/plugins/grub2.pm b/xCAT-server/lib/xcat/plugins/grub2.pm index 4f72eb452..8906d15f6 100644 --- a/xCAT-server/lib/xcat/plugins/grub2.pm +++ b/xCAT-server/lib/xcat/plugins/grub2.pm @@ -504,8 +504,7 @@ sub preprocess_request { if ($ntab) { foreach (@{ $ntab->getAllEntries() }) { next unless ($_->{dynamicrange}); - # if dynamicrange specified but dhcpserver was not - issue error message - push @dhcpsvrs, $_->{dhcpserver} if ($_->{dhcpserver}) + push @dhcpsvrs, $_->{dhcpserver} if ($_->{dhcpserver} && xCAT::NetworkUtils->nodeonmynet($_->{dhcpserver})); } } return xCAT::Scope->get_broadcast_disjoint_scope_with_parallel($req, $sn_hash, \@dhcpsvrs); @@ -854,7 +853,11 @@ sub process_request { push(@rmdhcp_nodes, $tmp_node); } } - $sub_req->({ command => ['makedhcp'], arg => ['-d'], node => \@rmdhcp_nodes }, $callback); + if ($request->{'_disparatetftp'}->[0]) { + $sub_req->({ command => ['makedhcp'], arg => ['-d', '-l'], node => \@rmdhcp_nodes }, $callback); + } else { + $sub_req->({ command => ['makedhcp'], arg => ['-d'], node => \@rmdhcp_nodes }, $callback); + } } #now run the end part of the prescripts diff --git a/xCAT-server/lib/xcat/plugins/hosts.pm b/xCAT-server/lib/xcat/plugins/hosts.pm index f2a8f3327..945509f36 100755 --- a/xCAT-server/lib/xcat/plugins/hosts.pm +++ b/xCAT-server/lib/xcat/plugins/hosts.pm @@ -165,7 +165,7 @@ sub build_line $longname = "$node.$domain"; } - # if shortname contains a dot then we have a bad syntax for name + # if shortname contains a dot then we have a bad syntax for name if ($shortname =~ /\./) { my $rsp; push @{ $rsp->{data} }, "Invalid short node name \'$shortname\'. The short node name may not contain a dot. The short node name is considered to be anything preceeding the network domain name in the fully qualified node name \'$longname\'.\n"; @@ -729,9 +729,28 @@ sub donics for (my $i = 0 ; $i < $nicindex{$nic} ; $i++) { if (!$nich->{$nic}->{nicsufx}->[$i] && !$nich->{$nic}->{nicprfx}->[$i]) { + if ($nic =~ /\./) { + my $rsp; + push @{ $rsp->{data} }, "$node: since \'$nic\' contains dot, nics.nichostnamesuffixes.$nic should be configured without dot for \'$nic\' interface."; + xCAT::MsgUtils->message("E", $rsp, $callback); + next; + } # then we have no suffix at all for this # so set a default $nich->{$nic}->{nicsufx}->[$i] = "-$nic"; + + } elsif ($nich->{$nic}->{nicsufx}->[$i] && $nich->{$nic}->{nicsufx}->[$i] =~ /\./) { + my $rsp; + push @{ $rsp->{data} }, "$node: the value \'$nich->{$nic}->{nicsufx}->[$i]\' of nics.nichostnamesuffixes.$nic should not contain dot."; + xCAT::MsgUtils->message("E", $rsp, $callback); + delete $nich->{$nic}->{nicsufx}->[$i]; + next; + } elsif ($nich->{$nic}->{nicprfx}->[$i] && $nich->{$nic}->{nicprfx}->[$i] =~ /\./) { + my $rsp; + push @{ $rsp->{data} }, "$node: the value \'$nich->{$nic}->{nicprfx}->[$i]\' of nics.nichostnameprefixes.$nic should not contain dot."; + xCAT::MsgUtils->message("E", $rsp, $callback); + delete $nich->{$nic}->{nicprfx}->[$i]; + next; } } } diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index 923aad072..5bf64ea70 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -1991,10 +1991,10 @@ sub do_firmware_update { } # For IBM Power S822LC for Big Data (Supermicro) machines such as - # P9 Boston (9006-22C, 9006-12) or P8 Briggs (8001-22C) + # P9 Boston (9006-22C, 9006-12C, 5104-22C) or P8 Briggs (8001-22C) # firmware update is done using pUpdate utility expected to be in the # specified data directory along with the update files .bin for BMC or .pnor for Host - if ($output =~ /8001-22C|9006-22C|9006-12C/) { + if ($output =~ /8001-22C|9006-22C|5104-22C|9006-12C/) { # Verify valid data directory was specified unless ($pUpdate_directory) { $exit_with_error_func->($sessdata->{node}, $callback, diff --git a/xCAT-server/lib/xcat/plugins/nodediscover.pm b/xCAT-server/lib/xcat/plugins/nodediscover.pm index b6b78383a..fcb4e9db5 100644 --- a/xCAT-server/lib/xcat/plugins/nodediscover.pm +++ b/xCAT-server/lib/xcat/plugins/nodediscover.pm @@ -454,10 +454,16 @@ sub process_request { } } } else { - - # Only BMC that doesn't support in-band configuration need to run rspconfig out-of-band, such as S822L running in OPAL model - xCAT::MsgUtils->message("S", "No bmcinband specified, need to configure BMC out-of-band"); - xCAT::Utils->cleanup_for_powerLE_hardware_discovery($request, $doreq); + if (defined($request->{bmc_node}) and defined($request->{bmc_node}->[0])) { + my $bmc_node = $request->{bmc_node}->[0]; + if ($bmc_node =~ /\,/) { + xCAT::MsgUtils->message("W", "Multiple BMC nodes matched with no bmcinband specified, please remove manually"); + } else { + # Only BMC that doesn't support in-band configuration need to run rspconfig out-of-band, such as S822L running in OPAL model + xCAT::MsgUtils->message("S", "No bmcinband specified, need to configure BMC out-of-band"); + xCAT::Utils->cleanup_for_powerLE_hardware_discovery($request, $doreq); + } + } } diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 40a9e3508..dfcd11a89 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -96,6 +96,7 @@ my %sensor_units = ( my $http_protocol="https"; my $openbmc_url = "/org/openbmc"; my $openbmc_project_url = "/xyz/openbmc_project"; +$::SOFTWARE_URL = "$openbmc_project_url/software"; #------------------------------------------------------- # The hash table to store method and url for request, @@ -1631,13 +1632,13 @@ sub reventlog_response { my $count = 0; if ($option_s) { foreach my $key ( sort { $b <=> $a } keys %output) { - xCAT::MsgUtils->message("I", { data => [$output{$key}] }, $callback, $node) if ($output{$key}); + xCAT::MsgUtils->message("I", { data => ["$node: $output{$key}"] }, $callback) if ($output{$key}); $count++; last if ($entry_string ne "all" and $count >= $entry_num); } } else { foreach my $key (sort keys %output) { - xCAT::MsgUtils->message("I", { data => [$output{$key}] }, $callback, $node) if ($output{$key}); + xCAT::MsgUtils->message("I", { data => ["$node: $output{$key}"] }, $callback) if ($output{$key}); $count++; last if ($entry_string ne "all" and $count >= $entry_num); } @@ -2070,24 +2071,27 @@ sub rflash_response { $update_id = (split(/\//, $key_url))[ -1 ]; if (defined($content{Version}) and $content{Version}) { $update_version = $content{Version}; - } - if ($update_version eq $::UPLOAD_FILE_VERSION) { - # Found a match of uploaded file version with the image in software/enumerate + if ($update_version eq $::UPLOAD_FILE_VERSION) { + # Found a match of uploaded file version with the image in software/enumerate - # Set the image id for the activation request - $status_info{RFLASH_UPDATE_ACTIVATE_REQUEST}{init_url} .= "/$update_id/attr/RequestedActivation"; - $status_info{RFLASH_UPDATE_CHECK_STATE_REQUEST}{init_url} .= "/$update_id"; - $status_info{RFLASH_SET_PRIORITY_REQUEST}{init_url} .= "/$update_id/attr/Priority"; + # Set the image id for the activation request + $status_info{RFLASH_UPDATE_ACTIVATE_REQUEST}{init_url} = + $::SOFTWARE_URL . "/$update_id/attr/RequestedActivation"; + $status_info{RFLASH_UPDATE_CHECK_STATE_REQUEST}{init_url} = + $::SOFTWARE_URL . "/$update_id"; + $status_info{RFLASH_SET_PRIORITY_REQUEST}{init_url} = + $::SOFTWARE_URL . "/$update_id/attr/Priority"; - # Set next steps to activate the image - $next_status{ $node_info{$node}{cur_status} } = "RFLASH_UPDATE_ACTIVATE_REQUEST"; - $next_status{"RFLASH_UPDATE_ACTIVATE_REQUEST"} = "RFLASH_UPDATE_ACTIVATE_RESPONSE"; - $next_status{"RFLASH_UPDATE_ACTIVATE_RESPONSE"} = "RFLASH_UPDATE_CHECK_STATE_REQUEST"; - $next_status{"RFLASH_UPDATE_CHECK_STATE_REQUEST"} = "RFLASH_UPDATE_CHECK_STATE_RESPONSE"; + # Set next steps to activate the image + $next_status{ $node_info{$node}{cur_status} } = "RFLASH_UPDATE_ACTIVATE_REQUEST"; + $next_status{"RFLASH_UPDATE_ACTIVATE_REQUEST"} = "RFLASH_UPDATE_ACTIVATE_RESPONSE"; + $next_status{"RFLASH_UPDATE_ACTIVATE_RESPONSE"} = "RFLASH_UPDATE_CHECK_STATE_REQUEST"; + $next_status{"RFLASH_UPDATE_CHECK_STATE_REQUEST"} = "RFLASH_UPDATE_CHECK_STATE_RESPONSE"; - $next_status{"RFLASH_SET_PRIORITY_REQUEST"} = "RFLASH_SET_PRIORITY_RESPONSE"; - $next_status{"RFLASH_SET_PRIORITY_RESPONSE"} = "RFLASH_UPDATE_CHECK_STATE_REQUEST"; - last; + $next_status{"RFLASH_SET_PRIORITY_REQUEST"} = "RFLASH_SET_PRIORITY_RESPONSE"; + $next_status{"RFLASH_SET_PRIORITY_RESPONSE"} = "RFLASH_UPDATE_CHECK_STATE_REQUEST"; + last; + } } } } diff --git a/xCAT-server/lib/xcat/plugins/petitboot.pm b/xCAT-server/lib/xcat/plugins/petitboot.pm index c6c9c7295..a307fab3a 100644 --- a/xCAT-server/lib/xcat/plugins/petitboot.pm +++ b/xCAT-server/lib/xcat/plugins/petitboot.pm @@ -390,8 +390,7 @@ sub preprocess_request { if ($ntab) { foreach (@{ $ntab->getAllEntries() }) { next unless ($_->{dynamicrange}); - # if dynamicrange specified but dhcpserver was not - issue error message - push @dhcpsvrs, $_->{dhcpserver} if ($_->{dhcpserver}) + push @dhcpsvrs, $_->{dhcpserver} if ($_->{dhcpserver} && xCAT::NetworkUtils->nodeonmynet($_->{dhcpserver})); } } return xCAT::Scope->get_broadcast_disjoint_scope_with_parallel($req, $sn_hash, \@dhcpsvrs); @@ -645,7 +644,7 @@ sub process_request { } #Don't bother to try dhcp binding changes if sub_req not passed, i.e. service node build time - unless (($inittime) || ($args[0] eq 'offline')) { + unless ($inittime) { #dhcp stuff my $do_dhcpsetup = 1; @@ -654,9 +653,11 @@ sub process_request { if (defined($t_entry)) { if ($t_entry =~ /0|n|N/) { $do_dhcpsetup = 0; } } - if ($do_dhcpsetup) { + # For offline operation, remove the dhcp entries whatever dhcpset is disabled in site ( existing code logic, just keep it as is) + if ($do_dhcpsetup || $args[0] eq 'offline') { my @parameter; push @parameter, '-l' if ($request->{'_disparatetftp'}->[0]); + push @parameter, '-d' if ($args[0] eq 'offline'); xCAT::MsgUtils->trace($verbose_on_off, "d", "petitboot: issue makedhcp request"); $sub_req->({ command => ['makedhcp'], @@ -668,12 +669,6 @@ sub process_request { } - if ($args[0] eq 'offline') { - - # If nodeset directive was offline we need to remove dhcp entries - $sub_req->({ command => ['makedhcp'], arg => ['-d'], node => \@normalnodeset }, $callback); - } - #now run the end part of the prescripts unless ($args[0] eq '') { # or $args[0] eq 'enact') $errored = 0; diff --git a/xCAT-server/lib/xcat/plugins/seqdiscovery.pm b/xCAT-server/lib/xcat/plugins/seqdiscovery.pm index ea114681f..413382266 100755 --- a/xCAT-server/lib/xcat/plugins/seqdiscovery.pm +++ b/xCAT-server/lib/xcat/plugins/seqdiscovery.pm @@ -131,25 +131,25 @@ sub findme { } } my $bmc_node = undef; + my @bmc_nodes = (); 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 ($::XCATMPHASH{$_}) { - $bmc_node = $_; + push @bmc_nodes, $_; } } } - unless ($bmc_node) { - if ($request->{'bmcmac'}->[0]) { - my $bmcmac = lc($request->{'bmcmac'}->[0]); - $bmcmac =~ s/\://g; - my $tmp_node = "node-$bmcmac"; - $bmc_node = $tmp_node if ($::XCATMPHASH{$tmp_node}); - } + if ($request->{'bmcmac'}->[0]) { + my $bmcmac = lc($request->{'bmcmac'}->[0]); + $bmcmac =~ s/\://g; + my $tmp_node = "node-$bmcmac"; + push @bmc_nodes, $tmp_node if ($::XCATMPHASH{$tmp_node}); } + $bmc_node = join(",", @bmc_nodes); if ($node) { my $skiphostip; my $skipbmcip; @@ -808,7 +808,7 @@ sub nodediscoverls { Usage: nodediscoverls nodediscoverls [-h|--help|-v|--version] - nodediscoverls [-t seq|profile|switch|blade|manual|undef|all] [-l] + nodediscoverls [-t seq|profile|switch|blade|manual|mtms|undef|all] [-l] nodediscoverls [-u uuid] [-l] "; $rsp = (); @@ -843,7 +843,7 @@ Usage: # If the type is specified, display the corresponding type of nodes my @SEQDiscover; if ($type) { - if ($type !~ /^(seq|profile|switch|blade|manual|undef|all)$/) { + if ($type !~ /^(seq|profile|switch|blade|manual|mtms|undef|all)$/) { $usage->($callback, "The discovery type \'$type\' is not supported."); return; } @@ -917,7 +917,7 @@ Usage: } else { $ent->{'node'} = 'undef' unless ($ent->{'node'}); $ent->{'method'} = 'undef' unless ($ent->{'method'}); - push @discoverednodes, sprintf(" %-40s%-20s%-15s%-10s%-20s", $ent->{'uuid'}, $ent->{'node'}, $ent->{'method'}, $ent->{'mtm'}, substr($ent->{'serial'}, 0, 19)); + push @discoverednodes, sprintf(" %-40s%-20s%-15s%-10s %-20s", $ent->{'uuid'}, $ent->{'node'}, $ent->{'method'}, $ent->{'mtm'}, substr($ent->{'serial'}, 0, 19)); } } @@ -927,7 +927,7 @@ Usage: } if (@discoverednodes) { unless ($long) { - push @{ $rsp->{data} }, sprintf(" %-40s%-20s%-15s%-10s%-13s", 'UUID', 'NODE', 'METHOD', 'MTM', 'SERIAL'); + push @{ $rsp->{data} }, sprintf(" %-40s%-20s%-15s%-10s %-20s", 'UUID', 'NODE', 'METHOD', 'MTM', 'SERIAL'); } foreach (@discoverednodes) { push @{ $rsp->{data} }, "$_"; diff --git a/xCAT-server/lib/xcat/plugins/switch.pm b/xCAT-server/lib/xcat/plugins/switch.pm index 523932036..024070b67 100644 --- a/xCAT-server/lib/xcat/plugins/switch.pm +++ b/xCAT-server/lib/xcat/plugins/switch.pm @@ -336,25 +336,25 @@ sub process_request { } } my $bmc_node = undef; + my @bmc_nodes = (); 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 ($::XCATMPHASH{$_}) { - $bmc_node = $_; + push @bmc_nodes, $_; } } } - unless ($bmc_node) { - if ($req->{'bmcmac'}->[0]) { - my $bmcmac = lc($req->{'bmcmac'}->[0]); - $bmcmac =~ s/\://g; - my $tmp_node = "node-$bmcmac"; - $bmc_node = $tmp_node if ($::XCATMPHASH{$tmp_node}); - } + if ($req->{'bmcmac'}->[0]) { + my $bmcmac = lc($req->{'bmcmac'}->[0]); + $bmcmac =~ s/\://g; + my $tmp_node = "node-$bmcmac"; + push @bmc_nodes, $tmp_node if ($::XCATMPHASH{$tmp_node}); } + $bmc_node = join(",", @bmc_nodes); if ($node) { xCAT::MsgUtils->message("S", "xcat.discovery.switch: ($req->{_xcat_clientmac}->[0]) Found node: $node"); diff --git a/xCAT-server/lib/xcat/plugins/switchdiscover.pm b/xCAT-server/lib/xcat/plugins/switchdiscover.pm index edf5ce5ae..c3a16ea61 100644 --- a/xCAT-server/lib/xcat/plugins/switchdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/switchdiscover.pm @@ -350,7 +350,6 @@ sub process_request { } #consolidate the results by merging the swithes with the same ip or same mac - #or same hostname my $result; my $merged; my $counter=0; @@ -366,12 +365,11 @@ sub process_request { my $new_ip = $result->{$new_mac}->{ip}; my $new_name = $result->{$new_mac}->{name}; my $new_vendor = $result->{$new_mac}->{vendor}; + my $key =$new_mac; if (($old_mac eq $new_mac) || - ($old_ip && ($old_ip eq $new_ip)) || - ($old_name && ($old_name eq $new_name))) { + ($old_ip && ($old_ip eq $new_ip))) { $same = 1; - my $key =$new_mac; if ($new_mac =~ /nomac/) { if ($old_mac =~ /nomac/) { $key = "nomac_$counter"; @@ -380,9 +378,6 @@ sub process_request { $key = $old_mac; } } - if ($old_name) { - $result->{$key}->{name} = $old_name; - } if ($old_ip) { $result->{$key}->{ip} = $old_ip; } @@ -399,6 +394,12 @@ sub process_request { delete $result->{$new_mac}; } } + if ( $old_name && ($old_name eq $new_name)) { + #appending mac address to end of hostname + my $mac_str = lc($old_mac); + $mac_str =~ s/\://g; + $result->{$key}->{name} = "$old_name-$mac_str"; + } } if (!$same) { $result->{$old_mac} = $tmp_result->{$old_mac}; @@ -1107,7 +1108,7 @@ sub get_snmphostname { my ($desc,$hostname) = split /: /, $result; if (exists($globalopt{verbose})) { - send_msg($request, 0, "switch hostname = $hostname\n" ); + send_msg($request, 0, "$device hostname = $hostname\n" ); } return $hostname; @@ -1140,7 +1141,7 @@ sub get_hostname { if ( !$host ) { my $ip_str = $ip; $ip_str =~ s/\./\-/g; - $host = "switch-$ip_str"; + $host = "$device-$ip_str"; } } return $host; diff --git a/xCAT-server/lib/xcat/plugins/typemtms.pm b/xCAT-server/lib/xcat/plugins/typemtms.pm index b6bcb9817..d8bbc5e54 100644 --- a/xCAT-server/lib/xcat/plugins/typemtms.pm +++ b/xCAT-server/lib/xcat/plugins/typemtms.pm @@ -26,24 +26,24 @@ sub findme { my $mtms = $request->{'mtm'}->[0] . "*" . $request->{'serial'}->[0]; my $tmp_nodes = $::XCATVPDHASH{$mtms}; my @nodes = (); - my $bmc_node; + my @bmc_nodes = (); + my $bmc_node = undef; foreach (@$tmp_nodes) { if ($::XCATMPHASH{$_}) { - $bmc_node = $_; + push @bmc_nodes, $_; } else { push @nodes, $_; } } - unless ($bmc_node) { - if ($request->{'bmcmac'}->[0]) { - my $bmcmac = lc($request->{'bmcmac'}->[0]); - $bmcmac =~ s/\://g; - my $tmp_node = "node-$bmcmac"; - $bmc_node = $tmp_node if ($::XCATMPHASH{$tmp_node}); - } + if ($request->{'bmcmac'}->[0]) { + my $bmcmac = lc($request->{'bmcmac'}->[0]); + $bmcmac =~ s/\://g; + my $tmp_node = "node-$bmcmac"; + push @bmc_nodes, $tmp_node if ($::XCATMPHASH{$tmp_node}); } + $bmc_node = join(",", @bmc_nodes); my $nodenum = $#nodes; if ($nodenum < 0) { xCAT::MsgUtils->message("S", "xcat.discovery.mtms: ($request->{_xcat_clientmac}->[0]) Warning: Could not find any node for $mtms using mtms-based discovery"); diff --git a/xCAT-server/lib/xcat/plugins/xnba.pm b/xCAT-server/lib/xcat/plugins/xnba.pm index 1bccc87b9..7410eeb42 100644 --- a/xCAT-server/lib/xcat/plugins/xnba.pm +++ b/xCAT-server/lib/xcat/plugins/xnba.pm @@ -442,8 +442,7 @@ sub preprocess_request { if ($ntab) { foreach (@{ $ntab->getAllEntries() }) { next unless ($_->{dynamicrange}); - # if dynamicrange specified but dhcpserver was not - issue error message - push @dhcpsvrs, $_->{dhcpserver} if ($_->{dhcpserver}) + push @dhcpsvrs, $_->{dhcpserver} if ($_->{dhcpserver} && xCAT::NetworkUtils->nodeonmynet($_->{dhcpserver})); } } return xCAT::Scope->get_broadcast_disjoint_scope_with_parallel($req, $sn_hash, \@dhcpsvrs); @@ -696,22 +695,19 @@ sub process_request { } xCAT::MsgUtils->trace($verbose_on_off, "d", "xnba: Finish to handle configurations"); - # for offline operation, remove the dhcp entries - if ($args[0] eq 'offline') { - $sub_req->({ command => ['makedhcp'], arg => ['-d'], node => \@nodes }, $::XNBA_callback); - } - #dhcp stuff -- inittime is set when xcatd on sn is started - unless (($inittime) || ($args[0] eq 'offline')) { + unless ($inittime) { my $do_dhcpsetup = 1; my @entries = xCAT::TableUtils->get_site_attribute("dhcpsetup"); my $t_entry = $entries[0]; if (defined($t_entry)) { if ($t_entry =~ /0|n|N/) { $do_dhcpsetup = 0; } } - if ($do_dhcpsetup) { + # For offline operation, remove the dhcp entries whatever dhcpset is disabled in site ( existing code logic, just keep it as is) + if ($do_dhcpsetup || $args[0] eq 'offline') { my @parameter; push @parameter, '-l' if ($::XNBA_request->{'_disparatetftp'}->[0]); + push @parameter, '-d' if ($args[0] eq 'offline'); xCAT::MsgUtils->trace($verbose_on_off, "d", "xnba: issue makedhcp request"); $sub_req->({ command => ['makedhcp'],