From 9c399da5c5fa39d0167b1ff81b2e1c12525ecfa2 Mon Sep 17 00:00:00 2001 From: Rikimaru Honjo Date: Fri, 24 Feb 2017 14:48:50 +0900 Subject: [PATCH] Allow shelving instance for SHUTOFF/PAUSED/SUSPENDED statuses Nova allows users to run shelve when instance status is either ACTIVE/PAUSED/SHUTOFF/SUSPENDED. But, horizon could run shelve only when instance status is ACTIVE. This patch fix the above mismatch. Change-Id: I3a3815c82a2dd008ff1f6094c9598aa583130f20 closes-bug: #1667576 (cherry picked from commit 9984599ca3dbf50c8061392fefb16c865e7262a1) --- openstack_dashboard/dashboards/project/instances/tables.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openstack_dashboard/dashboards/project/instances/tables.py b/openstack_dashboard/dashboards/project/instances/tables.py index f01741e3c8..4e92b02dfe 100644 --- a/openstack_dashboard/dashboards/project/instances/tables.py +++ b/openstack_dashboard/dashboards/project/instances/tables.py @@ -50,6 +50,7 @@ LOG = logging.getLogger(__name__) ACTIVE_STATES = ("ACTIVE",) VOLUME_ATTACH_READY_STATES = ("ACTIVE", "SHUTOFF") SNAPSHOT_READY_STATES = ("ACTIVE", "SHUTOFF", "PAUSED", "SUSPENDED") +SHELVE_READY_STATES = ("ACTIVE", "SHUTOFF", "PAUSED", "SUSPENDED") POWER_STATES = { 0: "NO STATE", @@ -361,7 +362,7 @@ class ToggleShelve(tables.BatchAction): target={'project_id': getattr(instance, 'tenant_id', None)}) return (has_permission - and (instance.status in ACTIVE_STATES or self.shelved) + and (instance.status in SHELVE_READY_STATES or self.shelved) and not is_deleting(instance)) def action(self, request, obj_id):