|
@@ -24,10 +24,12 @@ import copy
|
|
|
|
|
|
import qubes.events
|
|
import qubes.events
|
|
import qubes.vm.qubesvm
|
|
import qubes.vm.qubesvm
|
|
|
|
+import qubes.vm.mix.dvmtemplate
|
|
from qubes.config import defaults
|
|
from qubes.config import defaults
|
|
|
|
|
|
|
|
|
|
-class AppVM(qubes.vm.qubesvm.QubesVM):
|
|
|
|
|
|
+class AppVM(qubes.vm.mix.dvmtemplate.DVMTemplateMixin,
|
|
|
|
+ qubes.vm.qubesvm.QubesVM):
|
|
'''Application VM'''
|
|
'''Application VM'''
|
|
|
|
|
|
template = qubes.VMProperty('template',
|
|
template = qubes.VMProperty('template',
|
|
@@ -35,11 +37,6 @@ class AppVM(qubes.vm.qubesvm.QubesVM):
|
|
vmclass=qubes.vm.templatevm.TemplateVM,
|
|
vmclass=qubes.vm.templatevm.TemplateVM,
|
|
doc='Template, on which this AppVM is based.')
|
|
doc='Template, on which this AppVM is based.')
|
|
|
|
|
|
- template_for_dispvms = qubes.property('template_for_dispvms',
|
|
|
|
- type=bool,
|
|
|
|
- default=False,
|
|
|
|
- doc='Should this VM be allowed to start as Disposable VM')
|
|
|
|
-
|
|
|
|
default_volume_config = {
|
|
default_volume_config = {
|
|
'root': {
|
|
'root': {
|
|
'name': 'root',
|
|
'name': 'root',
|
|
@@ -97,15 +94,6 @@ class AppVM(qubes.vm.qubesvm.QubesVM):
|
|
|
|
|
|
super(AppVM, self).__init__(app, xml, **kwargs)
|
|
super(AppVM, self).__init__(app, xml, **kwargs)
|
|
|
|
|
|
- @property
|
|
|
|
- def dispvms(self):
|
|
|
|
- ''' Returns a generator containing all Disposable VMs based on the
|
|
|
|
- current AppVM.
|
|
|
|
- '''
|
|
|
|
- for vm in self.app.domains:
|
|
|
|
- if hasattr(vm, 'template') and vm.template is self:
|
|
|
|
- yield vm
|
|
|
|
-
|
|
|
|
@qubes.events.handler('domain-load')
|
|
@qubes.events.handler('domain-load')
|
|
def on_domain_loaded(self, event):
|
|
def on_domain_loaded(self, event):
|
|
''' When domain is loaded assert that this vm has a template.
|
|
''' When domain is loaded assert that this vm has a template.
|
|
@@ -126,10 +114,6 @@ class AppVM(qubes.vm.qubesvm.QubesVM):
|
|
if not self.is_halted():
|
|
if not self.is_halted():
|
|
raise qubes.exc.QubesVMNotHaltedError(self,
|
|
raise qubes.exc.QubesVMNotHaltedError(self,
|
|
'Cannot change template while qube is running')
|
|
'Cannot change template while qube is running')
|
|
- if any(self.dispvms):
|
|
|
|
- raise qubes.exc.QubesVMInUseError(self,
|
|
|
|
- 'Cannot change template '
|
|
|
|
- 'while there are DispVMs based on this qube')
|
|
|
|
|
|
|
|
@qubes.events.handler('property-set:template')
|
|
@qubes.events.handler('property-set:template')
|
|
def on_property_set_template(self, event, name, newvalue, oldvalue=None):
|
|
def on_property_set_template(self, event, name, newvalue, oldvalue=None):
|