[pve-devel] applied: [PATCH cluster] fix #1380: pvecm status: add general cluster information

Thomas Lamprecht t.lamprecht at proxmox.com
Fri Oct 4 09:29:31 CEST 2019


Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---

there is other information which can make sense, so follow-ups welcome.
We could also call into "corosync-cmapctl totem" or add this upstream
to get the current runtime information, which may be a bit better suited
here..

 data/PVE/CLI/pvecm.pm | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/data/PVE/CLI/pvecm.pm b/data/PVE/CLI/pvecm.pm
index 823130a..2c4c8f6 100755
--- a/data/PVE/CLI/pvecm.pm
+++ b/data/PVE/CLI/pvecm.pm
@@ -457,6 +457,25 @@ __PACKAGE__->register_method ({
 	my ($param) = @_;
 
 	PVE::Corosync::check_conf_exists();
+	my $conf = eval { PVE::Cluster::cfs_read_file("corosync.conf") } // {};
+	warn "$@" if $@;
+	my $totem = PVE::Corosync::totem_config($conf);
+
+	if (scalar(%$totem)) {
+	    my $print_info = sub {
+		my ($label, $key, $default) = @_;
+		my $val = $totem->{$key} // $default;
+		printf "%-17s %s\n", "$label:", "$val";
+	    };
+
+	    printf "Cluster information\n";
+	    printf "-------------------\n";
+	    $print_info->('Name', 'cluster_name', 'UNKOWN?');
+	    $print_info->('Config Version', 'config_version', -1);
+	    $print_info->('Transport', 'transport', 'knet');
+	    $print_info->('Secure auth', 'secauth', 'off');
+	    printf "\n";
+	}
 
 	my $cmd = ['corosync-quorumtool', '-siH'];
 
-- 
2.20.1





More information about the pve-devel mailing list