vm: allow StandaloneVM to be a DVM template

Fixes QubesOS/qubes-issues#4670
This commit is contained in:
Marek Marczykowski-Górecki 2019-02-27 06:00:38 +01:00
parent 8041b72e42
commit f4528296b5
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
2 changed files with 10 additions and 2 deletions

View File

@ -26,12 +26,18 @@ import qubes.vm.qubesvm
import qubes.vm.appvm
import qubes.config
def _setter_template(self, prop, value):
if not getattr(value, 'template_for_dispvms', False):
raise qubes.exc.QubesPropertyValueError(self, prop, value,
'template for DispVM must have template_for_dispvms=True')
return value
class DispVM(qubes.vm.qubesvm.QubesVM):
'''Disposable VM'''
template = qubes.VMProperty('template',
load_stage=4,
vmclass=qubes.vm.appvm.AppVM,
setter=_setter_template,
doc='AppVM, on which this DispVM is based.')
dispid = qubes.property('dispid', type=int, write_once=True,

View File

@ -19,10 +19,12 @@
#
import qubes.events
import qubes.vm.mix.dvmtemplate
import qubes.vm.qubesvm
import qubes.config
class StandaloneVM(qubes.vm.qubesvm.QubesVM):
class StandaloneVM(qubes.vm.mix.dvmtemplate.DVMTemplateMixin,
qubes.vm.qubesvm.QubesVM):
'''Standalone Application VM'''
def __init__(self, *args, **kwargs):