From 4f8647e3cf8b3eaf145d311fbef8b8c58cf7db5a Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Tue, 24 Feb 2015 15:01:15 +0100 Subject: [PATCH] marsadm: fix silly join-cluster with itself --- userspace/marsadm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/userspace/marsadm b/userspace/marsadm index 0b83cdcf..861d472d 100755 --- a/userspace/marsadm +++ b/userspace/marsadm @@ -1366,6 +1366,9 @@ sub create_cluster { sub join_cluster { my ($cmd, $peer) = @_; + ldie "Cannot join myself (peer='$peer', host='$host')\n" if $peer eq $host; + ldie "Directory $mars is missing\n" unless -d $mars; + ldie "A valid tree signature '$mars/tree-$host' already exists, thus it appears you are already a cluster member!\n" if -l "$mars/tree-$host" && !$force; if (glob("$mars/resource-*") or glob("$mars/ips/*")) { ldie "Sorry, some resources already exist!\nThis is dangerous!\nIf you are sure that no resource clash is possible, re-invoke this command with '--force' option\n" unless $force; } @@ -1373,7 +1376,6 @@ sub join_cluster { lprint "joining cluster via rsync (peer='$peer')\n"; # check connection system("ssh $peer uname -a") == 0 or ldie "oops, no connection to $peer ...\n"; - mkdir($mars) unless -d $mars; unless ($dry_run) { system("rsync --recursive --links --max-size=1 -v $peer:$mars/ $mars/") == 0 or ldie "cannot get remote symlink tree via rsync\n"; }