Fix start-related asyncio integration
cherry-picked commit 05fc3a4
This commit is contained in:
parent
3bc4ec1e98
commit
96db9a46d1
@ -25,6 +25,8 @@ import os
|
||||
import re
|
||||
import subprocess
|
||||
|
||||
import asyncio
|
||||
|
||||
import qubes.config
|
||||
import qubes.ext
|
||||
|
||||
@ -194,14 +196,18 @@ class GUI(qubes.ext.Extension):
|
||||
|
||||
guid_cmd += self.kde_guid_args(vm)
|
||||
|
||||
@asyncio.coroutine
|
||||
def coro():
|
||||
try:
|
||||
vm.start_daemon(guid_cmd)
|
||||
yield from vm.start_daemon(guid_cmd)
|
||||
except subprocess.CalledProcessError:
|
||||
raise qubes.exc.QubesVMError(vm,
|
||||
'Cannot start qubes-guid for domain {!r}'.format(vm.name))
|
||||
|
||||
vm.fire_event('monitor-layout-change')
|
||||
|
||||
asyncio.ensure_future(coro())
|
||||
|
||||
|
||||
@staticmethod
|
||||
def get_stubdom_xid(vm):
|
||||
|
@ -823,12 +823,15 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
||||
yield from self.netvm.start(start_guid=start_guid,
|
||||
notify_function=notify_function)
|
||||
|
||||
# TODO: lock
|
||||
|
||||
qmemman_client = yield from asyncio.get_event_loop().run_in_executor(
|
||||
None, self.request_memory, mem_required)
|
||||
|
||||
yield from asyncio.get_event_loop().run_in_executor(None,
|
||||
self.storage.start)
|
||||
self._update_libvirt_domain()
|
||||
|
||||
qmemman_client = yield from asyncio.get_event_loop().run_in_executor(
|
||||
None, self.request_memory, mem_required)
|
||||
try:
|
||||
self.libvirt_domain.createWithFlags(libvirt.VIR_DOMAIN_START_PAUSED)
|
||||
except:
|
||||
@ -1213,8 +1216,7 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
||||
|
||||
self.log.info('qubes-session acquired')
|
||||
self.have_session.set()
|
||||
|
||||
self.fire_event('have-session')
|
||||
self.fire_event('domain-has-session')
|
||||
|
||||
def create_on_disk(self, pool=None, pools=None):
|
||||
'''Create files needed for VM.
|
||||
|
Loading…
Reference in New Issue
Block a user