Unable to hard reboot an instance that is pausing

Bug #1768927 reported by Matt Riedemann
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Matt Riedemann
Pike
New
Undecided
Unassigned
Queens
New
Undecided
Unassigned

Bug Description

If you look at the allowed task_states for hard reboot in the API here:

https://github.com/openstack/nova/blob/644ac5ec37903b0a08891cc403c8b3b63fc2a91c/nova/compute/api.py#L2963

it allows these values:

https://github.com/openstack/nova/blob/644ac5ec37903b0a08891cc403c8b3b63fc2a91c/nova/compute/task_states.py#L120

ALLOW_REBOOT = [None, REBOOTING, REBOOT_PENDING, REBOOT_STARTED, RESUMING,
                REBOOTING_HARD, UNPAUSING, PAUSING, SUSPENDING]

But when changing the task_state on the instance, if it's currently 'pausing' it will fail because that's not one of the expected_task_states:

https://github.com/openstack/nova/blob/644ac5ec37903b0a08891cc403c8b3b63fc2a91c/nova/compute/api.py#L2966

        expected_task_state = [None,
                               task_states.REBOOTING,
                               task_states.REBOOT_PENDING,
                               task_states.REBOOT_STARTED,
                               task_states.REBOOTING_HARD,
                               task_states.RESUMING,
                               task_states.UNPAUSING,
                               task_states.SUSPENDING]
        instance.save(expected_task_state = expected_task_state)

It looks like this is just a very old latent problem, see: https://review.openstack.org/#/c/127427/

Tags: api reboot
Matt Riedemann (mriedem)
Changed in nova:
status: New → Triaged
importance: Undecided → Medium
Matt Riedemann (mriedem)
Changed in nova:
assignee: nobody → Matt Riedemann (mriedem)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/566143

Changed in nova:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/566143
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=3437baedf646c7cd3da43440368edc194a880db8
Submitter: Zuul
Branch: master

commit 3437baedf646c7cd3da43440368edc194a880db8
Author: Matt Riedemann <email address hidden>
Date: Thu May 3 15:00:02 2018 -0400

    Fix being able to hard reboot a pausing instance

    The allowed task states for a hard reboot include 'pausing'
    but the instance.save(expected_task_states) doesn't include
    'pausing', so if you try to hard reboot a pausing instance
    it will fail with UnexpectedTaskStateError.

    This makes the expected_task_states passed to Instance.save
    use the same list of allowed task states that we use in the
    check_instance_state decorator, and re-writes the unit test
    to use an actual database to verify the Instance.save()
    behavior and task state check in the DB API.

    While we're at it, the API reference is updated to indicate
    the allowed states for each type of reboot.

    Change-Id: I5a21350e48a637e581d269fb567bb96c1899e174
    Closes-Bug: #1768927

Changed in nova:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 18.0.0.0rc1

This issue was fixed in the openstack/nova 18.0.0.0rc1 release candidate.

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.