From 1bea94dcbc1bea724f04d4ac9e680385683aa8b7 Mon Sep 17 00:00:00 2001 From: Jeremi Piotrowski Date: Fri, 29 Sep 2023 16:39:54 +0200 Subject: [PATCH 1/2] kola: Add test case for extra partition creation This is a testcase for a regression that passes until Flatcar 3374 and fails on Flatcar 3510 (only checked stable releases). Signed-off-by: Jeremi Piotrowski --- kola/tests/ignition/filesystem.go | 48 +++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/kola/tests/ignition/filesystem.go b/kola/tests/ignition/filesystem.go index 1892df9ef..90fcdcfee 100644 --- a/kola/tests/ignition/filesystem.go +++ b/kola/tests/ignition/filesystem.go @@ -21,6 +21,7 @@ import ( "github.com/coreos/go-semver/semver" "github.com/flatcar/mantle/kola/cluster" "github.com/flatcar/mantle/kola/register" + "github.com/flatcar/mantle/kola/tests/util" "github.com/flatcar/mantle/platform/conf" ) @@ -322,6 +323,14 @@ systemd: Platforms: []string{"qemu", "qemu-unpriv"}, MinVersion: semver.Version{Major: 3033}, }) + + register.Register(®ister.Test{ + Name: "cl.ignition.partition_on_boot_disk", + Run: testPartitionOnBootDisk, + ClusterSize: 0, + Distros: []string{"cl"}, + Platforms: []string{"qemu", "qemu-unpriv"}, + }) } var ext4NoClobberV2_1 = conf.Ignition(`{ @@ -437,3 +446,42 @@ func testSwapActivation(c cluster.TestCluster) { c.Fatalf("swap's size should be: %s, got %s", swapSize, size) } } + +var rootDiskExtraPartition = conf.ContainerLinuxConfig(` +storage: + disks: + - device: /dev/disk/by-id/virtio-primary-disk + partitions: + - label: VAR + number: 10 + start: '9GiB' + filesystems: + - name: var + mount: + device: /dev/disk/by-partlabel/VAR + format: xfs + label: var + files: + - filesystem: root + path: /etc/fstab + mode: 0644 + contents: + inline: | + /dev/disk/by-label/var /var xfs defaults 0 0 +`) + +func testPartitionOnBootDisk(c cluster.TestCluster) { + m, err := util.NewMachineWithLargeDisk(c, "10G", rootDiskExtraPartition) + if err != nil { + c.Fatal(err) + } + out := c.MustSSH(m, "lsblk -f") + c.Logf("lsblk -f:\n%s", out) + out = c.MustSSH(m, "findmnt") + c.Logf("findmnt:\n%s", out) + + c.MustSSH(m, "mountpoint /var") + c.MustSSH(m, "ls -la /dev/disk/by-partlabel/VAR") + c.MustSSH(m, "ls -la /dev/disk/by-label/var") + c.AssertCmdOutputContains(m, "findmnt /var", "xfs") +} From 054a51c7b3d4405221b865b79183749dce896266 Mon Sep 17 00:00:00 2001 From: Jeremi Piotrowski Date: Thu, 23 Nov 2023 11:49:44 +0100 Subject: [PATCH 2/2] kola: tests: partition_on_boot_disk: Tweak fs labels and create file Switch filesystem label to VAR to follow the same convention as other core filesystems (ROOT/EFI/OEM). The testcase has also been extended to make sure creating files in /var works. Signed-off-by: Jeremi Piotrowski --- kola/tests/ignition/filesystem.go | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/kola/tests/ignition/filesystem.go b/kola/tests/ignition/filesystem.go index 90fcdcfee..9202a3b85 100644 --- a/kola/tests/ignition/filesystem.go +++ b/kola/tests/ignition/filesystem.go @@ -325,6 +325,9 @@ systemd: }) register.Register(®ister.Test{ + // Note: As long as the initrd does not mount /var for early + // preparations, the resulting system has a few issues, so this setup is + // not fully supported yet Name: "cl.ignition.partition_on_boot_disk", Run: testPartitionOnBootDisk, ClusterSize: 0, @@ -456,18 +459,23 @@ storage: number: 10 start: '9GiB' filesystems: - - name: var + - name: VAR mount: device: /dev/disk/by-partlabel/VAR format: xfs - label: var + label: VAR files: + - filesystem: VAR + path: /hello + mode: 0644 + contents: + inline: world - filesystem: root path: /etc/fstab mode: 0644 contents: inline: | - /dev/disk/by-label/var /var xfs defaults 0 0 + /dev/disk/by-label/VAR /var xfs defaults 0 0 `) func testPartitionOnBootDisk(c cluster.TestCluster) { @@ -482,6 +490,7 @@ func testPartitionOnBootDisk(c cluster.TestCluster) { c.MustSSH(m, "mountpoint /var") c.MustSSH(m, "ls -la /dev/disk/by-partlabel/VAR") - c.MustSSH(m, "ls -la /dev/disk/by-label/var") + c.MustSSH(m, "ls -la /dev/disk/by-label/VAR") c.AssertCmdOutputContains(m, "findmnt /var", "xfs") + c.AssertCmdOutputContains(m, "cat /var/hello", "world") }