From 9d050d4049527851a3a58656a028fcd83d4fcfc4 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Wed, 12 Jul 2023 11:46:16 +1200 Subject: [PATCH] move filtering of disks with mounted partitions to client side --- subiquity/models/filesystem.py | 19 +------------------ subiquity/ui/views/filesystem/filesystem.py | 4 +++- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/subiquity/models/filesystem.py b/subiquity/models/filesystem.py index 34239895a..f43255dc4 100644 --- a/subiquity/models/filesystem.py +++ b/subiquity/models/filesystem.py @@ -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 @@ -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) diff --git a/subiquity/ui/views/filesystem/filesystem.py b/subiquity/ui/views/filesystem/filesystem.py index 0c9ab2a43..7450725fb 100644 --- a/subiquity/ui/views/filesystem/filesystem.py +++ b/subiquity/ui/views/filesystem/filesystem.py @@ -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 @@ -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)