mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-05-05 16:49:08 +00:00
Improve rspconfig SET readback and fix backupgateway SET target
On some BMCs (notably Supermicro), a GET immediately after SET returns the old value until the BMC applies the change. This made rspconfig output misleading for network setting operations. - Store the canonical SET value after normalization and compare with the GET readback for ip, netmask, gateway, and backupgateway. When they differ, annotate the output: "BMC Gateway: 10.20.0.1 (requested 10.20.0.254, not yet reflected)" - Consolidate ip/netmask/gateway/backupgateway display into one block - Fix backupgateway SET: was routed through the gateway branch writing parameter 0x0C instead of 0x0E. Now has its own branch writing the correct IPMI parameter. - ip=dhcp is unaffected (separate code path, never stores a value) Tested on Supermicro IPMI BMC (10.20.0.51). Fixes #3445
This commit is contained in:
@@ -936,15 +936,25 @@ sub setnetinfo {
|
||||
foreach (0 .. 3) {
|
||||
$mask[$_] = $mask[$_] + 0;
|
||||
}
|
||||
$sessdata->{setnetinfo_value} = join(".", @mask);
|
||||
@cmd = (0x01, $channel_number, 0x6, @mask);
|
||||
}
|
||||
} elsif ($subcommand =~ m/gateway/ and $argument) {
|
||||
} elsif ($subcommand eq "gateway" and $argument) {
|
||||
my $gw = inet_ntoa(inet_aton($argument));
|
||||
my @mask = split /\./, $gw;
|
||||
foreach (0 .. 3) {
|
||||
$mask[$_] = $mask[$_] + 0;
|
||||
}
|
||||
@cmd = (0x01, $channel_number, 12, @mask);
|
||||
$sessdata->{setnetinfo_value} = $gw;
|
||||
@cmd = (0x01, $channel_number, 0x0C, @mask);
|
||||
} elsif ($subcommand eq "backupgateway" and $argument) {
|
||||
my $gw = inet_ntoa(inet_aton($argument));
|
||||
my @mask = split /\./, $gw;
|
||||
foreach (0 .. 3) {
|
||||
$mask[$_] = $mask[$_] + 0;
|
||||
}
|
||||
$sessdata->{setnetinfo_value} = $gw;
|
||||
@cmd = (0x01, $channel_number, 0x0E, @mask);
|
||||
} elsif ($subcommand =~ m/vlan/) {
|
||||
unless ( int($argument) == $argument ) {
|
||||
$callback->({ errorcode => [1], error => ["The input $argument is invalid, please input an integer"] });
|
||||
@@ -975,6 +985,7 @@ sub setnetinfo {
|
||||
foreach (0 .. 3) {
|
||||
$mask[$_] = $mask[$_] + 0;
|
||||
}
|
||||
$sessdata->{setnetinfo_value} = $mip;
|
||||
@cmd = (0x01, $channel_number, 0x3, @mask);
|
||||
}
|
||||
|
||||
@@ -1165,34 +1176,17 @@ sub getnetinfo_response {
|
||||
} else {
|
||||
xCAT::SvrUtils::sendmsg("BMC VLAN disabled" . $bmcifo, $callback, $sessdata->{node}, %allerrornodes);
|
||||
}
|
||||
} elsif ($subcommand eq "ip") {
|
||||
xCAT::SvrUtils::sendmsg(sprintf("$format %d.%d.%d.%d" . $bmcifo,
|
||||
"BMC IP:",
|
||||
$returnd[2],
|
||||
$returnd[3],
|
||||
$returnd[4],
|
||||
$returnd[5]), $callback, $sessdata->{node}, %allerrornodes);
|
||||
} elsif ($subcommand eq "netmask") {
|
||||
xCAT::SvrUtils::sendmsg(sprintf("$format %d.%d.%d.%d" . $bmcifo,
|
||||
"BMC Netmask:",
|
||||
$returnd[2],
|
||||
$returnd[3],
|
||||
$returnd[4],
|
||||
$returnd[5]), $callback, $sessdata->{node}, %allerrornodes);
|
||||
} elsif ($subcommand eq "gateway") {
|
||||
xCAT::SvrUtils::sendmsg(sprintf("$format %d.%d.%d.%d" . $bmcifo,
|
||||
"BMC Gateway:",
|
||||
$returnd[2],
|
||||
$returnd[3],
|
||||
$returnd[4],
|
||||
$returnd[5]), $callback, $sessdata->{node}, %allerrornodes);
|
||||
} elsif ($subcommand eq "backupgateway") {
|
||||
xCAT::SvrUtils::sendmsg(sprintf("$format %d.%d.%d.%d" . $bmcifo,
|
||||
"BMC Backup Gateway:",
|
||||
$returnd[2],
|
||||
$returnd[3],
|
||||
$returnd[4],
|
||||
$returnd[5]), $callback, $sessdata->{node}, %allerrornodes);
|
||||
} elsif ($subcommand =~ /^(ip|netmask|gateway|backupgateway)$/) {
|
||||
my %labels = (ip => "BMC IP:", netmask => "BMC Netmask:", gateway => "BMC Gateway:", backupgateway => "BMC Backup Gateway:");
|
||||
my $current = sprintf("%d.%d.%d.%d", $returnd[2], $returnd[3], $returnd[4], $returnd[5]);
|
||||
my $requested = delete $sessdata->{setnetinfo_value};
|
||||
if (defined($requested) and $requested ne $current) {
|
||||
xCAT::SvrUtils::sendmsg(sprintf("$format %s (requested %s, not yet reflected)" . $bmcifo,
|
||||
$labels{$subcommand}, $current, $requested), $callback, $sessdata->{node}, %allerrornodes);
|
||||
} else {
|
||||
xCAT::SvrUtils::sendmsg(sprintf("$format %s" . $bmcifo,
|
||||
$labels{$subcommand}, $current), $callback, $sessdata->{node}, %allerrornodes);
|
||||
}
|
||||
} elsif ($subcommand eq "community") {
|
||||
my $text = sprintf("$format ", "SP SNMP Community:");
|
||||
my $l = 2;
|
||||
|
||||
Reference in New Issue
Block a user