From c6fc05a3be2d3cabbbc03fe96a35b70fbeaf43a0 Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Wed, 29 Apr 2015 08:34:08 +0200 Subject: [PATCH] marsadm: allow --force --host= cleanup on non-joined host --- docu/mars-manual.lyx | 52 ++++++++++++++++++++++++++++++++++++++++++-- userspace/marsadm | 8 ++++--- 2 files changed, 55 insertions(+), 5 deletions(-) diff --git a/docu/mars-manual.lyx b/docu/mars-manual.lyx index a2004445..2290b7b6 100644 --- a/docu/mars-manual.lyx +++ b/docu/mars-manual.lyx @@ -17352,6 +17352,33 @@ marsadm delete-resource --force all . \end_layout +\begin_layout Standard +\begin_inset Graphics + filename images/MatieresCorrosives.png + lyxscale 50 + scale 17 + +\end_inset + +Beware when combining this with +\family typewriter +--host=somebody +\family default +. + In some very rare cases, like final destruction of a whole datacenter after + an earthquake, you might need a combination like +\family typewriter +marsadm --host=defective delete-resource --force all +\family default +. + Don't use such combinations if you don't need them +\emph on +really +\emph default +! You can easily shoot yourself in your head if you are not carefully operating + such commands! +\end_layout + \begin_layout Subsection Resource Creation / Deletion / Modification \begin_inset CommandInset label @@ -18177,7 +18204,16 @@ leave-resource \family typewriter --force \family default -, increasing the danger to maximum! +, increasing the danger to maximum! It is even possible to combine +\family typewriter +--force +\family default + with an invalid resource argument and an invalid +\family typewriter +--host=somebodyelse +\family default + argument in order to desperately try to destroy remains of incomplete or + pysically damaged hardware. \end_layout \begin_layout Plain Layout @@ -26855,7 +26891,19 @@ Wait until all \emph default nodes in the cluster have sent a message, or until timeout. - The default timeout is 30 s (exceptionally) and may be changed by + The default timeout is 30 s (exceptionally) and +\size default + +\begin_inset Graphics + filename images/MatieresCorrosives.png + lyxscale 50 + scale 17 + +\end_inset + +Be +\size scriptsize + may be changed by \family typewriter --timeout=$seconds \end_layout diff --git a/userspace/marsadm b/userspace/marsadm index 35c92277..3001a5c8 100755 --- a/userspace/marsadm +++ b/userspace/marsadm @@ -373,7 +373,10 @@ sub check_id { ldie "identifier '$str' is too long (only 63 chars supported according to RFC 1123)" if length($str) > 63; if (defined($must_exist) && $must_exist) { my $ip_path = "$mars/ips/ip-$str"; - ldie "host '$str' does not exist in $mars/ips/" unless get_link($ip_path, 1); + unless (get_link($ip_path, 1)) { + ldie "host '$str' does not exist in $mars/ips/\n" if !$force; + lwarn "host '$str' does not exist in $mars/ips/ - hopefully you know what you are doing via --force\n"; + } } } @@ -4893,8 +4896,7 @@ foreach my $arg (@ARGV) { $threshold = get_size($arg); next; } elsif ($arg =~ s/--host\s*=\s*([-_A-Za-z0-9]+)/$1/) { - check_id($arg); - ldie "host '$arg' does not exist in /mars/ips/ip-*\n" unless -l "/mars/ips/ip-$arg"; + check_id($arg, 1); if ($arg ne $host) { lprint "ATTENTION: acting as if I were host '$arg'\n"; lwarn "some commands require local knowledge not available here.\n";