Skip to content

Commit

Permalink
include in use information in storage/v2 api
Browse files Browse the repository at this point in the history
  • Loading branch information
mwhudson committed Jul 19, 2023
1 parent 7a39a53 commit 17c7b65
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
6 changes: 4 additions & 2 deletions subiquity/common/filesystem/labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,8 @@ def _for_client_disk(disk, *, min_size=0):
can_be_boot_device=boot.can_be_boot_device(disk),
ok_for_guided=disk.size >= min_size,
model=getattr(disk, 'model', None),
vendor=getattr(disk, 'vendor', None))
vendor=getattr(disk, 'vendor', None),
has_in_use_partition=disk._has_in_use_partition)


@for_client.register(Partition)
Expand All @@ -339,7 +340,8 @@ def _for_client_partition(partition, *, min_size=0):
path=partition._path(),
estimated_min_size=partition.estimated_min_size,
mount=partition.mount,
format=partition.format)
format=partition.format,
is_in_use=partition._is_in_use)


@for_client.register(gaps.Gap)
Expand Down
3 changes: 3 additions & 0 deletions subiquity/common/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,8 @@ class Partition:
estimated_min_size: Optional[int] = -1
resize: Optional[bool] = None
path: Optional[str] = None
# Was this partition mounted when the installer started?
is_in_use: bool = False


@attr.s(auto_attribs=True)
Expand Down Expand Up @@ -333,6 +335,7 @@ class Disk:
can_be_boot_device: bool
model: Optional[str] = None
vendor: Optional[str] = None
has_in_use_partition: bool = False


class GuidedCapability(enum.Enum):
Expand Down
6 changes: 1 addition & 5 deletions subiquity/server/controllers/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -862,11 +862,7 @@ async def get_v2_storage_response(self, model, wait, include_raid):
if include_raid:
disks = self.potential_boot_disks(with_reformatting=True)
else:
disks = [
d
for d in model._all(type='disk')
if not d._has_in_use_partition
]
disks = model._all(type='disk')
minsize = self.calculate_suggested_install_min()
return StorageResponseV2(
status=ProbeStatus.DONE,
Expand Down

0 comments on commit 17c7b65

Please sign in to comment.