Skip to content

Commit

Permalink
Adjust vm.icon value for DispVM-related qubes
Browse files Browse the repository at this point in the history
An AppVM with template_for_dispvms is a "disposable template", so let it
have "template" icon.
For a disposable service qube it's more important it's "service" than
"disposable", so let it have "service" icon.

QubesOS/qubes-issues#6709
  • Loading branch information
marmarek committed Jul 8, 2021
1 parent 258a449 commit ef9200e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions qubes/vm/appvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,14 @@ def __init__(self, app, xml, **kwargs):

super().__init__(app, xml, **kwargs)

@qubes.stateless_property
def icon(self):
if self.template_for_dispvms:
return 'templatevm-' + self.label.name
# multi-inheritance and properties confuses pylint here
# pylint: disable=no-member
return super().icon

@qubes.events.handler('domain-load')
def on_domain_loaded(self, event):
''' When domain is loaded assert that this vm has a template.
Expand Down
4 changes: 2 additions & 2 deletions qubes/vm/qubesvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -2134,10 +2134,10 @@ def icon(self):
raw_icon_name = self.label.name
if self.klass == 'TemplateVM':
return 'templatevm-' + raw_icon_name
if self.klass == 'DispVM':
return 'dispvm-' + raw_icon_name
if self.features.get('servicevm', False):
return 'servicevm-' + raw_icon_name
if self.klass == 'DispVM':
return 'dispvm-' + raw_icon_name
return 'appvm-' + raw_icon_name

@property
Expand Down

0 comments on commit ef9200e

Please sign in to comment.