[pve-devel] [PATCH cluster 1/8] pvecm add: fix check if corosync alread runs

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Feb 22 16:59:04 CET 2017


`corosync-quorumtool` exit with 1 (CS_OK) if corosync runs and is
quorate.
Use `corosync-quorumtool -l` (list nodes) instead, this returns
1 if corosync does not run
0 if corosync runs, independent if a cluster is quorate or not.

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

corosync and its exit codes are a little strange

 data/PVE/CLI/pvecm.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/data/PVE/CLI/pvecm.pm b/data/PVE/CLI/pvecm.pm
index a704201..c95e8c6 100755
--- a/data/PVE/CLI/pvecm.pm
+++ b/data/PVE/CLI/pvecm.pm
@@ -509,7 +509,7 @@ __PACKAGE__->register_method ({
 		die "this host already contains virtual machines - please remove them first\n";
 	    }
 
-	    if (system("corosync-quorumtool >/dev/null 2>&1") == 0) {
+	    if (system("corosync-quorumtool -l >/dev/null 2>&1") == 0) {
 		die "corosync is already running\n";
 	    }
 	}
-- 
2.1.4





More information about the pve-devel mailing list