vm: provide better error message for VM startup timeout

"Cannot execute qrexec-daemon!" error is very misleading for a startup
timeout error, make it clearer. This rely on qrexec-daemon using
distinct exit code for timeout error, but even without that, include its
stderr in the error message.
This commit is contained in:
Marek Marczykowski-Górecki 2018-02-26 02:53:35 +01:00
parent 173e7e4250
commit ba5d19e1b4
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -1313,9 +1313,17 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
try:
yield from self.start_daemon(
qubes.config.system_path['qrexec_daemon_path'], *qrexec_args,
env=qrexec_env)
except subprocess.CalledProcessError:
raise qubes.exc.QubesVMError(self, 'Cannot execute qrexec-daemon!')
env=qrexec_env, stderr=subprocess.PIPE)
except subprocess.CalledProcessError as err:
if err.returncode == 3:
raise qubes.exc.QubesVMError(self,
'Cannot connect to qrexec agent for {} seconds, '
'see /var/log/xen/console/guest-{}.log for details'.format(
self.qrexec_timeout, self.name
))
else:
raise qubes.exc.QubesVMError(self,
'qrexec-daemon startup failed: ' + err.stderr.decode())
@asyncio.coroutine
def start_qubesdb(self):