mirror of https://github.com/schoebel/mars
marsadm: fix fake_versionlink()
Always fake two versionslinks instead of one.
This commit is contained in:
parent
e5a558aefe
commit
59cce71e2d
|
@ -843,7 +843,8 @@ sub _get_ip {
|
|||
|
||||
sub _fake_versionlink {
|
||||
my ($basedir, $log_nr, $primary) = @_;
|
||||
for (my $rounds = 2; $rounds > 0; $rounds--) {
|
||||
my $make_count = 0;
|
||||
for (my $rounds = 2; $rounds > 0 && $log_nr > 0; $rounds--) {
|
||||
my $new_version = sprintf("$basedir/version-%09d-$host", $log_nr);
|
||||
my $pri_version = sprintf("$basedir/version-%09d-$primary", $log_nr);
|
||||
if ($primary eq $host) {
|
||||
|
@ -851,14 +852,15 @@ sub _fake_versionlink {
|
|||
}
|
||||
my $pri_link = get_link($pri_version, 1);
|
||||
if (!$pri_link) {
|
||||
lwarn "cannot read symlink '$pri_version' -- cannot create faked versionlink '$pri_version'\n";
|
||||
$log_nr++;
|
||||
next;
|
||||
}
|
||||
lprint "creating new version symlink '$new_version' -> '$pri_link'\n";
|
||||
set_link($pri_link, $new_version);
|
||||
last;
|
||||
$make_count++;
|
||||
$log_nr--;
|
||||
}
|
||||
lwarn "cannot create faked versionlink\n" if !$make_count;
|
||||
}
|
||||
|
||||
sub _set_replaylink {
|
||||
|
|
Loading…
Reference in New Issue