Catch InstanceIsLocked exception instead of invalidstate on server actions

Bug #1256873 reported by huangtianhua
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
huangtianhua

Bug Description

Server actions should raise "Instance is locked" while instance is locked by admin, the actions include:
1. reboot in v2 and v3
2. delete in v2 and v3
3. resize/confirm resize/revert resize in v2 and v3
4. shelve/unshelve/shelve_offload in v2 and v3
5. attach_volume/swap_volume/detach_volume in v2 and v3
6. rebuild in v2 and v3

Changed in nova:
assignee: nobody → huangtianhua (huangtianhua)
description: updated
summary: - Catch InstanceIsLocked exception on server actions
+ Catch InstanceIsLocked exception instead of invalidstate on server
+ actions
description: updated
description: updated
description: updated
description: updated
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/60128

Changed in nova:
status: New → In Progress
Revision history for this message
Jay Lee (hyangii) wrote :

I think this problem will be solve if InstanceIsLocked inherit Invalid instead of InstanceInvalidState.

It's very simple, just fix InstanceIsLocked(InstanceInvalidState) to InstanceIsLocked(Invalid) in exception.py

What do you think about it?

Revision history for this message
huangtianhua (huangtianhua) wrote :

Thanks Jay:)

In my opinion:
1. If only fix InstanceIsLocked(InstanceInvalidState) to InstanceIsLocked(Invalid), the error code 400 will be raise, i think we should keep pace with other actions(such v3 admin actions) and to return 409 error code.

2. In my patch (https://review.openstack.org/60128), i add some tests so make it looks complicated :)

What do you think about?

Revision history for this message
Jay Lee (hyangii) wrote :

I agree with your opinion. I didn't catch about error code.
Thanks.

Andrew Laski (alaski)
Changed in nova:
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/60128
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=d122b2e05a9e13d5caea3f8f6578bb473fbb9c5e
Submitter: Jenkins
Branch: master

commit d122b2e05a9e13d5caea3f8f6578bb473fbb9c5e
Author: huangtianhua <email address hidden>
Date: Tue Dec 3 17:30:49 2013 +0800

    Catch InstanceIsLocked exception on server actions

    If the server is locked, server actions raise 409 error, and the error
    message is like "Instance is in an invalid state for 'pause(action name)'". The
    error message is inappropriate, two points:
    1. the state is valid for pause
    2. the message doesn't tell that the instance is locked

    The patch fixes the problem, and will modify on v2 and v3.

    Change-Id: I7e21037b9abca5a3fd0f64dd5621e88dcf1a3c21
    Closes-Bug: #1256873

Changed in nova:
status: In Progress → Fix Committed
Changed in nova:
milestone: none → icehouse-2
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: icehouse-2 → 2014.1
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.