In OpenStack, we can see 3 types of virtual machine status:
Power status:
Power Status is the status from hypervisor. power_state is
the hypervisor state, loaded “bottom-up” from
compute worker; it can be updated in DB by tasks.
There are 3 statuses: SHUTDOWN (previous SHUTOFF) NOSTATE (previous FAILED), RUNNING(previous BLOCKED)
Status:
Status (vm_status): the stable status of the VM. It should describe a VM’s
current stable (not transition) state. vm_state should only be updated
at the end of a task, when the task successfully finishes, and setting the
task_state to None. Without API calls, the vm_state should never change.
·
INITIALIZED: VM is just created in the database, but has not
been built. (was BUILDING)
·
ACTIVE: VM is running with the specified image.
·
RESCUED: VM is running with the rescue image.
·
PAUSED: VM is paused with the specified image.
·
SUSPENDED: VM is suspended with the specified image, with a
valid memory snapshot.
·
STOPPED: VM is not running, and the image is on disk.
·
SOFT_DELETED: VM is no longer running on compute, but the disk
image remains and can be brought back.
·
HARD_DELETED: From quota and billing’s
perspective, the VM no longer exists. VM will eventually be destroyed running
on compute, disk images too.
In some situation, the Power
Status is not consistent with vm_status, if the VM is in transition status,
that is fine. Otherwise, it usually indicate the error happened.
·
RESIZED: The VM is stopped on the source node but running on the
destination node. The VM images exist at two locations (src and dest, with
different sizes). The user is expected to confirm the resize or revert it. (the
same functionality of the old task_state.RESIZE_VERIFY)
·
ERROR: some unrecoverable error happened. Only delete is allowed
to be called on the VM.
Task Status:
Task Status: task_state
should represent a transition state, and is precisely associated with one
compute API, indicating which task the VM is currently running. There are only one task (with a task
id) can be running on the VM at a time. Only HARD_DELETE can pre-empt other
tasks. The task status is driven by compute API
method and should not be changed during the task execution.
All the task status is named after verb-ing. There are around
20 task status in OpenStack.