[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [OSSTEST PATCH 13/16] Prefix guest LV names with the job name
This means that a subsequent test which reuses the same host will not use the same LVs. This is a good idea because reusing the same LV names in a subsequent job means relying on the "ad hoc run" cleanup code. This is a bad idea because that code is rarely tested. And because, depending on the situation, the old LVs may even still be in use. For example, in a pair test, the guest's LVs will still be set up for use with nbd. It seems better to fix this by using a fresh LV rather than adding more teardown code. The "wear limit" on host reuse is what prevents the disk filling up with LVs from old guests. ts-debian-fixup needs special handling, because Debian's xen-tools' xen-create-image utility hardcodes its notion of LV name construction. We need to rename the actual LVs (perhaps overwriting old ones from a previous ad-hoc run) and also update the config. Signed-off-by: Ian Jackson <iwj@xxxxxxxxxxxxxx> --- Osstest/TestSupport.pm | 2 +- ts-debian-fixup | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm index 12aaba79..9362a865 100644 --- a/Osstest/TestSupport.pm +++ b/Osstest/TestSupport.pm @@ -2179,7 +2179,7 @@ sub guest_var_commalist ($$) { sub guest_mk_lv_name ($$) { my ($gho, $suffix) = @_; - return "$gho->{Name}".$suffix; + return $job."_$gho->{Name}".$suffix; } sub prepareguest ($$$$$$) { diff --git a/ts-debian-fixup b/ts-debian-fixup index a878fe50..810b3aba 100755 --- a/ts-debian-fixup +++ b/ts-debian-fixup @@ -37,6 +37,27 @@ sub savecfg () { $cfg= get_filecontents("$cfgstash.orig"); } +sub lvnames () { + my $lvs = target_cmd_output_root($ho, "lvdisplay --colon", 30); + foreach my $suffix (qw(disk swap)) { + my $old = "$gho->{Name}-$suffix"; + my $new = "${job}_${old}"; + my $full_old = "/dev/$gho->{Vg}/$old"; + my $full_new = "/dev/$gho->{Vg}/$new"; + $cfg =~ s{\Q$full_old\E(?![0-9a-zA-Z/_.-])}{ + logm "Replacing in domain config \`$&' with \`$full_new'"; + $full_new; + }ge; + if ($lvs =~ m{^ *\Q$full_old\E}m) { + if ($lvs =~ m{^ *\Q$full_new\E}m) { + # In case we are re-running (eg, adhoc) + target_cmd_root($ho, "lvremove -f $full_new", 30); + } + target_cmd_root($ho, "lvrename $full_old $new", 30); + } + } +} + sub ether () { # $cfg =~ s/^ [ \t]* # ( vif [ \t]* \= [ \t]* \[ [ \t]* [\'\"] @@ -207,6 +228,7 @@ sub writecfg () { } savecfg(); +lvnames(); ether(); access(); $console = target_setup_rootdev_console_inittab($ho,$gho,"$mountpoint"); -- 2.20.1
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |