Manage Existing Virtual Machine Operations
A set of operations for managing existing virtual machine resources.
VM API states and statuses
Below, you will find a detailed breakdown of the various virtual machine operations and their associated statuses at various points in a VM's lifecycle:
- The Infrahub API returns the
vm_state
field describing the VM's current stable state when no ongoing API call to Infrahub is in progress. It reflects the expected state of the VM from the customer's perspective.
Create a VM: POST https://infrahub-api.nexgencloud.com/v1/core/virtual-machines
Status | Description |
---|
CREATING | Infrahub has accepted the request to create the VM. |
BUILD | The VM is being built with the provided configuration. |
ACTIVE | The VM is now running and ready for use. |
ERROR | This status appears if the VM build stage encounters a failure. |
Stop a VM: GET https://infrahub-api.nexgencloud.com/v1/core/virtual-machines/{id}/stop
Status | Description |
---|
STOPPING | Infrahub has accepted the request to stop the VM. |
SHUTOFF | The VM has been successfully shut down. |
Start a VM: GET /core/virtual-machines/{virtual_machine_id}/start
Hard reboot a VM: GET /core/virtual-machines/{virtual_machine_id}/hard-reboot
Status | Description |
---|
STARTING | Infrahub has accepted the request to start the VM. |
REBOOTING | Infrahub has accepted the request to perform a hard reboot on the VM, simulating the process of unplugging and rebooting a physical machine. |
ACTIVE | The VM is now running. |
Hibernate a VM: GET /core/virtual-machines/{virtual_machine_id}/hibernate
Restore VM from hibernation: GET /core/virtual-machines/{virtual_machine_id}/hibernate-restore
Status | Description |
---|
HIBERNATING | Infrahub has accepted the request to hibernate the VM. |
HIBERNATED | The VM is now hibernated. |
RESTORING | Infrahub has accepted the request to wake up the VM and restore it from hibernation. |
ACTIVE | The VM is now awake and running. |
Attach a public IP: POST /core/virtual-machines/{id}/attach-floatingip
Detach a public IP: POST /core/virtual-machines/{id}/detach-floatingip
Status | Description |
---|
ATTACHING | Infrahub has accepted the request to attach a public IP to the VM. |
DETACHING | Infrahub has accepted the request to detach a public IP from the VM. |
ATTACHED | The public IP has been successfully attached to the VM. |
NO PUBLIC IP | The public IP has been detached from the VM. |
Add a firewall rule: POST /core/virtual-machines/{id}/sg-rules
Delete a firewall rule: DELETE /core/virtual-machines/{virtual_machine_id}/sg-rules/{sg_rule_id}
Status | Description |
---|
PENDING | Infrahub has accepted the request to create a firewall rule. |
DELETING | Infrahub has accepted the request to delete a firewall rule. |
SUCCESS | The firewall rule has been created or deleted, depending on the operation called. |
ERROR | Infrahub failed to create or delete the firewall rule. |
Task states
In virtual machine management, task states are similar to VM states and often use the "-ing" suffix to indicate ongoing tasks related to VM operations. Here are some examples of task states:
- The
task_state
field returned by Infrahub APIs represents the transition state associated with ongoing Infrahub API calls. This state specifies the task the VM is currently executing.
Task | Description |
---|
None | No task is currently in progress. |
BUILDING | The VM is being initialized. |
DELETING | The VM is currently in the process of being deleted. |
STOPPING | The VM is currently shutting down. |
STARTING | The VM is booting up. |
REBOOTING | The VM is in the process of rebooting. |
BLOCK_DEVICE_MAPPING | The VM is mapping block devices such as local disks and volumes. |
SPAWNING | The VM is being assigned to a proper host. |
HIBERNATING | The VM is in the process of being hibernated. |
Power states
Power states refer to the operational conditions of a virtual machine (VM), indicating its current status. Below are the different power states that a VM can exhibit:
- The
power_state
field returned by Infrahub APIs refers to the hypervisor state of the VM, indicating its power status.
Power State | Description |
---|
NOSTATE | The VM is yet to be scheduled. |
RUNNING | The VM is active and running. |
PAUSED | The VM is paused. |
SHUTDOWN | The VM is in a shutdown state. |
CRASHED | The VM has crashed. |
SUSPENDED | The VM has been suspended. |