Force Power Off a VM Using the API
Step-by-step instructions for force powering off a non-responsive VM using the VergeOS API and Swagger interface, including how to locate the VM ID, verify status, and issue the power-off command.
Overview
This guide explains how to force power off a non-responsive virtual machine (VM) using the VergeOS API when standard power-off methods are unsuccessful.
Prerequisites
Access to the VergeOS UI with administrative privileges
The name of the stuck/non-responsive VM
Basic understanding of API operations
Important
This procedure should only be used when standard power-off methods have failed. Forcing a VM to power off can lead to data loss or corruption if not used carefully.
Steps
1. Access the API Documentation
Navigate to System in the VergeOS UI
Click on API Documentation (also known as Swagger)
2. Locate the VM ID
In the API interface, locate and expand the VMs table
Click the blue GET button
In the parameters section:
Use filter
name eq your_vm_nameto find a specific VM
Click Execute
Note the
Machinenumber from the response
3. Get Machine Status ID
Navigate to the machines table
Click the blue GEt /machines/{id}
In the parameters:
Set
idto theMachine number from the previous responseSet
fieldstostatus
Click Execute
From the response, note the
statusvalue
4. Verify Machine Status
Go to the machine_status table
Click the blue GET /machine_stats/{id}
In the parameters:
Set
idtostatus_number(using the status value from step 3)Set
fieldstomost
Click Execute
Verify this is the correct VM by checking:
Number of cores
RAM allocation
Status information
Machine number
5. Force Power Off
In the machine_status table, click PUT
Enter the status number as the
idresource idIn the request body, enter the following JSON:
Click Execute
6. Verify Power Off
Return to the VergeOS UI
Verify that the VM shows as powered off
Troubleshooting
Common Issues
If the VM doesn't show as powered off after the API call, wait a few minutes for the status to update
If the status doesn't update, verify that all IDs were correct in the previous steps
In case of errors, check the API response for specific error messages
Additional Notes
Always document the VM's ID and status values before making changes
Consider taking a snapshot of the VM before forcing power off if possible
Monitor the VM after forcing power off to ensure it starts properly when needed
Feedback
Last updated
Was this helpful?