From 556e91238d47c707533f2fbafb98fdcd55c929a9 Mon Sep 17 00:00:00 2001 From: digimer Date: Mon, 24 Jul 2023 15:43:54 -0400 Subject: [PATCH] * Updated Network->find_access() to clear the data from previous scans, which fixes a bug where checking multiple hosts could return stale data for the previous host. * Updated anvil-manage-server-storage, striker-collect-debug, and striker-update-cluster to be able to find a connection on an interface when none were found on preferred networks. Signed-off-by: digimer --- Anvil/Tools/Network.pm | 5 +++++ tools/anvil-manage-server-storage | 7 +++++-- tools/striker-collect-debug | 8 +++++++- tools/striker-update-cluster | 20 +++++++++++++------- 4 files changed, 30 insertions(+), 10 deletions(-) diff --git a/Anvil/Tools/Network.pm b/Anvil/Tools/Network.pm index b5534734..dbe48f19 100644 --- a/Anvil/Tools/Network.pm +++ b/Anvil/Tools/Network.pm @@ -1245,6 +1245,11 @@ sub find_access return("!!error!!"); } + if (exists $anvil->data->{network_access}) + { + delete $anvil->data->{network_access}; + } + my $host_uuid = $anvil->Get->host_uuid; my $short_host_name = $anvil->Get->short_host_name; my $target_short_host_name = $anvil->data->{hosts}{host_uuid}{$target_host_uuid}{short_host_name}; diff --git a/tools/anvil-manage-server-storage b/tools/anvil-manage-server-storage index 64202a62..35ee3ba0 100755 --- a/tools/anvil-manage-server-storage +++ b/tools/anvil-manage-server-storage @@ -2242,13 +2242,16 @@ sub check_drbd_peer_access target => $this_host, }); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { matches => $matches }}); - foreach my $preferred_network ("bcn", "mn", "ifn", "sn") + foreach my $preferred_network ("bcn", "mn", "ifn", "sn", "any") { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { preferred_network => $preferred_network }}); foreach my $network_name (sort {$a cmp $b} keys %{$anvil->data->{network_access}}) { next if $access; - next if $network_name !~ /^$preferred_network/; + if (($network_name !~ /^$preferred_network/) && ($preferred_network ne "any")) + { + next; + } my $target_ip = $anvil->data->{network_access}{$network_name}{target_ip_address}; my $test_access = $anvil->Remote->test_access({target => $target_ip}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { diff --git a/tools/striker-collect-debug b/tools/striker-collect-debug index bb33ea50..e5ac11b8 100755 --- a/tools/striker-collect-debug +++ b/tools/striker-collect-debug @@ -296,11 +296,17 @@ sub collect_remote_data $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { matches => $matches }}); $anvil->data->{peer}{$short_host_name}{access}{ip} = ""; $anvil->data->{peer}{$short_host_name}{access}{network} = ""; - foreach my $preferred_network ("bcn", "mn", "ifn", "sn") + foreach my $preferred_network ("bcn", "mn", "ifn", "sn", "any") { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { preferred_network => $preferred_network }}); foreach my $network_name (sort {$a cmp $b} keys %{$anvil->data->{network_access}}) { + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { network_name => $network_name }}); + if (($network_name !~ /^$preferred_network/) && ($preferred_network ne "any")) + { + next; + } + next if $network_name !~ /^$preferred_network/; my $target_ip = $anvil->data->{network_access}{$network_name}{target_ip_address}; my $test_access = $anvil->Remote->test_access({target => $target_ip}); diff --git a/tools/striker-update-cluster b/tools/striker-update-cluster index f66dfa2f..47c74165 100755 --- a/tools/striker-update-cluster +++ b/tools/striker-update-cluster @@ -238,18 +238,21 @@ sub update_nodes $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { matches => $matches }}); $anvil->data->{peer}{$short_host_name}{access}{ip} = ""; $anvil->data->{peer}{$short_host_name}{access}{network} = ""; - foreach my $preferred_network ("bcn", "mn", "ifn", "sn") + foreach my $preferred_network ("bcn", "mn", "ifn", "sn", "any") { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { preferred_network => $preferred_network }}); foreach my $network_name (sort {$a cmp $b} keys %{$anvil->data->{network_access}}) { - next if $network_name !~ /^$preferred_network/; + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { network_name => $network_name }}); + if (($network_name !~ /^$preferred_network/) && ($preferred_network ne "any")) + { + next; + } my $target_ip = $anvil->data->{network_access}{$network_name}{target_ip_address}; my $test_access = $anvil->Remote->test_access({target => $target_ip}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { - 's1:network_name' => $network_name, - 's2:target_ip' => $target_ip, - 's3:test_access' => $test_access, + 's1:target_ip' => $target_ip, + 's2:test_access' => $test_access, }}); if ($test_access) @@ -1348,14 +1351,17 @@ sub verify_access $anvil->data->{peer}{$short_host_name}{access}{ip} = ""; $anvil->data->{peer}{$short_host_name}{access}{network} = ""; - foreach my $preferred_network ("bcn", "mn", "ifn", "sn") + foreach my $preferred_network ("bcn", "mn", "ifn", "sn", "any") { next if $anvil->data->{peer}{$short_host_name}{access}{ip}; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { preferred_network => $preferred_network }}); foreach my $network_name (sort {$a cmp $b} keys %{$anvil->data->{network_access}}) { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { network_name => $network_name }}); - next if $network_name !~ /^$preferred_network/; + if (($network_name !~ /^$preferred_network/) && ($preferred_network ne "any")) + { + next; + } my $target_ip = $anvil->data->{network_access}{$network_name}{target_ip_address}; my $test_access = $anvil->Remote->test_access({