test-data/phony-guests: Add Fedora LUKS phony image for testing.

This is not added to guests-all-good since it cannot be used in
automated tests -- a password must be supplied.
This commit is contained in:
Richard W.M. Jones
2018-07-18 13:11:43 +01:00
parent 83fb657bec
commit 16e64b8988
4 changed files with 57 additions and 2 deletions

View File

@@ -51,6 +51,7 @@ disk_images = \
fedora-md1.img \
fedora-md2.img \
fedora-btrfs.img \
fedora-luks.img \
ubuntu.img \
archlinux.img \
coreos.img \
@@ -100,6 +101,13 @@ fedora-btrfs.img: make-fedora-img.pl \
fedora-packages.db
SRCDIR=$(srcdir) LAYOUT=btrfs $(top_builddir)/run --test ./$<
# Make a (dummy) Fedora image with LVM encrypted with LUKS.
fedora-luks.img: make-fedora-img.pl \
fedora-journal.tar.xz \
fedora-name.db \
fedora-packages.db
SRCDIR=$(srcdir) LAYOUT=lvm-luks $(top_builddir)/run --test ./$<
# Make a (dummy) Debian image.
debian.img: make-debian-img.sh
SRCDIR=$(srcdir) $(top_builddir)/run --test ./$<

View File

@@ -151,6 +151,22 @@
</devices>
</domain>
<domain type='test'>
<name>fedora</name>
<memory>1048576</memory>
<os>
<type>hvm</type>
<boot dev='hd'/>
</os>
<devices>
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='@abs_builddir@/fedora.img'/>
<target dev='vda' bus='virtio'/>
</disk>
</devices>
</domain>
<domain type='test'>
<name>fedora-btrfs</name>
<memory>1048576</memory>
@@ -167,8 +183,9 @@
</devices>
</domain>
<!-- LUKS password is 'FEDORA' -->
<domain type='test'>
<name>fedora</name>
<name>fedora-luks</name>
<memory>1048576</memory>
<os>
<type>hvm</type>
@@ -177,7 +194,7 @@
<devices>
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='@abs_builddir@/fedora.img'/>
<source file='@abs_builddir@/fedora-luks.img'/>
<target dev='vda' bus='virtio'/>
</disk>
</devices>

View File

@@ -153,6 +153,35 @@ EOF
$g->mount ('btrfsvol:/dev/sda2/root', '/');
}
elsif ($ENV{LAYOUT} eq 'lvm-luks') {
push (@images, "fedora-luks.img-t");
open (my $fstab, '>', "fedora.fstab") or die;
print $fstab <<EOF;
LABEL=BOOT /boot ext2 default 0 0
LABEL=ROOT / ext2 default 0 0
EOF
close ($fstab) or die;
$bootdev = '/dev/sda1';
$g->disk_create ("fedora-luks.img-t", "raw", $IMAGE_SIZE);
$g->add_drive ("fedora-luks.img-t", format => "raw");
$g->launch ();
$g->part_init ('/dev/sda', 'mbr');
foreach my $p (@PARTITIONS) {
$g->part_add('/dev/sda', @$p);
}
# Put LUKS on the second partition.
$g->luks_format ('/dev/sda2', 'FEDORA', 0);
$g->luks_open ('/dev/sda2', 'FEDORA', 'luks');
init_lvm_root ('/dev/mapper/luks');
}
else {
print STDERR "$0: Unknown LAYOUT: ",$ENV{LAYOUT},"\n";
exit 1;