Skip to main content

Manage Existing Virtual Machine Operations

A set of operations for managing existing virtual machine resources.

Endpoint NameURLDescription
Start virtual machineGET /core/virtual-machines/{id}/startStarts a virtual machine.
Stop virtual machineGET /core/virtual-machines/{id}/stopShuts down a virtual machine.
Hard-reboot virtual machineGET /core/virtual-machines/{id}/hard-rebootReboots a virtual machine.
Hibernate virtual machineGET /core/virtual-machines/{id}/hibernateInitiates the hibernation of a virtual machine.
Restore hibernated virtual machineGET /core/virtual-machines/{id}/hibernate-restoreResumes a virtual machine from hibernation.
Resize virtual machineGET /core/virtual-machines/{virtual_machine_id}/resizeModifies the hardware specifications of a virtual machine.
Delete virtual machineDELETE /core/virtual-machines/{id}Permanently deletes a virtual machine.

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: https://infrahub-api.nexgencloud.com/v1/core/virtual-machines

StatusDescription
CREATINGInfrahub has accepted the request to create the VM.
BUILDThe VM is being built with the provided configuration.
ACTIVEThe VM is now running and ready for use.
ERRORThis 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

StatusDescription
STOPPINGInfrahub has accepted the request to stop the VM.
SHUTOFFThe 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

StatusDescription
STARTINGInfrahub has accepted the request to start the VM.
REBOOTINGInfrahub has accepted the request to perform a hard reboot on the VM, simulating the process of unplugging and rebooting a physical machine.
ACTIVEThe 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

StatusDescription
HIBERNATINGInfrahub has accepted the request to hibernate the VM.
HIBERNATEDThe VM is now hibernated.
RESTORINGInfrahub has accepted the request to wake up the VM and restore it from hibernation.
ACTIVEThe VM is now awake and running.

Attach a public IP: /core/virtual-machines/{id}/attach-floatingip

Detach a public IP: /core/virtual-machines/{id}/detach-floatingip

StatusDescription
ATTACHINGInfrahub has accepted the request to attach a public IP to the VM.
DETACHINGInfrahub has accepted the request to detach a public IP from the VM.
ATTACHEDThe public IP has been successfully attached to the VM.
NO PUBLIC IPThe public IP has been detached from the VM.

Add a firewall rule: /core/virtual-machines/{id}/sg-rules

Delete a firewall rule: DELETE /core/virtual-machines/{virtual_machine_id}/sg-rules/{sg_rule_id}

StatusDescription
PENDINGInfrahub has accepted the request to create a firewall rule.
DELETINGInfrahub has accepted the request to delete a firewall rule.
SUCCESSThe firewall rule has been created or deleted, depending on the operation called.
ERRORInfrahub 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.
TaskDescription
NoneNo task is currently in progress.
BUILDINGThe VM is being initialized.
DELETINGThe VM is currently in the process of being deleted.
STOPPINGThe VM is currently shutting down.
STARTINGThe VM is booting up.
REBOOTINGThe VM is in the process of rebooting.
BLOCK_DEVICE_MAPPINGThe VM is mapping block devices such as local disks and volumes.
SPAWNINGThe VM is being assigned to a proper host.
HIBERNATINGThe 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 StateDescription
NOSTATEThe VM is yet to be scheduled.
RUNNINGThe VM is active and running.
PAUSEDThe VM is paused.
SHUTDOWNThe VM is in a shutdown state.
CRASHEDThe VM has crashed.
SUSPENDEDThe VM has been suspended.

Back to top