summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpedh <hcn518@gmail.com>2020-06-10 18:18:00 +0800
committerVishal Manchanda <manchandavishal143@gmail.com>2020-09-24 06:56:49 +0000
commita4a549a1814a9ea9f142fd8ec5928fe9cfebc269 (patch)
treecad2f985ac7e1e6f48a8c5fe56eb10a313a7b0e1
parentf7dc499de44a575fa2966443784af3d14efcc6ae (diff)
downloadhorizon-a4a549a1814a9ea9f142fd8ec5928fe9cfebc269.tar.gz
Fix: Page crashes on instance confirm resize
Add error handling to instance confirm/revert resize methods. Change-Id: I128049091f38e8db3c1524a5c4cb932f3e809714 Closes-Bug: #1882918
-rw-r--r--openstack_dashboard/dashboards/project/instances/tables.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/openstack_dashboard/dashboards/project/instances/tables.py b/openstack_dashboard/dashboards/project/instances/tables.py
index c839f1531..56af9b8f3 100644
--- a/openstack_dashboard/dashboards/project/instances/tables.py
+++ b/openstack_dashboard/dashboards/project/instances/tables.py
@@ -624,8 +624,14 @@ class ConfirmResize(policy.PolicyTargetMixin, tables.Action):
def allowed(self, request, instance):
return instance.status == 'VERIFY_RESIZE'
- def single(self, table, request, instance):
- api.nova.server_confirm_resize(request, instance)
+ def single(self, table, request, obj_id):
+ instance = table.get_object_by_id(obj_id)
+ try:
+ api.nova.server_confirm_resize(request, instance.id)
+ except Exception:
+ exceptions.handle(request,
+ _('Unable to confirm resize instance "%s".')
+ % (instance.name or instance.id))
return shortcuts.redirect(request.get_full_path())
@@ -638,8 +644,14 @@ class RevertResize(policy.PolicyTargetMixin, tables.Action):
def allowed(self, request, instance):
return instance.status == 'VERIFY_RESIZE'
- def single(self, table, request, instance):
- api.nova.server_revert_resize(request, instance)
+ def single(self, table, request, obj_id):
+ instance = table.get_object_by_id(obj_id)
+ try:
+ api.nova.server_revert_resize(request, instance.id)
+ except Exception:
+ exceptions.handle(request,
+ _('Unable to revert resize instance "%s".')
+ % (instance.name or instance.id))
class RebuildInstance(policy.PolicyTargetMixin, tables.LinkAction):