sub guest_mk_lv_name ($$) {
my ($gho, $suffix) = @_;
- return "$gho->{Name}".$suffix;
+ return $job."_$gho->{Name}".$suffix;
}
sub prepareguest ($$$$$$) {
$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]* [\'\"]
}
savecfg();
+lvnames();
ether();
access();
$console = target_setup_rootdev_console_inittab($ho,$gho,"$mountpoint");