virt.qemu #
tips
openrc as used on alpine
- maybe better not to use, is too complicated
- https://github.com/OpenRC/openrc/blob/master/service-script-guide.md
fn new #
fn new() !QemuFactory
enum TemplateName #
enum TemplateName {
ubuntu
alpine
arch
}
enum VMStatus #
enum VMStatus {
unknown
running
stopped
}
struct ActionArgs #
@[params]
struct ActionArgs {
pub:
force bool
}
struct QemuFactory #
@[heap]
struct QemuFactory {
pub mut:
debug bool
}
fn (QemuFactory) vm_delete #
fn (mut lf QemuFactory) vm_delete(name string) !
fn (QemuFactory) vm_delete_all #
fn (mut lf QemuFactory) vm_delete_all() !
fn (QemuFactory) vm_exists #
fn (mut lf QemuFactory) vm_exists(name string) !bool
fn (QemuFactory) vm_get #
fn (mut lf QemuFactory) vm_get(name string) !VM
fn (QemuFactory) vm_get_all #
fn (mut lf QemuFactory) vm_get_all() ![]VM
fn (QemuFactory) vm_list #
fn (mut lf QemuFactory) vm_list() ![]string
fn (QemuFactory) vm_new #
fn (mut lf QemuFactory) vm_new(args VMNewArgs) !VM
valid template names: .alpine,.arch .
fn (QemuFactory) vm_stop #
fn (mut lf QemuFactory) vm_stop(name string) !
fn (QemuFactory) vm_stop_all #
fn (mut lf QemuFactory) vm_stop_all() !
struct VM #
@[heap]
struct VM {
pub mut:
name string
status VMStatus
dir string
arch string
cpus int
memory i64
disk i64
ssh_local_port int
// host_agent_pid int [json: hostAgentPID]
// driver_pid int [json: driverPID]
ssh_address string
// qemu_home string [json: QemuHome]
identity_file string @[json: IdentityFile]
factory &QemuFactory @[skip; str: skip]
}
fn (VM) load #
fn (mut vm VM) load(args ActionArgs) !
fn (VM) stop #
fn (mut vm VM) stop(args ActionArgs) !
fn (VM) start #
fn (mut vm VM) start(args ActionArgs) !
fn (VM) delete #
fn (mut vm VM) delete(args ActionArgs) !
fn (VM) install_crystal #
fn (mut vm VM) install_crystal() !
struct VMNewArgs #
@[params]
struct VMNewArgs {
pub mut:
name string = 'default'
template TemplateName
cpus int = 8
memory i64 = 2000 // in MB
disk i64 = 20000 // in MB
reset bool
start bool = true
install_crystal bool // if you want crystal to be installed
install_hero bool
}