mirror of
https://github.com/schoebel/mars
synced 2025-01-30 03:42:48 +00:00
marsadm: fix leave-cluster
This commit is contained in:
parent
1012865854
commit
f2fdd87d67
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user