Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add filter for qubes stored on inaccessible storage pools #399

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions qubesmanager/qube_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,21 @@ def filterAcceptsRow(self, sourceRow, sourceParent):
if not self.window.show_internal_action.isChecked() and vm.internal:
return False

if not self.window.show_unavailable_pool_action.isChecked():
pools = {}
app = self.window.qubes_app
persistent_volumes = (volume
for volume in app.domains[vm.name].volumes.values()
if volume.source is None and not volume.ephemeral
)
for volume in persistent_volumes:
if not volume.pool in pools:
pools[volume.pool] = set((
volume.vid for volume in app.pools[volume.pool].volumes
))
if not volume.vid in pools[volume.pool]:
return False

if self.window.show_user.isChecked() \
and vm.klass in ['AppVM', 'StandaloneVM'] \
and not getattr(vm.vm, 'template_for_dispvms', False) \
Expand Down Expand Up @@ -818,6 +833,11 @@ def __init__(self, qt_app, qubes_app, dispatcher, _parent=None):
self.show_internal_action.setCheckable(True)
self.show_internal_action.toggled.connect(self.invalidate)

self.show_unavailable_pool_action = self.menu_view.addAction(
self.tr('Show qubes stored on unavailable storage pools'))
self.show_unavailable_pool_action.setCheckable(True)
self.show_unavailable_pool_action.toggled.connect(self.invalidate)

self.menu_view.addSeparator()
self.menu_view.addAction(self.action_toolbar)
self.menu_view.addAction(self.action_menubar)
Expand Down Expand Up @@ -1027,6 +1047,8 @@ def save_showing(self):
self.show_standalone.isChecked())
self.manager_settings.setValue('show/internal',
self.show_internal_action.isChecked())
self.manager_settings.setValue('show/unavailable_pool',
self.show_unavailable_pool_action.isChecked())
self.manager_settings.setValue('show/user',
self.show_user.isChecked())
self.manager_settings.setValue('show/all',
Expand Down Expand Up @@ -1260,6 +1282,9 @@ def load_manager_settings(self):

self.show_internal_action.setChecked(self.manager_settings.value(
'show/internal', "false") == "true")
self.show_unavailable_pool_action.setChecked(
self.manager_settings.value(
'show/unavailable_pool', "true") == "true")
# load last window size
self.resize(self.manager_settings.value("window_size",
QSize(1100, 600)))
Expand Down