Overview
VMState is a string-based enumeration that represents the lifecycle state of a SmolVM instance. The state is tracked in the database and can be queried via the vm.status property or VMInfo.status.
States
| State | Value | Description |
|---|---|---|
CREATED | "created" | VM has been registered but not yet started. The Firecracker process is not running. |
RUNNING | "running" | VM is actively running. The Firecracker process is alive and the guest is booted. |
STOPPED | "stopped" | VM has been explicitly stopped. The Firecracker process has terminated cleanly. |
ERROR | "error" | VM encountered an error during startup or operation. Check logs for details. |
State Transitions
The typical VM lifecycle follows this flow:- CREATED → RUNNING: When
vm.start()is called - RUNNING → STOPPED: When
vm.stop()is called or the VM shuts down cleanly - CREATED/RUNNING → ERROR: When startup fails or the Firecracker process crashes unexpectedly
Usage Examples
Checking VM State
Querying State from VMInfo
Conditional Logic Based on State
State Filtering with Manager
Enum String Values
Type Information
VMState is a str enum, inheriting from both str and Enum. This means:
Error State Handling
When a VM enters theERROR state:
- The Firecracker process may have crashed
- Startup may have failed (e.g., kernel panic, invalid configuration)
- Network setup may have failed
Related
- SmolVM API - VM lifecycle methods including start() and stop()
- VMInfo - Complete VM runtime information including state