# VM Configuration Contracts # # Type definitions for VM lifecycle management # Migrated from provisioning/kcl/vm.k { VmPortMapping = { host_port | Number, guest_port | Number, protocol | [| 'tcp, 'udp |] | optional | default = 'tcp, bind_addr | String | optional, }, VmNetwork = { name | String | default = "default", type | [| 'bridge, 'nat, 'host |] | default = 'nat, subnet | String | optional, }, VmMount = { host_path | String, guest_path | String, readonly | Bool | default = false, mode | String | optional, }, VmVolume = { name | String, size_gb | Number, mount_path | String | optional, format | [| 'qcow2, 'raw |] | default = 'qcow2, }, VmCloudInit = { enabled | Bool | default = true, user_data | String | optional, meta_data | String | optional, vendor_data | String | optional, }, VmConfig = { name | String, description | String | optional, base_image | String | default = "ubuntu-22.04", cpu | Number | default = 2, memory_mb | Number | default = 4096, disk_gb | Number | default = 20, backend | [| 'libvirt, 'qemu, 'docker_vm |] | default = 'libvirt, permanent | Bool | default = false, temporary | Bool | default = false, auto_cleanup | Bool | default = false, auto_cleanup_hours | Number | optional, taskserv | String | optional, taskservs | Array String | default = [], network_mode | [| 'bridge, 'nat, 'host |] | default = 'bridge, networks | Array VmNetwork | optional, ports | Array VmPortMapping | optional, mounts | Array VmMount | optional, volumes | Array VmVolume | optional, cloud_init | VmCloudInit | optional, nested_virt | Bool | optional | default = false, graphics_enable | Bool | optional | default = false, serial_console | Bool | optional | default = true, }, VmImage = { name | String, format | [| 'qcow2, 'raw, 'vmdk |] | default = 'qcow2, path | String, size_gb | Number, base_os | [| 'ubuntu, 'debian, 'rocky, 'arch |] | default = 'ubuntu, os_version | String | default = "22.04", }, VmState = { vm_name | String, state | [| 'stopped, 'starting, 'running, 'stopping, 'error |] | default = 'stopped, permanent | Bool, created_at | String, started_at | String | optional, last_action | String | optional, auto_cleanup_at | String | optional, ip_address | String | optional, mac_address | String | optional, hypervisor | String | optional, backend_id | String | optional, }, VmRegistry = { vms | Array VmState, permanent_count | Number, temporary_count | Number, updated_at | String, }, VmCapacity = { host_name | String, total_cpu_cores | Number, used_cpu_cores | Number, total_memory_mb | Number, used_memory_mb | Number, total_disk_gb | Number, used_disk_gb | Number, max_vms | Number, running_vms | Number, }, }