-
Notifications
You must be signed in to change notification settings - Fork 283
/
Copy pathrear.pm
72 lines (52 loc) · 1.52 KB
/
rear.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# SUSE's openQA tests
#
# Copyright 2021 SUSE LLC
# SPDX-License-Identifier: FSFAP
#
# Summary: Functions for ReaR tests
package rear;
use base "opensusebasetest";
use strict;
use warnings;
use testapi;
use Utils::Logging 'save_and_upload_log';
our @EXPORT = qw(
upload_rear_logs
);
=head1 SYNOPSIS
Package with common methods and default values for testing ReaR on HA
module.
This package inherits from B<opensusebasetest> and should be used as
a class.
=cut
=head2 upload_rear_logs
$self->upload_rear_logs();
Upload needed logs for debugging purposes.
=cut
sub upload_rear_logs {
my ($self) = @_;
# Upload config file
upload_logs('/etc/rear/local.conf', failok => 1);
# List of block devices
save_and_upload_log('lsblk -ipo NAME,KNAME,PKNAME,TRAN,TYPE,FSTYPE,SIZE,MOUNTPOINT', '/tmp/lsblk.log');
# Create tarball with logfiles and upload it
my $logfile = '/tmp/rear-recover-logs.tar.bz2';
script_run("tar cjf $logfile /var/log/rear/rear-*.log /var/lib/rear/layout/* /var/lib/rear/recovery/*");
upload_logs("$logfile", failok => 1);
}
sub post_fail_hook {
my ($self) = @_;
return if get_var('NOLOGS');
# We need to be sure that *ALL* consoles are closed, are SUPER:post_fail_hook
# does not support virtio/serial console yet
reset_consoles;
select_console('root-console');
# Upload the logs
$self->upload_rear_logs;
# Execute the common part
$self->SUPER::post_fail_hook unless check_var('LIVETEST', 1);
}
sub test_flags {
return {fatal => 1};
}
1;