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.

qemu.Start() is Ozone’s entry point for launching a virtual machine. It interactively prompts for a VM name, reads the corresponding JSON configuration through vmparser.VMParser, and then spawns a qemu-system-x86_64 process with a fixed set of hardware flags — including Q35 machine type, a QCow2 disk image, a Debian ISO as the optical drive, and a QMP control socket bound to 127.0.0.1:4444.

Usage

import "github.com/stratosphere-ve/ozone/qemu"

func main() {
    qemu.Start()
}

QEMU Flags

When Start() builds the qemu-system-x86_64 command it passes the following flags in order:
FlagValuePurpose
-machineq35Use the Q35 chipset (PCIe, AHCI, modern BIOS)
-m"" (empty string)Amount of RAM to allocate to the guest
-smp4Expose 4 virtual CPUs to the guest
-drivefile=myvm.qcow2,format=qcow2Attach the primary disk in QCow2 format
-cdromdebian.isoMount debian.iso as the optical drive
-bootdSet the boot order to CD-ROM first
-qmptcp:127.0.0.1:4444,server,nowaitExpose the QEMU Machine Protocol over TCP
The -m flag is sourced from the package-level variable memsize, which is initialized to an empty string (""). This means memory size is not yet wired to the VM configuration loaded by vmparser. The VM config is read and printed, but its fields are not currently used to populate the QEMU command. Until memsize is set, QEMU will receive an empty value for -m and may fail to start.
The QMP socket listens on 127.0.0.1:4444 for the lifetime of the VM process. You can connect any QMP-compatible client (e.g. socat or a custom Go client) to this address for machine introspection, query commands, and live control without stopping the guest. Note that qemu.Stop() does not use this socket — it operates independently.
qemu-system-x86_64 must be installed on the host and available on the system PATH. On Debian/Ubuntu systems you can install it with apt install qemu-system-x86. If the binary is missing, exec.Command will return an error and Start() will print it and return without launching the VM.

Startup Sequence

1

Prompt for VM name

Start() prints "What VM would you like to start?" to stdout and then calls fmt.Scanln to read a single token from stdin into the vmname variable. The function blocks here until the user presses Enter.
2

Load VM configuration

The name is passed to vmparser.VMParser(vmname), which reads the JSON file for that VM and returns a populated config struct. If the file cannot be read or parsed, an error is printed and Start() returns immediately without launching QEMU. On success, the parsed config is printed via fmt.Printf("VM info: %+v\n", vmInfo) — however, the config fields are not yet used to build the QEMU command.
3

Build the QEMU command

exec.Command assembles the qemu-system-x86_64 invocation with all flags listed in the table above. The -m value comes from the package-level memsize variable, which is currently an empty string and is not populated from the loaded VM config.
4

Execute and capture output

cmd.Output() runs the process and captures its stdout. Any execution error is printed via fmt.Printf. On success the captured output is printed to stdout.

Build docs developers (and LLMs) love