From 498470ce1b96ae05c390d13f073ce987df8b3e52 Mon Sep 17 00:00:00 2001 From: Marius Vollmer Date: Wed, 28 Aug 2024 14:29:40 +0300 Subject: [PATCH] DBG --- pkg/storaged/btrfs/btrfs-tool.py | 15 ++++++++++----- test/run | 2 +- test/verify/check-storage-anaconda | 21 +++++++++++++++++++++ 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/pkg/storaged/btrfs/btrfs-tool.py b/pkg/storaged/btrfs/btrfs-tool.py index 209a4c1f3b8..c917093f1a0 100755 --- a/pkg/storaged/btrfs/btrfs-tool.py +++ b/pkg/storaged/btrfs/btrfs-tool.py @@ -27,6 +27,9 @@ TMP_MP_DIR = "/var/lib/cockpit/btrfs" +def debug(msg): + subprocess.check_call(["logger", msg]) + def ensure_tmp_mp_dir(): os.makedirs(TMP_MP_DIR, mode=0o700, exist_ok=True) @@ -67,7 +70,7 @@ def add_tmp_mountpoint(fs, dev, opt_repair): global tmp_mountpoints uuid = fs['uuid'] if uuid not in tmp_mountpoints: - # sys.stderr.write(f"ADDING {uuid}\n") + debug(f"ADDING {uuid}") tmp_mountpoints.add(uuid) ensure_tmp_mp_dir() with atomic_file(TMP_MP_DIR + "/db") as db: @@ -77,24 +80,25 @@ def add_tmp_mountpoint(fs, dev, opt_repair): db[uuid] = 1 if not fs['has_tmp_mountpoint'] and (db[uuid] == 1 or opt_repair): dir = TMP_MP_DIR + "/" + uuid - # sys.stderr.write(f"MOUNTING {dir}\n") + debug(f"MOUNTING {dir}") os.makedirs(dir, exist_ok=True) subprocess.check_call(["mount", dev, dir]) def remove_tmp_mountpoint(uuid): global tmp_mountpoints if uuid in tmp_mountpoints: - # sys.stderr.write(f"REMOVING {uuid}\n") + debug(f"REMOVING {uuid}") tmp_mountpoints.remove(uuid) ensure_tmp_mp_dir() with atomic_file(TMP_MP_DIR + "/db") as db: if db[uuid] == 1: dir = TMP_MP_DIR + "/" + uuid try: - # sys.stderr.write(f"UNMOUNTING {dir}\n") + debug(f"UNMOUNTING {dir}") subprocess.check_call(["umount", dir]) subprocess.check_call(["rmdir", dir]) except Exception: + debug(f"UNMOUNTING ERROR") # XXX - log error, try harder? pass del db[uuid] @@ -153,7 +157,7 @@ def get_usages(uuid): return usages; def poll(opt_mount, opt_repair): - # sys.stderr.write("POLL\n") + debug(f"POLL mount {opt_mount} repair {opt_repair}") filesystems = list_filesystems() info = { } for fs in filesystems.values(): @@ -188,6 +192,7 @@ def cmd_poll(opt_mount): sys.stdout.flush() def cmd_do(uuid, cmd): + debug(f"DO {uuid} {cmd}") filesystems = list_filesystems() for fs in filesystems.values(): if fs['uuid'] == uuid: diff --git a/test/run b/test/run index fabdb2921ed..c13510d1c4f 100755 --- a/test/run +++ b/test/run @@ -26,7 +26,7 @@ RUN_OPTS="" ALL_TESTS="$(test/common/run-tests --test-dir test/verify -l)" RE_NETWORKING='Networking|Bonding|Connection|TestBridge|WireGuard|Firewall|Team|IPA|AD|Kerberos' -RE_STORAGE='Storage' +RE_STORAGE='TestStorageAnaconda.testBtrfs' RE_EXPENSIVE='HostSwitching|MultiMachine|Updates|Superuser|Kdump|Pages' # every known case needs to set RUN_OPTS to something non-empty, so that we can check if we hit any branch diff --git a/test/verify/check-storage-anaconda b/test/verify/check-storage-anaconda index 48b38f90b5c..43ee20ec207 100755 --- a/test/verify/check-storage-anaconda +++ b/test/verify/check-storage-anaconda @@ -326,6 +326,27 @@ class TestStorageAnaconda(storagelib.StorageCase): } }) + def testBtrfs2(self): + self.testBtrfs() + + def testBtrfs3(self): + self.testBtrfs() + + def testBtrfs4(self): + self.testBtrfs() + + def testBtrfs5(self): + self.testBtrfs() + + def testBtrfs6(self): + self.testBtrfs() + + def testBtrfs7(self): + self.testBtrfs() + + def testBtrfs8(self): + self.testBtrfs() + def testBiosboot(self): b = self.browser