Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Qemu hang silently on failed boot #734

Merged
merged 2 commits into from
Jan 6, 2025
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
1 change: 1 addition & 0 deletions src/aleph/vm/controllers/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def parse_args(args):
help="set loglevel to DEBUG",
action="store_const",
const=logging.DEBUG,
default=logging.INFO,
)
return parser.parse_args(args)

Expand Down
7 changes: 7 additions & 0 deletions src/aleph/vm/hypervisors/qemu/qemuvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,13 @@ async def start(
# Tell to put the output to std fd, so we can include them in the log
"-serial",
"stdio",
# nographics. Seems redundant with -serial stdio but without it the boot process is not displayed on stdout
"-nographic",
# Boot
# order=c only first hard drive
# reboot-timeout in combination with -no-reboot, makes it so qemu stop if there is no bootable device
"-boot",
"order=c,reboot-timeout=1",
# Uncomment for debug
# "-serial", "telnet:localhost:4321,server,nowait",
# "-snapshot", # Do not save anything to disk
Expand Down
12 changes: 9 additions & 3 deletions src/aleph/vm/hypervisors/qemu_confidential/qemuvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,18 @@ async def start(
"-qmp",
f"unix:{self.qmp_socket_path},server,nowait",
# Tell to put the output to std fd, so we can include them in the log
"-nographic",
"-serial",
"stdio",
"--no-reboot", # Rebooting from inside the VM shuts down the machine
"-S",
# nographics. Seems redundant with -serial stdio but without it the boot process is not displayed on stdout
"-nographic",
# Boot
# order=c only first hard drive
# reboot-timeout in combination with -no-reboot, makes it so qemu stop if there is no bootable device
"-boot",
"order=c,reboot-timeout=1",
# Confidential options
# Do not start CPU at startup, we will start it via QMP after injecting the secret
"-S",
"-object",
f"sev-guest,id=sev0,policy={self.sev_policy},cbitpos={sev_info.c_bit_position},"
f"reduced-phys-bits={sev_info.phys_addr_reduction},"
Expand Down
Loading