[pve-devel] [PATCH cluster] Add warning for pvecm commands if not part of cluster

Fabian Grünbichler f.gruenbichler at proxmox.com
Fri Mar 11 12:41:26 CET 2016


If the cluster config file is missing, pvecm status, nodes
and expected will probably not work. Add a helpful warning
because the corosync-quorumtool error message is not very
descriptive here.
---
Already saw a couple of forum posts where users were
confused when pvecm status did not work after a fresh
installation, I think this would improve the situation.
Feel free to change the actual warning message if desired.

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

diff --git a/data/PVE/CLI/pvecm.pm b/data/PVE/CLI/pvecm.pm
index 7fadb7d..a5952f7 100755
--- a/data/PVE/CLI/pvecm.pm
+++ b/data/PVE/CLI/pvecm.pm
@@ -601,6 +601,9 @@ __PACKAGE__->register_method ({
     code => sub {
 	my ($param) = @_;
 
+	warn "Corosync configuration '$clusterconf' not found - is this node part of a cluster?\n"
+	    if !-f $clusterconf;
+
 	my $cmd = ['corosync-quorumtool', '-siH'];
 
 	exec (@$cmd);
@@ -622,6 +625,9 @@ __PACKAGE__->register_method ({
     code => sub {
 	my ($param) = @_;
 
+	warn "Corosync configuration '$clusterconf' not found - is this node part of a cluster?\n"
+	    if !-f $clusterconf;
+
 	my $cmd = ['corosync-quorumtool', '-l'];
 
 	exec (@$cmd);
@@ -649,6 +655,9 @@ __PACKAGE__->register_method ({
     code => sub {
 	my ($param) = @_;
 
+	warn "Corosync configuration '$clusterconf' not found - is this node part of a cluster?\n"
+	    if !-f $clusterconf;
+
 	my $cmd = ['corosync-quorumtool', '-e', $param->{expected}];
 
 	exec (@$cmd);
-- 
2.1.4





More information about the pve-devel mailing list