core: fix starting stubdom guid for HVM in debug mode

Remove artificial attribute '_start_guid_first' and use
guiagent_installed directly. This way starting guid for stubdom in debug
mode, even if guiagent_installed is set is much clearer.
This commit is contained in:
Marek Marczykowski-Górecki 2015-06-27 04:10:32 +02:00
parent f7c86f861c
commit ee48954445
3 changed files with 13 additions and 13 deletions

View File

@ -183,7 +183,6 @@ class QubesVm(object):
self.kernel) if self.kernel is not None \
else os.path.join(self.dir_path,
vm_files["kernels_subdir"]) },
"_start_guid_first": { "func": lambda x: False },
}
### Mark attrs for XML inclusion
@ -1617,6 +1616,10 @@ class QubesVm(object):
self.log.debug(
'start_guid(extra_guid_args={!r}, before_qrexec={!r})'.format(
extra_guid_args, before_qrexec))
if before_qrexec:
# On PV start GUId only after qrexec-daemon
return
if verbose:
print >> sys.stderr, "--> Starting Qubes GUId..."
@ -1767,7 +1770,7 @@ class QubesVm(object):
if qmemman_present:
qmemman_client.close()
extra_guid_args = None
extra_guid_args = []
if preparing_dvm:
# Run GUI daemon in "invisible" mode, so applications started by
# prerun script will not disturb the user
@ -1778,7 +1781,7 @@ class QubesVm(object):
# mode
start_guid = False
if self._start_guid_first and start_guid:
if start_guid:
self.start_guid(verbose=verbose, notify_function=notify_function,
before_qrexec=True, extra_guid_args=extra_guid_args)

View File

@ -221,15 +221,15 @@ class QubesDisposableVm(QubesVm):
if qmemman_present:
qmemman_client.close()
if self._start_guid_first and kwargs.get('start_guid', True) and os.path.exists('/var/run/shm.id'):
self.start_guid(verbose=verbose,
if kwargs.get('start_guid', True) and os.path.exists('/var/run/shm.id'):
self.start_guid(verbose=verbose, before_qrexec=True,
notify_function=kwargs.get('notify_function', None))
self.start_qrexec_daemon(verbose=verbose,
notify_function=kwargs.get('notify_function', None))
print >>sys.stderr, "time=%s, qrexec done" % (str(time.time()))
if not self._start_guid_first and kwargs.get('start_guid', True) and os.path.exists('/var/run/shm.id'):
if kwargs.get('start_guid', True) and os.path.exists('/var/run/shm.id'):
self.start_guid(verbose=verbose,
notify_function=kwargs.get('notify_function', None))
print >>sys.stderr, "time=%s, guid done" % (str(time.time()))

View File

@ -79,7 +79,6 @@ class QubesHVm(QubesVm):
attrs['seamless_gui_mode'] = { 'default': False,
'attr': '_seamless_gui_mode',
'save': lambda: str(self._seamless_gui_mode) }
attrs['_start_guid_first']['func'] = lambda x: True
attrs['services']['default'] = "{'meminfo-writer': False}"
attrs['memory']['default'] = defaults["hvm_memory"]
@ -97,10 +96,6 @@ class QubesHVm(QubesVm):
(not 'xml_element' in kwargs or kwargs['xml_element'].get('guiagent_installed') is None):
self.services['meminfo-writer'] = False
# Disable qemu GUID if the user installed qubes gui agent
if self.guiagent_installed:
self._start_guid_first = False
self.storage.volatile_img = None
@property
@ -409,7 +404,9 @@ class QubesHVm(QubesVm):
before_qrexec=False, **kwargs):
# If user force the guiagent, start_guid will mimic a standard QubesVM
if not before_qrexec and self.guiagent_installed:
super(QubesHVm, self).start_guid(verbose, notify_function, extra_guid_args=["-Q"], **kwargs)
kwargs['extra_guid_args'] = kwargs.get('extra_guid_args', []) + \
['-Q']
super(QubesHVm, self).start_guid(verbose, notify_function, **kwargs)
stubdom_guid_pidfile = '/var/run/qubes/guid-running.%d' % self.stubdom_xid
if os.path.exists(stubdom_guid_pidfile) and not self.debug:
try:
@ -436,7 +433,7 @@ class QubesHVm(QubesVm):
else:
super(QubesHVm, self).start_qrexec_daemon(**kwargs)
if self._start_guid_first:
if self.guiagent_installed:
if kwargs.get('verbose'):
print >> sys.stderr, "--> Waiting for user '%s' login..." % self.default_user