Terminate instance button should be grayed out while instance is in suspended state

Bug #1009893 reported by David Naori
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Low
Gabriel Hurley

Bug Description

 When trying to terminate an instance on suspended status via the dashboard it fails with the following (uninformative) error:
""" Error: Unable to terminate instance: XXXX """

The actual error:
Cannot 'delete' while instance is in vm_state suspended

In my opinion terminate instance button should be grayed out while instance is in suspended state.

Revision history for this message
Marcelo Dieder (mdieder) wrote :

I have the same problem.

root@cloud01:~#nova list
+--------------------------------------+---------------+-----------+-------------------------------+
| ID | Name | Status | Networks |
| 8f18f6c2-7ec8-4fb3-b1f8-4fe98300e997 | unisinos_vm01 | SUSPENDED | vmnet=10.1.0.3 |
+--------------------------------------+---------------+-----------+-------------------------------+

root@cloud01:~# nova delete unisinos_vm01
ERROR: Cannot 'delete' while instance is in vm_state suspended (HTTP 409)

but I restart the services (compute, api, rabbit) and not working.

I delete manually all (instance files, volume lvm and entries in mysql database):

mysql> delete from block_device_mapping where id="1";
mysql> delete from security_group_instance_association where instance_id="4";
mysql> delete from iscsi_targets where volume_id=6;
mysql> delete from volumes where id='6';
mysql> delete from instance_info_caches where instance_id="8f18f6c2-7ec8-4fb3-b1f8-4fe98300e997";
mysql> delete from instances where uuid="8f18f6c2-7ec8-4fb3-b1f8-4fe98300e997";

rm /var/lib/nova/instances/instance-00000004/ -rf

/etc/init.d/iscsitarget stop
lvremove /dev/nova-volumes/volume-00000006
/etc/init.d/iscsitarget start

Devin Carlen (devcamcar)
Changed in horizon:
status: New → Confirmed
importance: Undecided → Low
milestone: none → folsom-3
assignee: nobody → Nebula (nebula)
Revision history for this message
Tihomir Trifonov (ttrifonov) wrote :

I've tested with the default Devstack setup - no problem to terminate a 'Suspended' instance. No errors, all fine.
Please specify what kind of virt driver do you use, what type is the virtual instance. And even more important - is this the latest dev code(Folsom), or Essex? In the NOVA API current code we have:

    # NOTE(maoy): we allow delete to be called no matter what vm_state says.
    @wrap_check_policy
    @check_instance_state(vm_state=None, task_state=None)
    def delete(self, context, instance):

So it seems no limitation to the vm_state for termination.

Revision history for this message
David Naori (davidnaori3) wrote :

Essex

    # NOTE(jerdfelt): The API implies that only ACTIVE and ERROR are
    # allowed but the EC2 API appears to allow from RESCUED and STOPPED
    # too
    @wrap_check_policy
    @check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.BUILDING,
                                    vm_states.ERROR, vm_states.RESCUED,
                                    vm_states.SHUTOFF, vm_states.STOPPED])
    def delete(self, context, instance):

Revision history for this message
Jake Dahn (jakedahn) wrote :

I'm not sure this should apply to horizon in folsom and forward. I don't think the openstack api cares at all about whether an instance is in a suspended state, it should terminate when you tell it to terminate.

Other thoughts?

Revision history for this message
Gabriel Hurley (gabriel-hurley) wrote :

If that's true, I'm okay with letting this go. @jake can you confirm that and if so mark this as a wontfix?

Revision history for this message
Gabriel Hurley (gabriel-hurley) wrote :

Eh, I take it back. I'd rather fix this for now since it *is* a problem with Essex and we're trying to be as backwards-compatible as possible.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

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

Changed in horizon:
assignee: Nebula (nebula) → Gabriel Hurley (gabriel-hurley)
status: Confirmed → In Progress
Changed in horizon:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/11381
Committed: http://github.com/openstack/horizon/commit/56c23b5cdf5a0559c5fda33776c9880159bf67f9
Submitter: Jenkins
Branch: master

commit 56c23b5cdf5a0559c5fda33776c9880159bf67f9
Author: Gabriel Hurley <email address hidden>
Date: Tue Aug 14 18:09:36 2012 -0700

    Clean up instance state checking for actions.

    Better checking for which actions are allowed in which states.
    Fixes bug 1008798 and fixes bug 1009893.

    Change-Id: Id1ed33a09af991ccfd36eafc69b83cf203201d91

Changed in horizon:
status: Fix Committed → In Progress
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in horizon:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in horizon:
milestone: folsom-3 → 2012.2
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.