Skip to content

Commit

Permalink
move filtering of disks with mounted partitions to client side
Browse files Browse the repository at this point in the history
  • Loading branch information
mwhudson committed Jul 19, 2023
1 parent 37a4a76 commit 9d050d4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
19 changes: 1 addition & 18 deletions subiquity/models/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -1261,19 +1261,6 @@ def process_probe_data(self):
work.extend(dependencies(o))
mounts.extend(mount.get('children', []))

# For now we mark anything that can be reached from a mounted
# partition (e.g. an unused partition on the install drive) as
# part of the install media.
work = [
o
for o in self._actions
if getattr(o, '_has_in_use_partition', False)
]
while work:
o = work.pop(0)
o._is_in_use = True
work.extend(reverse_dependencies(o))

# This is a special hack for the install media. When written to a USB
# stick or similar, both the block device for the whole drive and for
# the partition will show up as having a filesystem. Casper should
Expand Down Expand Up @@ -1620,11 +1607,7 @@ def can_emit(obj):
log.debug('mountpoints %s', mountpoints)

if mode == ActionRenderMode.FOR_API:
work = [
a
for a in self._actions
if not getattr(a, '_is_in_use', False)
]
work = list(self._actions)
else:
work = [
a for a in self._actions if not getattr(a, 'preserve', False)
Expand Down
4 changes: 3 additions & 1 deletion subiquity/ui/views/filesystem/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
from subiquity.common.filesystem import boot, gaps, labels
from subiquity.models.filesystem import (
humanize_size,
Disk,
)

from .delete import ConfirmDeleteStretchy, ConfirmReformatStretchy
Expand Down Expand Up @@ -376,8 +377,9 @@ def _action_menu_for_device(self, device):
def refresh_model_inputs(self):
devices = [
d for d in self.parent.model.all_devices()
if (d.available() == self.show_available
if ((d.available() == self.show_available
or (not self.show_available and d.has_unavailable_partition()))
and (not isinstance(d, Disk) or not d._has_in_use_partition))
]
if len(devices) == 0:
self._w = Padding.push_2(self._no_devices_content)
Expand Down

0 comments on commit 9d050d4

Please sign in to comment.