Skip to content

Commit

Permalink
add derived_vms property
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrbartman committed Apr 14, 2023
1 parent 4bdf0bc commit 6ef13ac
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions qubesadmin/vm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,21 @@ def appvms(self):
except AttributeError:
pass

@property
def derived_vms(self):
"""
Return list of all domains based on the current TemplateVM
at any level of inheritance.
"""
return list(QubesVM._get_derived_vms(self))

@staticmethod
def _get_derived_vms(vm):
result = set(vm.appvms)
for appvm in vm.appvms:
result.update(QubesVM._get_derived_vms(appvm))
return result

@property
def connected_vms(self):
''' Return a generator containing all domains connected to the current
Expand Down

0 comments on commit 6ef13ac

Please sign in to comment.