storage/v2: report min part size

This commit is contained in:
Dan Bungert 2022-05-18 16:56:29 -06:00
parent b298caf83a
commit 40b2f3267b
3 changed files with 12 additions and 0 deletions

View File

@ -319,6 +319,7 @@ def _for_client_partition(partition, *, min_size=0):
offset=partition.offset,
resize=partition.resize,
path=partition._path(),
estimated_min_size=partition.estimated_min_size,
mount=partition.mount,
format=partition.format)

View File

@ -268,6 +268,7 @@ class Partition:
boot: Optional[bool] = None
os: Optional[OsProber] = None
offset: Optional[int] = None
estimated_min_size: Optional[int] = -1
resize: Optional[bool] = None
path: Optional[str] = None

View File

@ -702,6 +702,16 @@ class Partition(_Formattable):
from subiquity.common.filesystem import boot
return boot.is_bootloader_partition(self)
@property
def estimated_min_size(self):
fs_data = self._m._probe_data.get('filesystem', {}).get(self._path())
if fs_data is None:
return -1
val = fs_data.get('ESTIMATED_MIN_SIZE')
if val == 0:
return self.device.alignment_data().part_align
return val
@property
def ok_for_raid(self):
if self.boot: