VM state wont update on power failure
melanie witt
melwittt at gmail.com
Wed Aug 16 22:35:01 UTC 2023
On 08/16/23 13:03, Shrey Chauhan wrote:
> Hi,
>
> Currently I am running xena version of openstack.
> I am confused about one thing.
> Running a 3 node cluster. In case of a power failure my vm still shows
> as active (vm_state = active, power_state = running), even though in KVM
> they are in shutoff state.
> When I bring back the node and restart nova the state changes to
> 'shutoff'. What I am not understanding, is nova managing only local vms
> power states. Its a 3 node cluster, so nova compute running on other
> node should change the state in the database, isnt it? Am I missing any
> nova or linvirt configuration here?
That is correct, nova-compute manages power state only for the VMs on
its own compute host. Each nova-compute isolated in this manner. When
nova-compute starts up, it will sync power states (as you saw) and after
that it will sync power states at the configured interval [1].
What you can do though is look at the host status in the server list
with openstack client version >= 6.0.0 [2] (openstack server list
--long). The host status for a VM whose host has not checked in within
the configured service downtime will show as UNKNOWN. Note that by
default policy the host status is only accessible by admin, so if you
would like to expose that info, you must adjust the policy.yaml [3].
os_compute_api:servers:show:host_status includes all possible host
statuses and os_compute_api:servers:show:host_status:unknown-only
includes only the UNKNOWN state. The latter is provided as an option for
operators who would like to allow non-admin users to see that the
compute hosting their VM may be down or otherwise unreachable without
revealing too much detail about the state of the compute host.
HTH,
-melwitt
[1]
https://docs.openstack.org/nova/latest/configuration/config.html#DEFAULT.sync_power_state_interval
[2] https://docs.openstack.org/releasenotes/python-openstackclient/zed.html
[3] https://docs.openstack.org/nova/latest/configuration/policy.html
More information about the openstack-discuss
mailing list