From 89e5704dce278d4a6990f7aedd3fec842bfb4e72 Mon Sep 17 00:00:00 2001 From: Allison Karlitskaya Date: Wed, 8 May 2024 08:44:26 +0200 Subject: [PATCH] test/storagelib: step up our destroy-and-reboot efforts Instead of trying to gracefully shutdown a destroyed system from the inside, do it forcefully from the outside. --- test/common/storagelib.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/common/storagelib.py b/test/common/storagelib.py index efc738b5050..ac5580561e0 100644 --- a/test/common/storagelib.py +++ b/test/common/storagelib.py @@ -554,8 +554,13 @@ def encrypt_root(self, passphrase): grubby --update-kernel=ALL --args="root=UUID=$uuid rootflags=defaults rd.luks.uuid=$luks_uuid rd.lvm.lv=root/root" ! test -f /etc/kernel/cmdline || cp /etc/kernel/cmdline /new-root/etc/kernel/cmdline """, timeout=300) - m.spawn("dd if=/dev/zero of=/dev/vda bs=1M count=100; reboot", "reboot", check=False) - m.wait_reboot(300) + + # Destroy our current boot device. This prevents the system from + # shutting down properly, so do it forcefully from outside. + m.execute("sync; dd if=/dev/zero of=/dev/vda bs=1M count=100; sync; sync; sync;") + m.kill() + m.start() + m.wait_boot() self.assertEqual(m.execute("findmnt -n -o SOURCE /").strip(), "/dev/mapper/root-root") # Cards and tables