Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/stratosphere-ve/ozone/llms.txt

Use this file to discover all available pages before exploring further.

The qemu package provides the runtime lifecycle interface for Ozone-managed virtual machines. It wraps qemu-system-x86_64 invocations and process control behind two simple Go functions — Start and Stop — so that callers never need to construct raw command strings or manage process handles directly.
import "github.com/stratosphere-ve/ozone/qemu"

qemu.Start()

func Start()
Start launches an interactive prompt asking for the name of the VM to start, then reads the corresponding configuration from vms/<vmname>.json via vmparser.VMParser. If the config file cannot be read, the function prints an error message and returns early. On success, it prints the loaded VM info struct to stdout and spawns a qemu-system-x86_64 subprocess with the following fixed command-line flags:
FlagValuePurpose
-machineq35Selects the Q35 chipset (PCIe, IOMMU-capable)
-m(empty string)Guest memory argument — sourced from the package-level memsize variable, which is initialized to ""
-smp4Configures 4 symmetric multi-processing vCPUs
-drivefile=myvm.qcow2,format=qcow2Attaches the primary qcow2 disk image
-cdromdebian.isoAttaches a Debian installer ISO as a virtual CD-ROM
-bootdSets boot order to CD-ROM first
-qmptcp:127.0.0.1:4444,server,nowaitOpens a QMP control socket on localhost port 4444
The full assembled command is:
qemu-system-x86_64 \
  -machine q35 \
  -m "" \
  -smp 4 \
  -drive file=myvm.qcow2,format=qcow2 \
  -cdrom debian.iso \
  -boot d \
  -qmp tcp:127.0.0.1:4444,server,nowait
Any output from the QEMU process is captured and printed to stdout. If the subprocess exits with a non-zero status, the error is printed but execution continues. Start has no return value.
The package-level variable memsize is declared as var memsize string = "" and is not read from any configuration file. As a result, the -m flag is passed with an empty string value in the current implementation.
For a comprehensive reference on all qemu-system-x86_64 command-line options — including alternative machine types, CPU models, network backends, and display drivers — see the QEMU Options page on the Gentoo Wiki.

qemu.Stop()

func Stop()
Stop prints "stopping qemu" to stdout and then runs system_powerdown as a local subprocess via exec.Command. Any output from the process is captured and printed to stdout. If the command exits with a non-zero status, the error is printed to stdout. Stop has no return value.
Stop does not send a QMP command to the running VM. It calls exec.Command("system_powerdown") as a standalone local process. Ensure that system_powerdown is present and executable in your PATH for this function to work as intended.

Build docs developers (and LLMs) love