session

package
v0.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package session is the virtle CLI's session layer over the qemu VM machinery: boot with CLI semantics, run the foreground session (the ssh-ready gate, the interactive SSH attach loop with autoprovision and retries, suspend-on-signal, stats), and the out-of-process suspend and hotplug commands.

It lives under backend/qemu because today's session implementation is qemu-machinery-bound (vsock SSH destinations, chardev readiness sockets, QMP-migration suspend), and it is deliberately transitional scaffolding: most of it is QGA-era plumbing that the virtle guest daemon (design D9) deletes — readiness becomes the daemon handshake, autoprovision becomes a host-pushed key at boot, and the residual foreground loop moves onto the public backend API. Keep this surface minimal; it is not a designed session API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExitCode

func ExitCode(err error) int

ExitCode maps session errors onto CLI exit codes.

func Hotplug

func Hotplug(ctx context.Context, mf *manifest.Manifest, id string, detach bool) error

Hotplug attaches or detaches a manifest-declared hotplug device on a running session, over the control socket.

func Run

func Run(ctx context.Context, mf *manifest.Manifest, opts Options) error

Run boots the VM with CLI semantics (resume modes, --ssh preflight validation, process signal handlers) and runs the foreground session to completion. A session that ends in a saved suspend reports success.

func Suspend

func Suspend(ctx context.Context, mf *manifest.Manifest) error

Suspend suspends a running session out-of-process: over the control socket, falling back to signalling the launch process.

Types

type Options

type Options struct {
	Resume        string   // resume mode: "no", "auto", "force"; default "no"
	SSH           bool     // attach the interactive SSH session loop
	RemoteCommand []string // remote command for the SSH session

	Logger *slog.Logger // default: discard
}

Options configures a CLI session.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL