VM Configuration API
Complete guide to modifying VM configurations in VergeOS, including CPU/RAM updates, notes, drive management, and network interface management
This guide covers modifying virtual machine configurations in VergeOS after creation, including CPU/RAM updates, drive management, network interface changes, and adding operational notes.
Stage: VM Configuration (3 of 4) Input: VM key (42) + Machine key (54), configuration changes Output: Updated VM settings, modified hardware Previous: VM powered on → VM Power Management Common Next Steps:
Advanced operations →
VM Advanced OperationsPower cycle for changes →
VM Power Management
This Document Helps With
"How to change VM CPU and RAM"
"Adding storage drives to existing VMs"
"Resizing VM drives and storage"
"Managing VM network interfaces"
"Adding notes and documentation to VMs"
"Hotplug operations and live changes"
"VM performance tuning"
"Storage expansion workflows"
"Network reconfiguration"
Quick Reference
Primary Endpoints
VM Settings:
PUT /api/v4/vms/{id}VM Notes:
POST /api/v4/note_actionsDrive Management:
POST/PUT/DELETE /api/v4/machine_drivesNIC Management:
POST/PUT/DELETE /api/v4/machine_nics
Key Concepts
VM key: Use for VM settings (CPU, RAM, console)
Machine key: Use for hardware (drives, NICs, devices)
Hotplug: Some changes require VM restart
Authentication
Prerequisites
VM must be created first → See VM Creation
API Quick Reference
Update VM
PUT
/api/v4/vms/{id}
VM key
CPU, RAM, console settings
Add Note
POST
/api/v4/note_actions
VM key
Documentation
Add Drive
POST
/api/v4/machine_drives
Machine key
Storage expansion
Resize Drive
PUT
/api/v4/machine_drives/{id}
Drive key
Increase disk size
Remove Drive
DELETE
/api/v4/machine_drives/{id}
Drive key
Storage removal
Add NIC
POST
/api/v4/machine_nics
Machine key
Network interface
Update NIC
PUT
/api/v4/machine_nics/{id}
NIC key
Network changes
Remove NIC
DELETE
/api/v4/machine_nics/{id}
NIC key
Interface removal
Troubleshooting Index
400 Bad Request: Invalid RAM size, invalid CPU count, malformed JSON
409 Conflict: VM must be stopped, hotplug not supported, resource in use
507 Insufficient Storage: Tier full, disk size too large, quota exceeded
403 Forbidden: API key permissions, VM access denied, cluster restrictions
422 Unprocessable Entity: Drive cannot be shrunk, invalid interface type
404 Not Found: VM not found, drive not found, NIC not found, invalid vnet
CPU and RAM Updates
PUT /api/v4/vms/{id}
Description: Updates VM configuration. Uses the VM key (not machine key) for VM-level settings.
Request Body Example:
Complete API Call:
Common Configuration Parameters
ram
integer
RAM in MB
Usually yes
cpu_cores
integer
Number of CPU cores
Usually yes
console
string
Console type (spice, vnc, none)
On next start
video
string
Video adapter (qxl, virtio, std, cirrus)
On next start
nested_virtualization
string
Enable nested virtualization ("true"/"false")
Yes
disable_hypervisor
string
Disable hypervisor ("true"/"false")
Yes
guest_agent
string
Enable guest agent ("true"/"false")
On next start
uefi
string
Enable UEFI boot ("true"/"false")
Yes
secure_boot
string
Enable secure boot ("true"/"false")
Yes
VM Key vs Machine Key
VM settings (CPU, RAM, console, video): Use VM key (e.g.,
42) with/api/v4/vms/{vm_key}Hardware changes (drives, NICs, devices): Use machine key (e.g.,
54) with/api/v4/machine_*endpoints
Configuration Changes
CPU and RAM changes usually require VM restart
Console and video changes take effect on next VM start
Nested virtualization and hypervisor settings require VM restart
Always check
allow_hotplugsetting for hot-add capabilities
Adding Notes to VMs
POST /api/v4/note_actions
Description: Adds or updates notes for a VM in the VergeOS UI for documentation purposes.
Request Body:
Complete API Call:
Parameters:
owner
string
Yes
Resource identifier (format: "vms/{vm_key}")
action
string
Yes
Action to perform ("update")
params.text
string
Yes
Note text content
VM Notes
Notes are visible in the VergeOS UI and help with VM documentation, maintenance schedules, or configuration details. Use the VM key (not machine key) in the owner field.
Drive Management
Adding New Drives
Use the machine drives endpoint to add storage after VM creation:
POST /api/v4/machine_drives
Complete API Call:
Resizing Drives
PUT /api/v4/machine_drives/{drive_id}
Description: Increases the size of an existing drive. Note that drives can only be expanded, not shrunk.
Complete API Call:
Drive Resizing
Drives can only be expanded, never shrunk
The guest OS may need to be configured to recognize the new size
Some file systems require manual expansion after drive resize
Removing Drives
Before deletion, drives must be hot-unplugged if the VM is running:
Step 1: Hot-Unplug Drive (if VM is running)
Step 2: Delete the Drive
DELETE /api/v4/machine_drives/{drive_id}
Drive Management Examples
Adding a CDROM/ISO
Adding an Import Drive
Network Interface Management
Adding NICs
POST /api/v4/machine_nics
Complete API Call:
Updating NIC Configuration
PUT /api/v4/machine_nics/{nic_id}
Complete API Call:
Removing NICs
DELETE /api/v4/machine_nics/{nic_id}
NIC Configuration Parameters
machine
string
Yes
Machine ID
vnet
string
Yes
Virtual network ID
name
string
No
NIC name
interface
string
No
NIC interface type (virtio, e1000, rtl8139)
enabled
boolean
No
NIC enabled state
Complete Configuration Workflow
Here's an example of updating a VM's complete configuration:
Configuration Best Practices
Before Making Changes
Check VM Status: Ensure VM is in appropriate state for changes
Backup Important Data: Create snapshots before major changes
Review Dependencies: Consider impact on running applications
Plan Downtime: Some changes require VM restart
After Making Changes
Verify Configuration: Check that changes were applied correctly
Test Functionality: Ensure VM operates as expected
Update Documentation: Add notes about configuration changes
Monitor Performance: Watch for any performance impacts
Hotplug Considerations
Hotplug Support
The allow_hotplug setting enables hot-adding and hot-removing drives and NICs while the VM is running:
Drives: Can be added/removed on the fly (guest OS must support it; Virtio-SCSI recommended)
NICs: Can be added/removed on the fly (widely supported by guest operating systems)
CPU/RAM: Changes always require a VM power cycle
See VM Hot-Plug Capabilities for complete details.
Error Handling
Common Configuration Errors
Error: 400 Bad Request - Invalid RAM size
Error: 409 Conflict - VM must be stopped
Solution: Stop the VM or check hotplug capabilities before making changes.
Error: 507 Insufficient Storage
Solution: Choose different storage tier or reduce disk size.
Last updated
Was this helpful?