In this guide you will install the Ozone library, create a JSON VM configuration file, parse it with theDocumentation 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.
vmparser package, and boot your first QEMU virtual machine using qemu.Start() — all from a single Go program.
Prerequisites
Before you begin, make sure the following tools are installed on your system:The Ozone module path is
- Go 1.21 or later — Download Go
qemu-system-x86_64— Install via your system’s package manager, for example:
github.com/stratosphere-ve/ozone. Your own module must be initialised with go mod init before adding Ozone as a dependency.Install Ozone
Add Ozone to your Go module:This fetches both the
qemu and vmparser packages and records the dependency in your go.mod and go.sum files.Create a VM config file
Ozone reads VM definitions from JSON files stored in a Save this file as
vms/ directory relative to your working directory. Create the directory and add a config file for your first VM:vms/myvm.json. The file name without the .json extension is the VM name you will pass to vmparser.VMParser.Parse the VM config
Use
vmparser.VMParser to load the full VM definition into a strongly-typed *vmparser.VM struct:VMParser constructs the file path as vms/<vmname>.json and unmarshals the JSON into the VM struct, which contains nested VMInfo, CPU, Memory, Network, and Disk fields.Start the VM
Call Run your program:You will see the prompt:Type your VM name (e.g.
qemu.Start() to boot the virtual machine. The function prompts you for the VM name via stdin, parses its config with vmparser.VMParser, and launches qemu-system-x86_64 with the q35 machine type, four vCPUs (-smp 4), and a QMP socket on port 4444:myvm) and press Enter. Ozone will parse vms/myvm.json, print the resolved VM struct, and execute the QEMU process.qemu.Start() reads the VM name interactively from standard input using fmt.Scanln. If you need non-interactive or programmatic startup, call vmparser.VMParser directly with your VM name and construct the exec.Command yourself based on the returned config.Next Steps
Now that your first VM is running, explore the rest of the Ozone documentation:- VM Configuration — Learn every field in the VM JSON schema and how the per-resource writer functions (
VMParserWriterCPU,VMParserWriterMemory, etc.) let you update config files in place. - QEMU Management — Understand how
qemu.Stop()runssystem_powerdownand how Ozone exposes a QMP socket for communicating with a running VM. - API Reference — Full reference for all exported functions and types in the
qemuandvmparserpackages.