diff --git a/userspace/marsadm b/userspace/marsadm index c3f1b895..ad15f6e6 100755 --- a/userspace/marsadm +++ b/userspace/marsadm @@ -251,11 +251,15 @@ sub mars_time { sub sleep_timeout { my $sleeptime = shift || 5; + my $continue = shift; if ($timeout < 0) { sleep($sleeptime); return; } - ldie "Timeout reached. You may retry with --timeout=-1 to ensure waiting until progress is possible.\n" if !$timeout; + if ($timeout <= 0) { + ldie "Timeout reached. You may retry with --timeout=-1 to ensure waiting until progress is possible.\n" if (!defined($continue) || !$continue); + lwarn "Timeout reached. Continuing anyway.\n" + } my $rest = $timeout; $rest = $sleeptime if $rest > $sleeptime; sleep($rest); @@ -1384,8 +1388,15 @@ sub leave_cluster { my ($cmd) = @_; my $check = "/mars/resource-*/data-$host"; ldie "I am member of some resources\n" if glob($check) && !$force; + wait_cluster($cmd); + _create_delete("$mars/todo-global/deleted-$host"); _create_delete("$mars/ips/ip-$host"); finish_links(); + wait_cluster($cmd); + while (-f "$mars/ips/ip-$host" && $timeout >= 0) { + sleep_timeout(3, 1); + } + system("rmmod mars"); } sub create_res {