nova api os-resetState should not reset the state when VM is shelved_offloaded

Bug #1913016 reported by Khomesh Thakre
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Confirmed
Medium
Khomesh Thakre

Bug Description

when the VM is in SHELVED_OFFLOADED state the VM doesn't exist physically on any compute node so resetting the state to active or error might cause the DB inconsistency and also make unshelving difficult.

~~~
(overcloud) [stack@undercloud ~]$ nova list
+--------------------------------------+-------+-------------------+------------+-------------+------------------------------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+-------+-------------------+------------+-------------+------------------------------+
| f86f9503-02c3-4c11-bd61-bfd9b9b8ad21 | test2 | SHELVED_OFFLOADED | - | Shutdown | sriov-net1-197=10.74.167.185 |
+--------------------------------------+-------+-------------------+------------+-------------+------------------------------+
(overcloud) [stack@undercloud ~]$ openstack server set --state active test2
(overcloud) [stack@undercloud ~]$ openstack server list
+--------------------------------------+-------+--------+------------------------------+---------+-----------+
| ID | Name | Status | Networks | Image | Flavor |
+--------------------------------------+-------+--------+------------------------------+---------+-----------+
| f86f9503-02c3-4c11-bd61-bfd9b9b8ad21 | test2 | ACTIVE | sriov-net1-197=10.74.167.185 | rhel7.7 | m1-medium |
+--------------------------------------+-------+--------+------------------------------+---------+-----------+
(overcloud) [stack@undercloud ~]$ openstack server unshelve test2
Cannot 'unshelve' instance f86f9503-02c3-4c11-bd61-bfd9b9b8ad21 while it is in vm_state active (HTTP 409) (Request-ID: req-c992c5f5-63c9-4472-be75-9594bc682b37)
~~~

Not just unshelve, we cannot perform any VM operation as VM doesn't exist anywhere.

Changed in nova:
assignee: nobody → Khomesh Thakre (khomesh24)
Revision history for this message
Khomesh Thakre (khomesh24) wrote :

If we set a VM(with shelved_offload) the state to active it, block by doing any action on VM as it doesn't exist physically anywhere. And the only way to recover is to manually update the DB and set the state back to shelved_offload.

Revision history for this message
Balazs Gibizer (balazs-gibizer) wrote :

os-resetState is not designed to be smart[1]. It simply writes the requested state to the DB but it does not do any validation or trigger any change of the VM itself. It is a last resort tool for the admin to
* push an VM from a stuck state to ERROR and the trigger a rebuild to recover it
* fix a db inconsistency where the VM is clearly and happily running but the DB state does not reflect that.

There are many cases when pushing a VM state to ACTIVE while it is not really running causes inconsistencies.

I don't think we want to make os-resetState smarter. But a fat warning should be added to the API reference.

[1] https://github.com/openstack/nova/blob/87d05fbae28d3dd29de8a7c98cf26e3f06648879/nova/api/openstack/compute/admin_actions.py#L63-L79

Lee Yarwood (lyarwood)
Changed in nova:
status: New → Confirmed
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.