For the complete documentation index, see llms.txt. This page is also available as Markdown.

VM Advanced Operations API

Complete guide to advanced VM operations in VergeOS, including cloning, snapshots, deletion, and troubleshooting

Key Points

  • Clone VMs with complete configuration and drive copying

  • Create and restore VM snapshots for backup and recovery

  • Safely delete VMs with automatic resource cleanup

  • Comprehensive error handling and troubleshooting guidance

This guide covers advanced virtual machine operations in VergeOS, including cloning, snapshot management, deletion, and troubleshooting. These operations provide powerful capabilities for VM lifecycle management and disaster recovery.

Stage: VM Advanced Operations (4 of 4) Input: VM key (42), operation type, parameters Output: Cloned VMs, snapshots, cleanup confirmation Previous: VM configured → VM Configuration Common Operations:

  • Clone for templates → New VM creation cycle

  • Snapshot for backup → Recovery workflows

  • Delete for cleanup → End of lifecycle

This Document Helps With

  • "How to clone VMs via API"

  • "Creating VM snapshots and backups"

  • "Restoring VMs from snapshots"

  • "Safely deleting VMs and cleanup"

  • "VM troubleshooting and diagnostics"

  • "Template creation workflows"

  • "Disaster recovery operations"

  • "Bulk VM management"

  • "Resource cleanup automation"

Quick Reference

Primary Endpoints

  • VM Actions: POST /api/v4/vm_actions

  • VM Deletion: DELETE /api/v4/vms/{vm_key}

  • VM Listing: GET /api/v4/vms

Key Actions

  • clone: Create complete VM copy

  • snapshot: Create VM snapshot

  • restore: Restore from snapshot

Authentication

Prerequisites

VM must exist → See VM Creation

API Quick Reference

Operation
Method
Endpoint
Key Type
Purpose

Clone VM

POST

/api/v4/vm_actions

VM key

Create complete copy

Create Snapshot

POST

/api/v4/vm_actions

VM key

Point-in-time backup

Restore Snapshot

POST

/api/v4/vm_actions

VM key

Recovery operation

List Snapshots

GET

/api/v4/vms

Filter query

Find snapshots

Delete VM

DELETE

/api/v4/vms/{id}

VM key

Complete removal

VM Status

GET

/api/v4/vms/{id}

VM key

Configuration check

Operation Status

GET

/api/v4/machine_status/{id}

Machine key

Runtime monitoring

Troubleshooting Index

  • 409 Conflict: Clone name exists, VM already running, operation in progress

  • 507 Insufficient Storage: Not enough space for clone, snapshot storage full

  • 403 Forbidden: API key permissions, VM access denied, cluster restrictions

  • 404 Not Found: VM not found, snapshot not found, invalid VM key

  • 408 Request Timeout: Clone operation timeout, snapshot creation timeout

  • 422 Unprocessable Entity: Invalid clone parameters, snapshot restore conflict

  • 500 Internal Server Error: Storage system issues, hypervisor problems, cluster failures

VM Cloning

POST /api/v4/vm_actions

Description: Creates a complete copy of a VM including all drives and configuration.

Basic Clone

Complete API Call:

Response Example:

Advanced Clone Options

Clone Parameters

Parameter
Type
Required
Description

name

string

Yes

Name for the cloned VM

description

string

No

Description for the clone

quiesce

string

No

Quiesce VM before cloning ("true"/"false") for data consistency

preserve_macs

string

No

Preserve MAC addresses ("true"/"false")

preserve_device_uuids

string

No

Preserve device UUIDs ("true"/"false")

cluster

string

No

Target cluster ID

Clone Workflow Example

VM Snapshots

Creating Snapshots

Complete API Call:

Restoring from Snapshots

Complete API Call:

Listing VM Snapshots

GET /api/v4/vms

Use filters to find snapshots:

Find All Snapshots for a VM:

Snapshot Management Workflow

VM Deletion and Cleanup

Complete VM Deletion

DELETE /api/v4/vms/{vm_key}

Description: Deletes a VM and automatically removes all associated resources including drives, NICs, devices, and configurations.

Response: 200 OK on successful deletion.

Pre-Deletion Considerations

Before deleting a VM, consider:

  1. Data Backup: Ensure important data is backed up

  2. Snapshots: VM snapshots may be deleted with the VM

  3. Dependencies: Check if other systems depend on this VM

  4. Network Configuration: Note any special network configurations

  5. Licensing: Consider software licensing implications

Safe Deletion Process

Step 2: Verify Power State

Step 3: Create Final Backup (Optional)

Step 4: Delete VM and All Resources

No Manual Cleanup Required

Unlike some virtualization platforms, VergeOS handles complete resource cleanup automatically. You do not need to manually:

  • Delete individual drives

  • Remove network interfaces

  • Detach devices

  • Clean up configuration files

  • Remove machine status entries

The single DELETE /api/v4/vms/{vm_key} operation handles all cleanup automatically.

Finding Orphaned Resources

Error Handling and Troubleshooting

Common Error Scenarios

VM Creation Failures

Error: 400 Bad Request - Invalid machine type

Solution: Use valid machine types from the supported list.

Power State Conflicts

Error: 409 Conflict - VM already running

Solution: Check current power state before issuing power commands.

Resource Constraints

Error: 507 Insufficient Storage

Solution: Choose different storage tier or reduce disk size.

Clone Failures

Error: 409 Conflict - Clone name already exists

Solution: Use unique names for cloned VMs.

Monitoring VM Operations

Checking Operation Status

Many VM operations are asynchronous. Monitor progress using:

Operation Timeouts

Set appropriate timeouts for long-running operations:

  • VM Creation: 5-10 minutes

  • Clone Operations: 10-30 minutes (depending on size)

  • Snapshot Creation: 2-5 minutes

  • Snapshot Restore: 5-15 minutes

  • Power State Changes: 30-60 seconds

  • VM Deletion: 2-5 minutes

Retry Logic

Implement retry logic for transient failures:

Debugging VM Issues

Check VM Configuration

Check Machine Status

Check System Resources

Best Practices

  1. Always test operations in development environments first

  2. Create snapshots before major changes

  3. Monitor resource usage during operations

  4. Implement proper error handling in automation scripts

  5. Use descriptive names for clones and snapshots

  6. Clean up unused resources regularly

  7. Document operational procedures for your team

Related Operations

Need Help?

For additional support with VM advanced operations:

  • Check the VergeOS documentation portal

  • Contact VergeOS support with specific error messages

  • Review system logs for detailed error information

  • Consult the VergeOS community forums

Last updated

Was this helpful?