dispvm: don't load separate Qubes() instance when handling DispVM
This will not work in qubesd, where there is one and only Qubes() instance.
This commit is contained in:
parent
3bc4ec1e98
commit
e4e92b06af
@ -123,7 +123,7 @@ class DispVM(qubes.vm.qubesvm.QubesVM):
|
|||||||
'''Create a new instance from given AppVM
|
'''Create a new instance from given AppVM
|
||||||
|
|
||||||
:param qubes.vm.appvm.AppVM appvm: template from which the VM should \
|
:param qubes.vm.appvm.AppVM appvm: template from which the VM should \
|
||||||
be created (could also be name or qid)
|
be created
|
||||||
:returns: new disposable vm
|
:returns: new disposable vm
|
||||||
|
|
||||||
*kwargs* are passed to the newly created VM
|
*kwargs* are passed to the newly created VM
|
||||||
@ -133,12 +133,10 @@ class DispVM(qubes.vm.qubesvm.QubesVM):
|
|||||||
>>> dispvm.run_service('qubes.VMShell', input='firefox')
|
>>> dispvm.run_service('qubes.VMShell', input='firefox')
|
||||||
>>> dispvm.cleanup()
|
>>> dispvm.cleanup()
|
||||||
|
|
||||||
This method modifies :file:`qubes.xml` file. In fact, the newly created
|
This method modifies :file:`qubes.xml` file.
|
||||||
vm belongs to other :py:class:`qubes.Qubes` instance than the *app*.
|
|
||||||
The qube returned is not started.
|
The qube returned is not started.
|
||||||
'''
|
'''
|
||||||
store = appvm.app.store if isinstance(appvm, qubes.vm.BaseVM) else None
|
app = appvm.app
|
||||||
app = qubes.Qubes(store)
|
|
||||||
dispvm = app.add_new_vm(
|
dispvm = app.add_new_vm(
|
||||||
cls,
|
cls,
|
||||||
dispid=app.domains.get_new_unused_dispid(),
|
dispid=app.domains.get_new_unused_dispid(),
|
||||||
@ -156,15 +154,12 @@ class DispVM(qubes.vm.qubesvm.QubesVM):
|
|||||||
'''Clean up after the DispVM
|
'''Clean up after the DispVM
|
||||||
|
|
||||||
This stops the disposable qube and removes it from the store.
|
This stops the disposable qube and removes it from the store.
|
||||||
|
|
||||||
This method modifies :file:`qubes.xml` file.
|
This method modifies :file:`qubes.xml` file.
|
||||||
'''
|
'''
|
||||||
app = qubes.Qubes(self.app.store)
|
|
||||||
self = app.domains[self.uuid]
|
|
||||||
try:
|
try:
|
||||||
self.force_shutdown()
|
self.force_shutdown()
|
||||||
except qubes.exc.QubesVMNotStartedError:
|
except qubes.exc.QubesVMNotStartedError:
|
||||||
pass
|
pass
|
||||||
self.remove_from_disk()
|
self.remove_from_disk()
|
||||||
del app.domains[self]
|
del self.app.domains[self]
|
||||||
app.save()
|
self.app.save()
|
||||||
|
Loading…
Reference in New Issue
Block a user