Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions qubes/vm/dispvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,11 +373,13 @@ async def on_domain_started_dispvm(
except asyncio.TimeoutError:
raise qubes.exc.QubesException(
"Timed out call to '%s' after '%d' seconds during preload "
"startup" % (service, timeout)
"startup" % (rpc, timeout)
)
except (subprocess.CalledProcessError, qubes.exc.QubesException):
raise qubes.exc.QubesException(
"Error on call to '%s' during preload startup" % service
"Error on call to '%s' during preload startup. To debug, run "
"the following on a new disposable of '%s': systemctl "
"--failed" % (rpc, self.template)
)

if not self.preload_requested:
Expand Down
9 changes: 4 additions & 5 deletions qubes/vm/qubesvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1548,18 +1548,17 @@ async def start(

except Exception as exc: # pylint: disable=bare-except
self.log.error("Start failed: %s", str(exc))
# let anyone receiving domain-pre-start know that startup failed
await self.fire_event_async(
"domain-start-failed", reason=str(exc)
)
Comment on lines +1551 to +1554
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does moving it actually helps anything? This code (intentionally) does not wait until all clients process an event, so there is no guarantee that qui-domains will still see the VM. Or is it about order of events if kill triggers domain-delete event?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It helps as without that, the event will never reach the clients as domain-shutdown and domain-delete from the self.kill() will reach first, thus it will stop tracking the qube. Now that the event is fired before the kill(), it can reach the qui-domains to emit the domain-start-failed notification.

# This avoids losing the exception if an exception is
# raised in self.kill(), because the vm is not
# running or paused
try:
await self.kill()
except qubes.exc.QubesVMNotStartedError:
pass

# let anyone receiving domain-pre-start know that startup failed
await self.fire_event_async(
"domain-start-failed", reason=str(exc)
)
raise

return self
Expand Down