Skip to content

Commit

Permalink
Do more with RAID metadata
Browse files Browse the repository at this point in the history
Signed-off-by: mulhern <[email protected]>
  • Loading branch information
mulkieran committed Aug 9, 2024
1 parent 6b97c5b commit 838d42e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
pylint
python3-dbus
python3-dbus-python-client-gen
python3-justbytes
python3-gobject
python3-psutil
image: fedora:40 # CURRENT DEVELOPMENT ENVIRONMENT
Expand Down
21 changes: 14 additions & 7 deletions testlib/infra.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

# isort: THIRDPARTY
import dbus
from justbytes import Range

from .dbus import StratisDbus, manager_interfaces
from .utils import exec_command, process_exists, terminate_traces
Expand All @@ -44,6 +45,7 @@
MOUNT_POINT_SUFFIX = "_stratisd_mounts"
UMOUNT = "umount"
MOUNT = "mount"
STRATIS_METADATA_LEN = Range(8192, 512)


def clean_up(): # pylint: disable=too-many-branches
Expand Down Expand Up @@ -270,19 +272,25 @@ def _check_crypt_meta_allocs(self, metadata):
def _check_raid_meta_allocs(self, metadata):
"""
Check that all raid_meta_allocs exist and have non-zero length.
RAID meta_allocs should start immediately after Stratis metadata ends.
"""
for raid_meta_allocs in [
a["raid_meta_allocs"]
for a in metadata["backstore"]["data_tier"]["blockdev"]["devs"]
]:
self.assertIsNotNone(raid_meta_allocs)
self.assertIsInstance(raid_meta_allocs, list)
self.assertGreater(len(raid_meta_allocs), 0)
self.assertEqual(len(raid_meta_allocs), 1)

raid_meta_allocs = raid_meta_allocs[0]
self.assertIsInstance(raid_meta_allocs, list)
self.assertGreater(raid_meta_allocs[0], 0)
self.assertGreater(raid_meta_allocs[1], 0)

raid_meta_alloc_start = Range(raid_meta_allocs[0], 512)
raid_meta_alloc_len = Range(raid_meta_allocs[1], 512)

self.assertEqual(raid_meta_alloc_start, STRATIS_METADATA_LEN)
self.assertGreater(raid_meta_alloc_len, Range(0))

def _check_integrity_meta_allocs(self, metadata):
"""
Expand All @@ -296,10 +304,9 @@ def _check_integrity_meta_allocs(self, metadata):
self.assertIsInstance(integrity_meta_allocs, list)
self.assertGreater(len(integrity_meta_allocs), 0)

integrity_meta_allocs = integrity_meta_allocs[0]
self.assertIsInstance(integrity_meta_allocs, list)
self.assertGreater(integrity_meta_allocs[0], 0)
self.assertGreater(integrity_meta_allocs[1], 0)
for alloc in integrity_meta_allocs:
self.assertGreater(alloc[0], 0)
self.assertGreater(alloc[1], 0)

def run_check(self, stop_time):
"""
Expand Down

0 comments on commit 838d42e

Please sign in to comment.