main: add --no-shutdown

Add a CLI-only --no-shutdown flag that keeps the VMM process alive
after a guest-triggered shutdown.

Management software may still need the Cloud Hypervisor process
after the guest has powered off. Exposing this separately lets
management software, for example libvirt, keep the VMM around in a
way that is closer to QEMU.

The flag only affects the GuestExit path. Fatal exits and other
existing VMM shutdown paths remain unchanged.

On-behalf-of: SAP leander.kohler@sap.com
Signed-off-by: Leander Kohler <leander.kohler@cyberus-technology.de>
This commit is contained in:
Leander Kohler
2026-03-09 16:35:34 +01:00
committed by Rob Bradford
parent a159152e41
commit 005ce38ffd
2 changed files with 24 additions and 3 deletions

View File

@@ -373,6 +373,12 @@ fn get_cli_options_sorted(
.num_args(1..)
.action(ArgAction::Append)
.group("vm-config"),
Arg::new("no-shutdown")
.long("no-shutdown")
.help("Do not exit the VMM when the guest shuts down")
.num_args(0)
.action(ArgAction::SetTrue)
.group("vmm-config"),
Arg::new("numa")
.long("numa")
.help(NumaConfig::SYNTAX)
@@ -637,6 +643,7 @@ fn start_vmm(
let exit_evt = EventFd::new(EFD_NONBLOCK).map_err(Error::CreateExitEventFd)?;
let landlock_enable = cmd_arguments.get_flag("landlock");
let no_shutdown = cmd_arguments.get_flag("no-shutdown");
#[allow(unused_mut)]
let mut event_monitor = cmd_arguments
@@ -733,6 +740,7 @@ fn start_vmm(
exit_evt.try_clone().unwrap(),
&seccomp_action,
hypervisor,
no_shutdown,
landlock_enable,
)
.map_err(Error::StartVmmThread)?;