hvm: start stubdom guid regardless of guiagent_installed (#60 pro)
Alway start stubdom guid, then if guiagent_installed set - start the target one and when connects, kill stubdom one. This allow the user to see startup messages so prevent the impression of hang VM. Note 1: this doesn't work when VM disables SVGA output (just after windows boot splash screen). Note 2: gui-daemon sometimes hangs after receiving SIGTERM (libvchan_wait during libvchan_close). This looks to be stubdom gui agent problem.
This commit is contained in:
parent
6ae4fb99d9
commit
76aa93e94b
@ -1437,7 +1437,8 @@ class QubesVm(object):
|
||||
p = self.run('QUBESRPC qubes.WaitForSession none', user="root", passio_popen=True, gui=False, wait=True)
|
||||
p.communicate(input=self.default_user)
|
||||
|
||||
def start_guid(self, verbose = True, notify_function = None, extra_guid_args=[]):
|
||||
def start_guid(self, verbose = True, notify_function = None,
|
||||
extra_guid_args=[], before_qrexec=False):
|
||||
if verbose:
|
||||
print >> sys.stderr, "--> Starting Qubes GUId..."
|
||||
xid = self.get_xid()
|
||||
@ -1563,13 +1564,13 @@ class QubesVm(object):
|
||||
qmemman_client.close()
|
||||
|
||||
if self._start_guid_first and start_guid and not preparing_dvm and os.path.exists('/var/run/shm.id'):
|
||||
self.start_guid(verbose=verbose,notify_function=notify_function)
|
||||
self.start_guid(verbose=verbose, notify_function=notify_function, before_qrexec=True)
|
||||
|
||||
if not preparing_dvm:
|
||||
self.start_qrexec_daemon(verbose=verbose,notify_function=notify_function)
|
||||
|
||||
if not self._start_guid_first and start_guid and not preparing_dvm and os.path.exists('/var/run/shm.id'):
|
||||
self.start_guid(verbose=verbose,notify_function=notify_function)
|
||||
if start_guid and not preparing_dvm and os.path.exists('/var/run/shm.id'):
|
||||
self.start_guid(verbose=verbose, notify_function=notify_function)
|
||||
|
||||
if preparing_dvm:
|
||||
if verbose:
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
import os
|
||||
import os.path
|
||||
import signal
|
||||
import subprocess
|
||||
import stat
|
||||
import sys
|
||||
@ -83,9 +84,7 @@ class QubesHVm(QubesVm):
|
||||
if not ('meminfo-writer' in self.services and self.services['meminfo-writer']):
|
||||
self.maxmem = self.memory
|
||||
|
||||
# Disable qemu GUID if the user installed qubes gui agent
|
||||
if self.guiagent_installed:
|
||||
self._start_guid_first = False
|
||||
self._stubdom_guid_process = None
|
||||
|
||||
@property
|
||||
def type(self):
|
||||
@ -325,21 +324,32 @@ class QubesHVm(QubesVm):
|
||||
else:
|
||||
raise
|
||||
|
||||
def start_guid(self, verbose = True, notify_function = None, **kwargs):
|
||||
def start_stubdom_guid(self):
|
||||
cmdline = [system_path["qubes_guid_path"],
|
||||
"-d", str(self.stubdom_xid),
|
||||
"-c", self.label.color,
|
||||
"-i", self.label.icon_path,
|
||||
"-l", str(self.label.index)]
|
||||
retcode = subprocess.call (cmdline)
|
||||
if (retcode != 0) :
|
||||
raise QubesException("Cannot start qubes-guid!")
|
||||
|
||||
def start_guid(self, verbose = True, notify_function = None,
|
||||
before_qrexec=False, **kwargs):
|
||||
# If user force the guiagent, start_guid will mimic a standard QubesVM
|
||||
if self.guiagent_installed:
|
||||
if self.guiagent_installed and not before_qrexec:
|
||||
super(QubesHVm, self).start_guid(verbose, notify_function, extra_guid_args=["-Q"], **kwargs)
|
||||
stubdom_guid_pidfile = '/var/run/qubes/guid-running.%d' % self.stubdom_xid
|
||||
if os.path.exists(stubdom_guid_pidfile):
|
||||
try:
|
||||
stubdom_guid_pid = int(open(stubdom_guid_pidfile, 'r').read())
|
||||
os.kill(stubdom_guid_pid, signal.SIGTERM)
|
||||
except Exception as ex:
|
||||
print >> sys.stderr, "WARNING: Failed to kill stubdom gui daemon: %s" % str(ex)
|
||||
else:
|
||||
if verbose:
|
||||
print >> sys.stderr, "--> Starting Qubes GUId..."
|
||||
|
||||
retcode = subprocess.call ([system_path["qubes_guid_path"],
|
||||
"-d", str(self.stubdom_xid),
|
||||
"-c", self.label.color,
|
||||
"-i", self.label.icon_path,
|
||||
"-l", str(self.label.index)])
|
||||
if (retcode != 0) :
|
||||
raise QubesException("Cannot start qubes-guid!")
|
||||
print >> sys.stderr, "--> Starting Qubes GUId (full screen)..."
|
||||
self.start_stubdom_guid()
|
||||
|
||||
def start_qrexec_daemon(self, **kwargs):
|
||||
if not self.qrexec_installed:
|
||||
|
Loading…
Reference in New Issue
Block a user