New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce LVM thin volume test #5520
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# SUSE's openQA tests | ||
# | ||
# Copyright © 2009-2013 Bernhard M. Wiedemann | ||
# Copyright © 2012-2018 SUSE LLC | ||
# | ||
# Copying and distribution of this file, with or without modification, | ||
# are permitted in any medium without royalty provided the copyright | ||
# notice and this notice are preserved. This file is offered as-is, | ||
# without any warranty. | ||
|
||
# Summary: Simple LVM thin provisioning check | ||
# Maintainer: Martin Loviska <mloviska@suse.com> | ||
|
||
use strict; | ||
use warnings; | ||
use base "opensusebasetest"; | ||
use testapi; | ||
use utils; | ||
use y2logsstep; | ||
use serial_terminal 'select_virtio_console'; | ||
|
||
sub run { | ||
my $lv_stats = { | ||
write_access => qr/\s{2}LV Write Access \s+ read\/write/, | ||
status => qr/\s{2}LV Status \s+ available/, | ||
readahead => qr/\s{2}Read ahead sectors \s+ auto/, | ||
# 254 as major no. points to dev-mapper, see /proc/devices | ||
block_device => qr/\s{2}Block device \s+ 254:\d/ | ||
}; | ||
|
||
select_virtio_console(); | ||
record_info('INFO', 'Print lvm setup'); | ||
assert_script_run 'lsblk'; | ||
assert_script_run 'lvmdiskscan'; | ||
assert_script_run 'lvscan'; | ||
assert_script_run 'lvs -a | tee original_usage'; | ||
assert_script_run 'pvs -a'; | ||
# thin volume does not exceed thin pool size in our tests | ||
my @volumes = split(/\n/, script_output q[lvscan | awk '{print $2}'| sed s/\'//g]); | ||
# check for read only volumes and | ||
foreach my $volume (@volumes) { | ||
chomp; | ||
my $lvdisp_out = script_output "lvdisplay $volume"; | ||
foreach (keys %{$lv_stats}) { | ||
die "Value of $lv_stats->{$_} was not found in $volume configuration" unless ($lvdisp_out =~ /(?<tested_string>$lv_stats->{$_})/); | ||
record_info('TEST', "Found $+{tested_string} in $volume"); | ||
} | ||
} | ||
|
||
record_info('INFO', 'Create a file on thin volume'); | ||
my $test_file = '/home/bernhard/test_file.txt'; | ||
assert_script_run "dd if=/dev/zero of=$test_file count=1024 bs=1M"; | ||
assert_script_run "ls -lah $test_file"; | ||
assert_script_run 'lvs -a | tee instant_usage'; | ||
if ((script_run 'diff original_usage instant_usage') != 1) { | ||
die "LVM usage stats do not differ!"; | ||
} | ||
} | ||
|
||
sub post_fail_hook { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess standard set of logs could be helpful here too, so what's about calling There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added |
||
my $self = shift; | ||
select_console 'root-console'; | ||
my $lvmdump_regex = qr{/root/lvmdump-.*?-\d+\.tgz}; | ||
my $out = script_output 'lvmdump'; | ||
if ($out =~ /(?<lvmdump_gzip>$lvmdump_regex)/) { | ||
upload_logs "$+{lvmdump_gzip}"; | ||
} | ||
$self->save_and_upload_log('lvm dumpconfig', '/tmp/lvm_dumpconf.out'); | ||
$self->SUPER::post_fail_hook; | ||
} | ||
|
||
1; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# SUSE's openQA tests | ||
# | ||
# Copyright © 2009-2013 Bernhard M. Wiedemann | ||
# Copyright © 2012-2018 SUSE LLC | ||
# | ||
# Copying and distribution of this file, with or without modification, | ||
# are permitted in any medium without royalty provided the copyright | ||
# notice and this notice are preserved. This file is offered as-is, | ||
# without any warranty. | ||
|
||
# Summary: LVM thin provisioning setup | ||
# Maintainer: Martin Loviska <mloviska@suse.com> | ||
|
||
use strict; | ||
use warnings; | ||
use base 'y2logsstep'; | ||
use testapi; | ||
use partition_setup qw(create_new_partition_table addpart addlv addvg); | ||
use version_utils 'is_storage_ng'; | ||
|
||
sub run { | ||
create_new_partition_table; | ||
# create boot and 2 lvm partitions | ||
addpart(role => 'raw', fsid => 'bios-boot', size => 2); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you please update ticket for SLE to adjust this line for other architectures? We need prep boot on ppc64, boot/zipl for s390x and efi for UEFI (aarch64). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
addpart(role => 'raw', size => 10000); | ||
addpart(role => 'raw'); | ||
# create volume group for root and swap non thin lvs | ||
addvg(name => 'vg-no-thin'); | ||
addlv(name => 'lv-swap', role => 'swap', size => 2000); | ||
addlv(name => 'lv-root', role => 'OS'); | ||
# create volume group for thin lv | ||
addvg(name => 'vg-thin'); | ||
addlv(name => 'thin_pool', thinpool => 1); | ||
addlv(name => 'thin_lv_home', role => 'data', thinvolume => 1); | ||
send_key $cmd{accept}; | ||
|
||
} | ||
|
||
1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So now in case it's not thin pool or thin volume we additionally press
alt-o
. Can it have any impact on existing tests?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should not http://dhcp128.suse.cz/tests/5120#step/partitioning_lvm_thin_provisioning/47