public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager 1/2] pve6to7: reduce number of cluster PASS statements
Date: Thu,  1 Jul 2021 09:58:56 +0200	[thread overview]
Message-ID: <20210701075857.3871664-1-f.gruenbichler@proxmox.com> (raw)

these were mostly releveant for upgrading from Corosync 2.x to 3.x - so
keep the warnings/errors, but reduce the noise a bit by skipping lots of
PASS output.

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

Notes:
    on a 3-node cluster this reduced the amount of output from 47 statements to 40,
    total lines from 111 to 101.

 PVE/CLI/pve6to7.pm | 50 +++++++++++++++++++++++++---------------------
 1 file changed, 27 insertions(+), 23 deletions(-)

diff --git a/PVE/CLI/pve6to7.pm b/PVE/CLI/pve6to7.pm
index 1c89242d..899ef6c6 100644
--- a/PVE/CLI/pve6to7.pm
+++ b/PVE/CLI/pve6to7.pm
@@ -302,17 +302,25 @@ sub check_cluster_corosync {
 	if $conf_nodelist_count != $cfs_nodelist_count;
 
     print "\nChecking nodelist entries..\n";
+    my $nodelist_pass = 1;
     for my $cs_node (sort keys %$conf_nodelist) {
 	my $entry = $conf_nodelist->{$cs_node};
-	log_fail("$cs_node: no name entry in corosync.conf.")
-	    if !defined($entry->{name});
-	log_fail("$cs_node: no nodeid configured in corosync.conf.")
-	    if !defined($entry->{nodeid});
+	if (!defined($entry->{name})) {
+	    $nodelist_pass = 0;
+	    log_fail("$cs_node: no name entry in corosync.conf.");
+	}
+	if (!defined($entry->{nodeid})) {
+	    $nodelist_pass = 0;
+	    log_fail("$cs_node: no nodeid configured in corosync.conf.");
+	}
 	my $gotLinks = 0;
 	for my $link (0..7) {
 	    $gotLinks++ if defined($entry->{"ring${link}_addr"});
 	}
-	log_fail("$cs_node: no ringX_addr (0 <= X <= 7) link defined in corosync.conf.") if $gotLinks <= 0;
+	if ($gotLinks <= 0) {
+	    $nodelist_pass = 0;
+	    log_fail("$cs_node: no ringX_addr (0 <= X <= 7) link defined in corosync.conf.");
+	}
 
 	my $verify_ring_ip = sub {
 	    my $key = shift;
@@ -320,11 +328,11 @@ sub check_cluster_corosync {
 		my ($resolved_ip, undef) = PVE::Corosync::resolve_hostname_like_corosync($ring, $conf);
 		if (defined($resolved_ip)) {
 		    if ($resolved_ip ne $ring) {
+			$nodelist_pass = 0;
 			log_warn("$cs_node: $key '$ring' resolves to '$resolved_ip'.\n Consider replacing it with the currently resolved IP address.");
-		    } else {
-			log_pass("$cs_node: $key is configured to use IP address '$ring'");
 		    }
 		} else {
+		    $nodelist_pass = 0;
 		    log_fail("$cs_node: unable to resolve $key '$ring' to an IP address according to Corosync's resolve strategy - cluster will potentially fail with Corosync 3.x/kronosnet!");
 		}
 	    }
@@ -333,42 +341,38 @@ sub check_cluster_corosync {
 	    $verify_ring_ip->("ring${link}_addr");
 	}
     }
+    log_pass("nodelist settings OK") if $nodelist_pass;
 
     print "\nChecking totem settings..\n";
     my $totem = $conf->{main}->{totem};
+    my $totem_pass = 1;
+
     my $transport = $totem->{transport};
     if (defined($transport)) {
 	if ($transport ne 'knet') {
+	    $totem_pass = 0;
 	    log_fail("Corosync transport explicitly set to '$transport' instead of implicit default!");
-	} else {
-	    log_pass("Corosync transport set to '$transport'.");
 	}
-    } else {
-	log_pass("Corosync transport set to implicit default.");
     }
 
     # TODO: are those values still up-to-date?
     if ((!defined($totem->{secauth}) || $totem->{secauth} ne 'on') && (!defined($totem->{crypto_cipher}) || $totem->{crypto_cipher} eq 'none')) {
+	$totem_pass = 0;
 	log_fail("Corosync authentication/encryption is not explicitly enabled (secauth / crypto_cipher / crypto_hash)!");
-    } else {
-	if (defined($totem->{crypto_cipher}) && $totem->{crypto_cipher} eq '3des') {
-	    log_fail("Corosync encryption cipher set to '3des', no longer supported in Corosync 3.x!"); # FIXME: can be removed?
-	} else {
-	    log_pass("Corosync encryption and authentication enabled.");
-	}
+    } elsif (defined($totem->{crypto_cipher}) && $totem->{crypto_cipher} eq '3des') {
+	$totem_pass = 0;
+	log_fail("Corosync encryption cipher set to '3des', no longer supported in Corosync 3.x!"); # FIXME: can be removed?
     }
 
+    log_pass("totem settings OK") if $totem_pass;
     print "\n";
     log_info("run 'pvecm status' to get detailed cluster status..");
 
-    print_header("CHECKING INSTALLED COROSYNC VERSION");
     if (defined(my $corosync = $get_pkg->('corosync'))) {
 	if ($corosync->{OldVersion} =~ m/^2\./) {
-	    log_fail("corosync 2.x installed, cluster-wide upgrade to 3.x needed!");
-	} elsif ($corosync->{OldVersion} =~ m/^3\./) {
-	    log_pass("corosync 3.x installed.");
-	} else {
-	    log_fail("unexpected corosync version installed: $corosync->{OldVersion}!");
+	    log_fail("\ncorosync 2.x installed, cluster-wide upgrade to 3.x needed!");
+	} elsif ($corosync->{OldVersion} !~ m/^3\./) {
+	    log_fail("\nunexpected corosync version installed: $corosync->{OldVersion}!");
 	}
     }
 }
-- 
2.30.2





             reply	other threads:[~2021-07-01  7:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-01  7:58 Fabian Grünbichler [this message]
2021-07-01  7:58 ` [pve-devel] [PATCH manager 2/2] pve6to7: drop PASS for Luminous -> Nautilus check Fabian Grünbichler
2021-07-02  9:49 ` [pve-devel] applied-series: [PATCH manager 1/2] pve6to7: reduce number of cluster PASS statements Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210701075857.3871664-1-f.gruenbichler@proxmox.com \
    --to=f.gruenbichler@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal