From 6ef13ac66ad933a54a4a54e334f0ec0f1a72f88e Mon Sep 17 00:00:00 2001 From: Piotr Bartman Date: Tue, 11 Apr 2023 21:55:42 +0200 Subject: [PATCH] add derived_vms property --- qubesadmin/vm/__init__.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/qubesadmin/vm/__init__.py b/qubesadmin/vm/__init__.py index 4ed8dbe5..d7057ed4 100644 --- a/qubesadmin/vm/__init__.py +++ b/qubesadmin/vm/__init__.py @@ -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