Skip to content

Commit

Permalink
test: Avoid scsi-debug drives for partitions
Browse files Browse the repository at this point in the history
Something is causing partitions on drives backed by scsi-debug to be
permanently busy with kernel 6.9.0-64 in Testing Farm runs. Let's just
avoid them.
  • Loading branch information
mvollmer committed May 28, 2024
1 parent be7f9c2 commit 32254f2
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 42 deletions.
6 changes: 3 additions & 3 deletions test/verify/check-storage-anaconda
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ class TestStorageAnaconda(storagelib.StorageCase):
def testBiosboot(self):
b = self.browser

disk = self.add_ram_disk()
disk = self.add_loopback_disk()

anaconda_config = {
"mount_point_prefix": "/sysroot",
Expand Down Expand Up @@ -375,7 +375,7 @@ class TestStorageAnaconda(storagelib.StorageCase):
def testEfiSystemPartition(self):
b = self.browser

disk = self.add_ram_disk()
disk = self.add_loopback_disk()

anaconda_config = {
"mount_point_prefix": "/sysroot",
Expand Down Expand Up @@ -413,7 +413,7 @@ class TestStorageAnaconda(storagelib.StorageCase):
m = self.machine
b = self.browser

disk = self.add_ram_disk()
disk = self.add_loopback_disk()

anaconda_config = {
"mount_point_prefix": "/sysroot",
Expand Down
10 changes: 5 additions & 5 deletions test/verify/check-storage-basic
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ class TestStorageBasic(storagelib.StorageCase):
b.wait_visible(create_dropdown)

# Add a disk, partition it, format it, and finally remove it.
disk = self.add_ram_disk()
disk = self.add_targetd_loopback_disk(index=1)

self.click_card_row("Storage", name=disk)
b.wait_visible(self.card("Solid State Drive"))
b.wait_visible(self.card("Hard Disk Drive"))

b.wait_text(self.card_desc("Solid State Drive", "Model"), "scsi_debug")
b.wait_in_text(self.card_desc("Solid State Drive", "Capacity"), "50 MiB")
b.wait_text(self.card_desc("Hard Disk Drive", "Model"), "disk1")
b.wait_in_text(self.card_desc("Hard Disk Drive", "Capacity"), "50 MiB")

self.assertEqual(self.inode(b.text(self.card_desc("Solid State Drive", "Device file"))), self.inode(disk))
self.assertEqual(self.inode(b.text(self.card_desc("Hard Disk Drive", "Device file"))), self.inode(disk))

m.execute(f'parted -s {disk} mktable gpt')
m.execute(f'parted -s {disk} mkpart primary ext2 1M 8M')
Expand Down
8 changes: 4 additions & 4 deletions test/verify/check-storage-luks
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ class TestStorageLuks(storagelib.StorageCase):
self.login_and_go("/storage")

# Add a disk and partition it
disk = self.add_ram_disk(100)
disk = self.add_loopback_disk(100)
self.click_card_row("Storage", name=disk)
self.click_card_dropdown("Solid State Drive", "Create partition table")
self.click_card_dropdown("Block device", "Create partition table")
self.dialog({"type": "gpt"})
b.wait_text(self.card_row_col("GPT partitions", 1, 1), "Free space")

Expand Down Expand Up @@ -255,7 +255,7 @@ class TestStorageLuks(storagelib.StorageCase):
self.login_and_go("/storage")

# Add a disk and format it with luks, but without filesystem
disk = self.add_ram_disk()
disk = self.add_loopback_disk()
self.click_card_row("Storage", name=disk)

self.click_card_dropdown("Unformatted data", "Format")
Expand Down Expand Up @@ -291,7 +291,7 @@ class TestStorageLuks(storagelib.StorageCase):
self.assertEqual(m.execute(f"lsblk -no RO {cleartext_dev}").strip(), "1")

# Now create a empty, encrypted partition
self.click_card_dropdown("Solid State Drive", "Create partition table")
self.click_card_dropdown("Block device", "Create partition table")
self.dialog({"type": "gpt"})
b.wait_text(self.card_row_col("GPT partitions", 1, 1), "Free space")
self.click_dropdown(self.card_row("GPT partitions", 1), "Create partition")
Expand Down
7 changes: 4 additions & 3 deletions test/verify/check-storage-lvm2
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ class TestStorageLvm2(storagelib.StorageCase):

self.login_and_go("/storage")

disk1 = self.add_ram_disk()
disk1 = self.add_loopback_disk()
disk2 = self.add_loopback_disk()
b.wait_visible(self.card_row("Storage", name=disk1))
b.wait_visible(self.card_row("Storage", name=disk2))
Expand All @@ -305,13 +305,13 @@ class TestStorageLvm2(storagelib.StorageCase):
# Create a volume group out of disk1
self.dialog_with_retry(trigger=lambda: self.click_devices_dropdown('Create LVM2 volume group'),
expect=lambda: self.dialog_is_present('disks', disk1) and
self.dialog_is_present('disks', "unpartitioned space on Linux scsi_debug"),
self.dialog_is_present('disks', "unpartitioned space on " + disk1),
values={"disks": {disk1: True}})

self.click_card_row("Storage", name="vgroup0")

# Check the we are really using a partition on disk1 now
b.wait_in_text(self.card_row_col("LVM2 volume group", 1, 2), "Partition - Linux scsi_debug")
b.wait_in_text(self.card_row_col("LVM2 volume group", 1, 2), "Partition - Block device")

# Add the unused space of disk2
self.dialog_with_retry(trigger=lambda: b.click(self.card_button("LVM2 volume group",
Expand All @@ -320,6 +320,7 @@ class TestStorageLvm2(storagelib.StorageCase):
'disks', "unpartitioned space on " + disk2),
values={"disks": {disk2: True}})
b.wait_in_text(self.card_row_col("LVM2 volume group", 1, 2), "Partition - Block device")
b.wait_in_text(self.card_row_col("LVM2 volume group", 2, 2), "Partition - Block device")

def testSnapshots(self):
m = self.machine
Expand Down
8 changes: 4 additions & 4 deletions test/verify/check-storage-mounting
Original file line number Diff line number Diff line change
Expand Up @@ -607,10 +607,10 @@ class TestStorageMountingLUKS(storagelib.StorageCase):
# Add a disk and make two partitions on it, one on /run/foo
# and one on /run/foo/bar

disk = self.add_ram_disk(100)
disk = self.add_loopback_disk(100)
self.click_card_row("Storage", name=disk)

self.click_card_dropdown("Solid State Drive", "Create partition table")
self.click_card_dropdown("Block device", "Create partition table")
self.dialog({"type": "gpt"})
b.wait_text(self.card_row_col("GPT partitions", 1, 1), "Free space")

Expand Down Expand Up @@ -671,7 +671,7 @@ class TestStorageMountingLUKS(storagelib.StorageCase):
self.dialog_wait_close()

# Now /run/foo/bar should be noauto.
self.assert_in_configuration(disk + "2", "crypttab", "options", "noauto")
self.assert_in_configuration(disk + "p2", "crypttab", "options", "noauto")
self.assertIn("noauto", m.execute("findmnt --fstab -n -o OPTIONS /run/foo/bar"))

# Mount them again and check that initializing the disk will
Expand All @@ -694,7 +694,7 @@ class TestStorageMountingLUKS(storagelib.StorageCase):
b.wait_text("#dialog tbody:nth-of-type(1) td[data-label=Location]", "/run/foo/bar")
b.wait_text("#dialog tbody:nth-of-type(2) td[data-label=Location]", "/run/foo")

self.dialog_with_error_retry(trigger=lambda: self.click_card_dropdown("Solid State Drive",
self.dialog_with_error_retry(trigger=lambda: self.click_card_dropdown("Block device",
"Create partition table"),
first_setup=first_setup,
errors=["Timed out waiting for object"])
Expand Down
4 changes: 2 additions & 2 deletions test/verify/check-storage-msdos
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ class TestStorageMsDOS(storagelib.StorageCase):
self.login_and_go("/storage")

# Add a disk
disk = self.add_ram_disk()
disk = self.add_loopback_disk()
self.click_card_row("Storage", name=disk)

# Format it with a DOS partition table
self.click_card_dropdown("Solid State Drive", "Create partition table")
self.click_card_dropdown("Block device", "Create partition table")
self.dialog({"type": "dos"})
b.wait_text(self.card_row_col("DOS partitions", 1, 1), "Free space")

Expand Down
16 changes: 8 additions & 8 deletions test/verify/check-storage-partitions
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ class TestStoragePartitions(storagelib.StorageCase):

self.login_and_go("/storage")

disk = self.add_ram_disk()
disk = self.add_loopback_disk()
self.click_card_row("Storage", name=disk)

self.click_card_dropdown("Solid State Drive", "Create partition table")
self.click_card_dropdown("Block device", "Create partition table")
self.dialog({"type": "gpt"})
b.wait_text(self.card_row_col("GPT partitions", 1, 1), "Free space")

Expand Down Expand Up @@ -102,18 +102,18 @@ class TestStoragePartitions(storagelib.StorageCase):
self.dialog_apply()
self.dialog_wait_close()

testlib.wait(lambda: m.execute(f"lsblk -no SIZE {disk}1").strip() == "25M")
testlib.wait(lambda: m.execute(f"lsblk -no SIZE {disk}p1").strip() == "25M")

def testResize(self):
m = self.machine
b = self.browser

self.login_and_go("/storage")

disk = self.add_ram_disk(100)
disk = self.add_loopback_disk(100)
self.click_card_row("Storage", name=disk)

self.click_card_dropdown("Solid State Drive", "Create partition table")
self.click_card_dropdown("Block device", "Create partition table")
self.dialog({"type": "gpt"})
b.wait_text(self.card_row_col("GPT partitions", 1, 1), "Free space")

Expand Down Expand Up @@ -169,12 +169,12 @@ class TestStoragePartitions(storagelib.StorageCase):

self.login_and_go("/storage")

disk = self.add_ram_disk(100)
disk = self.add_loopback_disk(100)
self.click_card_row("Storage", name=disk)

# GPT

self.click_card_dropdown("Solid State Drive", "Create partition table")
self.click_card_dropdown("Block device", "Create partition table")
self.dialog({"type": "gpt"})
b.wait_text(self.card_row_col("GPT partitions", 1, 1), "Free space")

Expand Down Expand Up @@ -203,7 +203,7 @@ class TestStoragePartitions(storagelib.StorageCase):
# DOS

b.click(self.card_parent_link())
self.click_card_dropdown("Solid State Drive", "Create partition table")
self.click_card_dropdown("Block device", "Create partition table")
self.dialog({"type": "dos"})
b.wait_text(self.card_row_col("DOS partitions", 1, 1), "Free space")

Expand Down
16 changes: 8 additions & 8 deletions test/verify/check-storage-swap
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ class TestStorageswap(storagelib.StorageCase):
b = self.browser
m = self.machine

disk = self.add_ram_disk()
disk = self.add_loopback_disk()
self.addCleanup(m.execute, f"swapoff {disk} || true; swapoff {disk}1 || true")

self.login_and_go("/storage")

# Create a swap partition on GPT
self.click_card_row("Storage", name=disk)
self.click_card_dropdown("Solid State Drive", "Create partition table")
self.click_card_dropdown("Block device", "Create partition table")
self.confirm()
b.wait_text(self.card_row_col("GPT partitions", 1, 1), "Free space")
self.click_dropdown(self.card_row("GPT partitions", 1), "Create partition")
Expand All @@ -45,17 +45,17 @@ class TestStorageswap(storagelib.StorageCase):
# It should have been started and have a fstab entry
self.click_card_row("GPT partitions", 1)
b.wait_text(self.card_desc("Swap", "Used"), "0 B")
self.assertIn("defaults", m.execute(f"findmnt --fstab -n -o OPTIONS {disk}1"))
self.assertIn("defaults", m.execute(f"findmnt --fstab -n -o OPTIONS {disk}p1"))

# Stopping should set it to noauto
b.click(self.card_button("Swap", "Stop"))
b.wait_text(self.card_desc("Swap", "Used"), "-")
self.assertIn("noauto", m.execute(f"findmnt --fstab -n -o OPTIONS {disk}1"))
self.assertIn("noauto", m.execute(f"findmnt --fstab -n -o OPTIONS {disk}p1"))

# Start it again to test teardown below
b.click(self.card_button("Swap", "Start"))
b.wait_text(self.card_desc("Swap", "Used"), "0 B")
self.assertIn("defaults", m.execute(f"findmnt --fstab -n -o OPTIONS {disk}1"))
self.assertIn("defaults", m.execute(f"findmnt --fstab -n -o OPTIONS {disk}p1"))

# It should have the right partition type
b.wait_visible(self.card("Swap"))
Expand All @@ -70,7 +70,7 @@ class TestStorageswap(storagelib.StorageCase):
self.click_card_dropdown("Swap", "Format")
self.dialog_wait_open()
self.dialog_set_val("type", "swap")
b.wait_in_text("#dialog .modal-footer-teardown", f"{disk}1")
b.wait_in_text("#dialog .modal-footer-teardown", f"{disk}p1")
b.wait_in_text("#dialog .modal-footer-teardown", "stop, format")
self.dialog_apply_secondary()
self.dialog_wait_close()
Expand All @@ -79,8 +79,8 @@ class TestStorageswap(storagelib.StorageCase):
# Delete the partition, the fstab entry should disappear
self.click_card_dropdown("Partition", "Delete")
self.confirm()
b.wait_visible(self.card("Solid State Drive"))
m.execute(f"! findmnt --fstab -n -o OPTIONS {disk}1")
b.wait_visible(self.card("Block device"))
m.execute(f"! findmnt --fstab -n -o OPTIONS {disk}p1")

# Format as swap on the command line, starting it should add
# fstab entry
Expand Down
10 changes: 5 additions & 5 deletions test/verify/check-storage-used
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ class TestStorageUsed(storagelib.StorageCase):

self.login_and_go("/storage")

disk = self.add_ram_disk()
disk = self.add_loopback_disk()
b.wait_visible(self.card_row("Storage", name=disk))
m.execute(f"parted -s {disk} mktable msdos")
m.execute(f"parted -s {disk} mkpart primary ext2 1M 25")
m.execute("udevadm settle")
m.execute(f"echo einszweidrei | cryptsetup luksFormat --pbkdf-memory 32768 {disk}1")
m.execute(f"echo einszweidrei | cryptsetup luksOpen {disk}1 dm-test")
m.execute(f"echo einszweidrei | cryptsetup luksFormat --pbkdf-memory 32768 {disk}p1")
m.execute(f"echo einszweidrei | cryptsetup luksOpen {disk}p1 dm-test")
m.execute("udevadm settle")
m.execute("mke2fs -q -L TEST /dev/mapper/dm-test")
m.execute("mount /dev/mapper/dm-test /mnt")
Expand All @@ -60,7 +60,7 @@ ExecStart=/usr/bin/sleep infinity
# should be 'in use' but Cockpit can clean them all up anyway.

self.click_card_row("Storage", name=disk)
b.wait_visible(self.card("Solid State Drive"))
b.wait_visible(self.card("Block device"))

self.click_card_row("DOS partitions", 1)
self.click_card_dropdown("ext2 filesystem", "Format")
Expand Down Expand Up @@ -101,7 +101,7 @@ ExecStart=/usr/bin/sleep infinity
def retry_setup():
self.dialog_set_val("type", "empty")

self.dialog_with_error_retry(trigger=lambda: self.click_card_dropdown("Solid State Drive",
self.dialog_with_error_retry(trigger=lambda: self.click_card_dropdown("Block device",
"Create partition table"),
first_setup=first_setup,
retry_setup=retry_setup,
Expand Down

0 comments on commit 32254f2

Please sign in to comment.