Merge pull request #1366 from mwhudson/lp-1982903

add .path to Raid so for_client(raid-with-partitions) works
This commit is contained in:
Michael Hudson-Doyle 2022-07-28 09:25:41 +12:00 committed by GitHub
commit 57fb6b8072
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 0 deletions

View File

@ -18,12 +18,14 @@ import unittest
from subiquity.common.filesystem.labels import ( from subiquity.common.filesystem.labels import (
annotations, annotations,
for_client,
usage_labels, usage_labels,
) )
from subiquity.models.tests.test_filesystem import ( from subiquity.models.tests.test_filesystem import (
make_model, make_model,
make_model_and_disk, make_model_and_disk,
make_model_and_partition, make_model_and_partition,
make_model_and_raid,
make_partition, make_partition,
) )
@ -123,3 +125,11 @@ class TestUsageLabels(unittest.TestCase):
self.assertEqual( self.assertEqual(
usage_labels(partition), usage_labels(partition),
["to be reformatted as ext4", "mounted at /"]) ["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)

View File

@ -799,6 +799,12 @@ class Raid(_Device):
container = attributes.ref(backlink="_subvolumes", default=None) # Raid container = attributes.ref(backlink="_subvolumes", default=None) # Raid
_subvolumes = attributes.backlink(default=attr.Factory(list)) _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 @property
def size(self): def size(self):
if self.preserve and self._m._probe_data: if self.preserve and self._m._probe_data: