vm: add TemplateVM.appvms property - list of VMs based on it
This commit is contained in:
parent
024ac6a810
commit
d0bcd3ead2
@ -72,6 +72,13 @@ class QubesVM(qubesadmin.base.PropertyHolder):
|
||||
return self.name < other.name
|
||||
return NotImplemented
|
||||
|
||||
def __eq__(self, other):
|
||||
if isinstance(other, QubesVM):
|
||||
return self.name == other.name
|
||||
elif isinstance(other, str):
|
||||
return self.name == other
|
||||
return NotImplemented
|
||||
|
||||
def start(self):
|
||||
'''
|
||||
Start domain.
|
||||
@ -288,6 +295,17 @@ class StandaloneVM(QubesVM):
|
||||
|
||||
class TemplateVM(QubesVM):
|
||||
'''Template for AppVM'''
|
||||
|
||||
@property
|
||||
def appvms(self):
|
||||
''' Returns a generator containing all domains based on the current
|
||||
TemplateVM.
|
||||
'''
|
||||
for vm in self.app.domains:
|
||||
try:
|
||||
if vm.template == self:
|
||||
yield vm
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user