[pve-devel] [PATCH manager 1/6] 5to6: attempt to resolve corosync rings

Fabian Grünbichler f.gruenbichler at proxmox.com
Fri Jul 5 14:44:05 CEST 2019


and only fail if unable to

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---

Notes:
    we could also _info instead of _warn for resolvable hostnames?
    
    backporting note:
    
    requires pve-cluster with
    
    5c82c8c84c178fd54d1a610d8f4c718a28f4df14 Add functions to resolve hostnames and iterate corosync nodes
    
    and optionally
    
    53d5168dff4b6a174f4dc48b7403171ac163844a corosync: stylistic changes
    3e067ee35cea12f93d4a4fb48a2ed7376b838fa9 corosync: refactor and reuse IP RE matching
    
    cherry-picked.
    
    I am not sure whether we want to adapt the default strategy for stable-5 -
    Corosync 2.x used ipv4, Corosynx 3.x uses ipv6-4. for the checklist it would
    make more sense to check the latter (we want to make sure it continues to work
    after the upgrade after all), for general purpose usage in PVE 5.x it of course
    does not make sense to use a strategy that Corosync 2.x does not even have..
    
    alternatively, we could also inline the resolve sub into the checklist script
    for stable-5, with ipv6-4 as strategy. that would also allow us to skip a
    forced cluster bump in stable-5 just to improve the checklist script..

 PVE/CLI/pve5to6.pm | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/PVE/CLI/pve5to6.pm b/PVE/CLI/pve5to6.pm
index b0bd531b..79205aa1 100644
--- a/PVE/CLI/pve5to6.pm
+++ b/PVE/CLI/pve5to6.pm
@@ -370,8 +370,17 @@ sub check_cluster_corosync {
 	my $verify_ring_ip = sub {
 	    my $key = shift;
 	    my $ring = $entry->{$key};
-	    if (defined($ring) && !PVE::JSONSchema::pve_verify_ip($ring, 1)) {
-		log_fail("$key '$ring' of node '$cs_node' is not an IP address, consider replacing it with the currently resolved IP address.");
+	    if (defined($ring)) {
+		my ($resolved_ip, undef) = PVE::Corosync::resolve_hostname_like_corosync($ring, $conf);
+		if (defined($resolved_ip)) {
+		    if ($resolved_ip ne $ring) {
+			log_warn("$key '$ring' of node '$cs_node' resolves to '$resolved_ip'.\n Consider replacing it with the currently resolved IP address.");
+		    } else {
+			log_pass("$key is configured to use IP address '$ring'");
+		    }
+		} else {
+		    log_fail("unable to resolve $key '$ring' of node '$cs_node' to an IP address according to Corosync's resolve strategy - cluster will fail with Corosync 3.x/kronosnet!");
+		}
 	    }
 	};
 	$verify_ring_ip->('ring0_addr');
-- 
2.20.1





More information about the pve-devel mailing list