|
@@ -21,6 +21,8 @@
|
|
|
|
|
|
''' A disposable vm implementation '''
|
|
|
|
|
|
+import asyncio
|
|
|
+
|
|
|
import qubes.vm.qubesvm
|
|
|
import qubes.vm.appvm
|
|
|
import qubes.config
|
|
@@ -45,6 +47,7 @@ class DispVM(qubes.vm.qubesvm.QubesVM):
|
|
|
'snap_on_start': True,
|
|
|
'save_on_stop': False,
|
|
|
'rw': False,
|
|
|
+ 'source': None,
|
|
|
},
|
|
|
'private': {
|
|
|
'name': 'private',
|
|
@@ -52,6 +55,7 @@ class DispVM(qubes.vm.qubesvm.QubesVM):
|
|
|
'snap_on_start': True,
|
|
|
'save_on_stop': False,
|
|
|
'rw': True,
|
|
|
+ 'source': None,
|
|
|
},
|
|
|
'volatile': {
|
|
|
'name': 'volatile',
|
|
@@ -112,6 +116,7 @@ class DispVM(qubes.vm.qubesvm.QubesVM):
|
|
|
'Cannot change template of Disposable VM')
|
|
|
|
|
|
@classmethod
|
|
|
+ @asyncio.coroutine
|
|
|
def from_appvm(cls, appvm, **kwargs):
|
|
|
'''Create a new instance from given AppVM
|
|
|
|
|
@@ -143,10 +148,11 @@ class DispVM(qubes.vm.qubesvm.QubesVM):
|
|
|
proplist = [prop for prop in dispvm.property_list()
|
|
|
if prop.clone and prop.__name__ not in ['template']]
|
|
|
dispvm.clone_properties(app.domains[appvm], proplist=proplist)
|
|
|
- dispvm.create_on_disk()
|
|
|
+ yield from dispvm.create_on_disk()
|
|
|
app.save()
|
|
|
return dispvm
|
|
|
|
|
|
+ @asyncio.coroutine
|
|
|
def cleanup(self):
|
|
|
'''Clean up after the DispVM
|
|
|
|
|
@@ -154,9 +160,10 @@ class DispVM(qubes.vm.qubesvm.QubesVM):
|
|
|
This method modifies :file:`qubes.xml` file.
|
|
|
'''
|
|
|
try:
|
|
|
- self.force_shutdown()
|
|
|
+ # pylint: disable=not-an-iterable
|
|
|
+ yield from self.kill()
|
|
|
except qubes.exc.QubesVMNotStartedError:
|
|
|
pass
|
|
|
- self.remove_from_disk()
|
|
|
+ yield from self.remove_from_disk()
|
|
|
del self.app.domains[self]
|
|
|
self.app.save()
|