Overview
VMInfo is a Pydantic model that contains runtime information about a VM, including its current state, configuration, network details, and process information.
Schema
Attributes
The VM identifier.
Current lifecycle state. One of:
VMState.CREATED: VM created but not startedVMState.RUNNING: VM is runningVMState.STOPPED: VM has been stoppedVMState.ERROR: VM is in an error state
The VM configuration used to create this VM.
Network configuration for the VM.
None if networking is not configured.Contains:guest_ip: IP address assigned to the guestgateway_ip: Gateway IP (host side of TAP)netmask: Network masktap_device: Name of the TAP deviceguest_mac: MAC address for the guest interfacessh_host_port: Optional host TCP port forwarded to guest SSH (22)
Process ID of the VM runtime process (Firecracker or QEMU).
None when VM is not running.Path to the Firecracker API socket.
None for QEMU backend or when VM is not running.VMState Enum
TheVMState enum represents the VM lifecycle:
State Transitions
NetworkConfig Details
Whennetwork is present, it contains the following fields:
IP address assigned to the guest (e.g.,
"172.16.0.10" for Firecracker, "10.0.2.15" for QEMU).Gateway IP address (host side of TAP).
Network mask.
Name of the TAP device (e.g.,
"tap10") or "usernet" for QEMU user networking.MAC address for the guest interface (e.g.,
"02:FC:00:00:00:0A").Host TCP port forwarded to guest SSH port 22. Used for
ssh -p <port> user@localhost.Examples
Immutability
VMInfo is frozen (immutable) after creation. The state is managed internally by SmolVMManager or SmolVM.
To get updated information, call:
SmolVM.refresh()(updates cached info)SmolVMManager.get(vm_id)(queries state from database)
Type Annotations
For type checking:Accessing Nested Configuration
SinceVMInfo contains the full VMConfig, you can access all configuration details: