talos/pkg/provision/providers/vm/controller.go
Utku Ozdemir bed2bd414e
feat: add graceful power off support to QEMU VM launcher
The QEMU VM launcher's /poweroff HTTP endpoint now accepts an optional grace-period query parameter (Go duration format, e.g. "5m"). When set, it sends an ACPI power button event via the QEMU monitor socket instead of immediately killing the process, allowing the guest OS to shut down cleanly. If the guest does not shut down within the grace period, the process is force-killed as a fallback.

Without the parameter, the behavior is unchanged (immediate kill).

Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
2026-03-26 16:57:24 +01:00

23 lines
572 B
Go

// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
package vm
import "time"
// Controller interface should be implemented by the VM to be controlled via the API.
type Controller interface {
PowerOn() error
PowerOff() error
PowerOffWithGracePeriod(gracePeriod time.Duration) error
Reboot() error
PXEBootOnce() error
Status() Status
}
// Status describes current VM status.
type Status struct {
PoweredOn bool
}