All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Jackson <iwj@xenproject.org>
To: xen-devel@lists.xenproject.org
Cc: Ian Jackson <iwj@xenproject.org>
Subject: [OSSTEST PATCH 13/16] Prefix guest LV names with the job name
Date: Thu, 22 Oct 2020 17:45:03 +0100	[thread overview]
Message-ID: <20201022164506.1552-14-iwj@xenproject.org> (raw)
In-Reply-To: <20201022164506.1552-1-iwj@xenproject.org>

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@xenproject.org>
---
 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



  parent reply	other threads:[~2020-10-22 17:09 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-22 16:44 [OSSTEST PATCH 00/16] Bugfixes Ian Jackson
2020-10-22 16:44 ` [OSSTEST PATCH 01/16] share in jobdb: Break out $checkconstraints and move call Ian Jackson
2020-10-22 16:44 ` [OSSTEST PATCH 02/16] share in jobdb: Move out-of-flight special case higher up Ian Jackson
2020-10-22 16:44 ` [OSSTEST PATCH 03/16] PDU/IPMI: Retransmit, don't just wait Ian Jackson
2020-10-22 16:44 ` [OSSTEST PATCH 04/16] PDU/MSW: Warn that SNMP status is often not immediately updated Ian Jackson
2020-10-22 16:44 ` [OSSTEST PATCH 05/16] PDU/MSW: Break out get() Ian Jackson
2020-10-22 16:44 ` [OSSTEST PATCH 06/16] PDU/MSW: Break out action_value() Ian Jackson
2020-10-22 16:44 ` [OSSTEST PATCH 07/16] PDU/MSW: Actually implement delayed-* Ian Jackson
2020-10-22 16:44 ` [OSSTEST PATCH 08/16] PDU/MSW: Make show() return the value from get() Ian Jackson
2020-10-22 16:44 ` [OSSTEST PATCH 09/16] PDU/MSU: Retransmit on/off until PDU has changed Ian Jackson
2020-10-22 16:45 ` [OSSTEST PATCH 10/16] host reuse fixes: Fix running of steps adhoc Ian Jackson
2020-10-22 16:45 ` [OSSTEST PATCH 11/16] host reuse fixes: Fix runvar entry for adhoc tasks Ian Jackson
2020-10-22 16:45 ` [OSSTEST PATCH 12/16] Introduce guest_mk_lv_name Ian Jackson
2020-10-22 16:45 ` Ian Jackson [this message]
2020-10-22 16:45 ` [OSSTEST PATCH 14/16] reporting: Minor fix to reporting of tasks with no subtask Ian Jackson
2020-10-22 16:45 ` [OSSTEST PATCH 15/16] host reuse fixes: Do not break host-reuse if no host allocated Ian Jackson
2020-10-22 16:45 ` [OSSTEST PATCH 16/16] starvation: Do not count more than half a flight as starved Ian Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201022164506.1552-14-iwj@xenproject.org \
    --to=iwj@xenproject.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.