vm/appvm: add dispvm_allowed property

Speciffy whether DispVM can be created from this AppVM

Fixes QubesOS/qubes-issues#2075
This commit is contained in:
Marek Marczykowski-Górecki 2017-03-21 12:46:51 +01:00
parent e4e92b06af
commit 1c836531c7
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
2 changed files with 10 additions and 0 deletions

View File

@ -37,6 +37,12 @@ class AppVM(qubes.vm.qubesvm.QubesVM):
ls_width=31,
doc='Template, on which this AppVM is based.')
dispvm_allowed = qubes.property('dispvm_allowed',
type=bool,
default=False,
doc='Should this VM be allowed to start as Disposable VM'
)
def __init__(self, app, xml, template=None, **kwargs):
self.volume_config = {
'root': {

View File

@ -136,6 +136,10 @@ class DispVM(qubes.vm.qubesvm.QubesVM):
This method modifies :file:`qubes.xml` file.
The qube returned is not started.
'''
if not appvm.dispvm_allowed:
raise qubes.exc.QubesException(
'Refusing to start DispVM out of this AppVM, because '
'dispvm_allowed=False')
app = appvm.app
dispvm = app.add_new_vm(
cls,