Skip to content

Commit

Permalink
Switch to tty1 multi-times in ro snapshot
Browse files Browse the repository at this point in the history
This may fix some sporadic failures during booting
read-only snapshot at snapper rollback stage.

See: https://progress.opensuse.org/issues/40154
  • Loading branch information
mitiao committed Aug 23, 2018
1 parent 1fb8d23 commit a0b98ab
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 20 deletions.
23 changes: 23 additions & 0 deletions lib/migration.pm
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ our @EXPORT = qw(
record_disk_info
check_rollback_system
reset_consoles_tty
boot_into_ro_snapshot
);

sub setup_sle {
Expand Down Expand Up @@ -157,4 +158,26 @@ sub reset_consoles_tty {
reset_consoles;
}

# Assert read-only snapshot before migrated
# Assert screen 'linux-login' with 200s
# Workaround known issue: bsc#980337
# In this case try to select tty1 with multi-times then select root console
sub boot_into_ro_snapshot {
if (!check_screen('linux-login', 200)) {
record_soft_failure 'bsc#980337';
my $retries = 10;
for my $i (0 .. $retries) {
send_key "ctrl-alt-f1";
if (check_screen('tty1-selected', 5)) {
last;
}
else {
record_info('not in tty1', 'switch to tty1 failed', result => 'softfail');
}
die "Boot into read-only snapshot failed over 5 minutes, considering a product issue" if $i == $retries;
sleep 10;
}
}
}

1;
11 changes: 2 additions & 9 deletions tests/boot/snapper_rollback.pm
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,12 @@ use base "consoletest";
use testapi;
use utils;
use strict;
use migration 'check_rollback_system';
use migration qw(check_rollback_system boot_into_ro_snapshot);

sub run {
my ($self) = @_;

# assert the we are on a ro snapshot.
# assert_screen 'linux-login', 200;
# workaround known issue: bsc#980337
if (!check_screen('linux-login', 200)) {
record_soft_failure 'bsc#980337';
send_key "ctrl-alt-f1";
assert_screen 'tty1-selected';
}
boot_into_ro_snapshot;
select_console 'root-console';
# 1)
script_run('touch NOWRITE;test ! -f NOWRITE', 0);
Expand Down
13 changes: 2 additions & 11 deletions tests/migration/sle12_online_migration/snapper_rollback.pm
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,12 @@ use strict;
use testapi;
use power_action_utils 'power_action';
use version_utils 'is_desktop_installed';
use migration 'check_rollback_system';
use migration qw(check_rollback_system boot_into_ro_snapshot);

sub run {
my ($self) = @_;

# login to before online migration snapshot
# tty would not appear quite often after booting snapshot
# it is a known bug bsc#980337
# in this case select tty1 first then select root console
if (!check_screen('linux-login', 200)) {
record_soft_failure 'bsc#980337';
send_key "ctrl-alt-f1";
assert_screen 'tty1-selected';
}

boot_into_ro_snapshot;
select_console 'root-console';
script_run "snapper rollback";

Expand Down

0 comments on commit a0b98ab

Please sign in to comment.