mirror of
https://github.com/schoebel/mars
synced 2025-02-22 07:16:50 +00:00
marsadm: fix primary checks
This commit is contained in:
parent
20166b6c01
commit
78c7c307ea
@ -159,6 +159,9 @@ sub check_primary {
|
||||
my $lnk = "$mars/resource-$res/actual-$host/is-primary";
|
||||
my $is_primary = readlink($lnk);
|
||||
ldie "for operation '$cmd' I need to be primary\n" unless $is_primary;
|
||||
$lnk = "$mars/resource-$res/primary";
|
||||
my $primary = readlink($lnk) or ldie "cannot determine primary\n";
|
||||
ldie "for operation '$cmd', I also must be the designated primary\n" unless $primary eq $host;
|
||||
}
|
||||
|
||||
sub check_not_primary {
|
||||
@ -168,11 +171,10 @@ sub check_not_primary {
|
||||
if ($is_primary) {
|
||||
ldie "operation '$cmd' cannot be executed on primary\n";
|
||||
}
|
||||
else { # also check whether we intend to become primary
|
||||
$lnk = "$mars/resource-$res/primary";
|
||||
my $primary = readlink($lnk) or ldie "cannot determine primary\n";
|
||||
ldie "operation '$cmd' cannot be executed on designated primary\n";
|
||||
}
|
||||
# also check whether we intend to become primary
|
||||
$lnk = "$mars/resource-$res/primary";
|
||||
my $primary = readlink($lnk) or ldie "cannot determine primary\n";
|
||||
ldie "operation '$cmd' cannot be executed on designated primary\n" if $primary eq $host;
|
||||
}
|
||||
|
||||
sub check_primary_gone {
|
||||
|
Loading…
Reference in New Issue
Block a user