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

VM Power Management API

Complete guide to managing VM power states in VergeOS, including starting, stopping, rebooting, and monitoring power status

Key Points

  • Control VM power states through REST API endpoints

  • Support for graceful and forced power operations

  • Monitor VM power state and runtime status

  • Understand VM key vs Machine key for different status checks

This guide covers managing virtual machine power states in VergeOS, including starting, stopping, rebooting, and monitoring VMs. The VergeOS API provides comprehensive power management capabilities with both graceful and forced operations.

Stage: VM Power Management (2 of 4) Input: VM key (42) from creation, power operation type Output: Power state changes, runtime status Previous: VM created → VM Creation Common Next Steps:

This Document Helps With

  • "How to start/stop VMs via API"

  • "Checking VM power status"

  • "Graceful vs forced VM shutdown"

  • "VM reboot and reset operations"

  • "Monitoring VM power state"

  • "Power management automation"

  • "VM startup troubleshooting"

  • "Scheduled power operations"

  • "Resource optimization through power control"

Quick Reference

Primary Endpoints

  • Power Actions: POST /api/v4/vm_actions

  • VM Status: GET /api/v4/vms/{id}

  • Power State: GET /api/v4/machine_status/{machine_id}

Key Actions

  • poweron: Start VM

  • poweroff: Graceful shutdown (ACPI)

  • kill: Force power off

  • reset: Reboot VM

Authentication

Prerequisites

VM must be created first → See VM Creation

API Quick Reference

Operation
Method
Endpoint
Key Type
Purpose

Power On

POST

/api/v4/vm_actions

VM key

Start virtual machine

Power Off

POST

/api/v4/vm_actions

VM key

Graceful shutdown (ACPI)

Force Off

POST

/api/v4/vm_actions

VM key

Immediate termination

Reboot

POST

/api/v4/vm_actions

VM key

Restart VM

VM Info

GET

/api/v4/vms/{id}

VM key

Configuration data

Power State

GET

/api/v4/machine_status/{id}

Machine key

Runtime status

Troubleshooting Index

  • 409 Conflict: VM already running, VM not running, power state mismatch

  • 507 Insufficient Resources: Not enough cluster resources, memory/CPU unavailable

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

  • 404 Not Found: Invalid VM key, VM deleted, machine key not found

  • 408 Request Timeout: Power operation timeout, VM unresponsive, cluster communication failure

  • 500 Internal Server Error: Hypervisor issues, node problems, storage failures

Starting VMs

POST /api/v4/vm_actions

Description: Powers on a virtual machine and waits for it to reach running state.

Power On Request:

Complete API Call:

Response: 201 Created when action is initiated.

Stopping VMs

Graceful Power Off (ACPI)

Description: Sends an ACPI shutdown signal to the guest operating system, allowing it to shut down cleanly.

Complete API Call:

Force Power Off (Kill)

Description: Immediately terminates the VM without allowing the guest OS to shut down cleanly. Use only when graceful shutdown fails.

Complete API Call:

Rebooting VMs

Graceful Reboot (ACPI)

Description: Sends an ACPI reset signal to the guest operating system for a clean restart.

Complete API Call:

Hard Reset (Power Cycle)

Description: Immediately restarts the VM without allowing the guest OS to shut down cleanly.

Complete API Call:

VM Status and Information

GET /api/v4/vms/{id}

Description: Retrieves VM configuration and metadata using various field filters.

Get Complete VM Information:

Response Example:

VM Power State and Runtime Status

GET /api/v4/machine_status/{machine_id}

Description: Retrieves the actual runtime status and power state of a VM using the machine key.

Check VM Power State:

Stopped VM Response Example

Running VM Response Example

Power State Monitoring

Checking Power State Only

For quick power state checks, you can request specific fields:

Response:

Monitoring Power State Changes

Common Power Management Workflows

Safe VM Shutdown Workflow

VM Restart Workflow

Error Handling

Common Power Management Errors

Error: 409 Conflict - VM already running

Solution: Check current power state before issuing power commands.

Error: 409 Conflict - VM not running

Solution: Verify VM is actually running before attempting shutdown.

Error: 507 Insufficient Resources

Solution: Check cluster resource availability or reduce VM resource requirements.

Operation Timeouts

Set appropriate timeouts for power operations:

  • Power On: 30-60 seconds

  • Graceful Shutdown: 60-120 seconds

  • Force Shutdown: 10-30 seconds

  • Reboot: 60-120 seconds

Related Operations

Need Help?

For additional support with VM power management:

  • 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?