Skip to content

Commit

Permalink
add .path to Raid so for_client(raid-with-partitions) works
Browse files Browse the repository at this point in the history
  • Loading branch information
mwhudson committed Jul 27, 2022
1 parent cecca21 commit ce146ab
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions subiquity/common/filesystem/tests/test_labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@

from subiquity.common.filesystem.labels import (
annotations,
for_client,
usage_labels,
)
from subiquity.models.tests.test_filesystem import (
make_model,
make_model_and_disk,
make_model_and_partition,
make_model_and_raid,
make_partition,
)

Expand Down Expand Up @@ -123,3 +125,11 @@ def test_partition_usage_labels(self):
self.assertEqual(
usage_labels(partition),
["to be reformatted as ext4", "mounted at /"])


class TestForClient(unittest.TestCase):

def test_for_client_raid_parts(self):
model, raid = make_model_and_raid()
make_partition(model, raid)
for_client(raid)
6 changes: 6 additions & 0 deletions subiquity/models/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,12 @@ def serialize_devices(self):
container = attributes.ref(backlink="_subvolumes", default=None) # Raid
_subvolumes = attributes.backlink(default=attr.Factory(list))

@property
def path(self):
# This is just here to make for_client(raid-with-partitions) work. It
# might not be very accurate.
return '/dev/md/' + self.name

@property
def size(self):
if self.preserve and self._m._probe_data:
Expand Down

0 comments on commit ce146ab

Please sign in to comment.