summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-06-13 15:11:39 +0000
committerGerrit Code Review <review@openstack.org>2017-06-13 15:11:39 +0000
commit186d14f491172f4befaf57b81bf767a67f803b02 (patch)
treee9b1e6d13aeb06c7e7965c6956639ac6b00d56b0
parent19598e41a03d7f4df277b86677e56fa089905448 (diff)
parenta689d69e6882bfd2e793a47a339ad3cf015e782a (diff)
Merge "Make UpdateDefaultQuotas handling more robust to missing form fields" into stable/ocata
-rw-r--r--openstack_dashboard/dashboards/admin/defaults/workflows.py26
1 files changed, 15 insertions, 11 deletions
diff --git a/openstack_dashboard/dashboards/admin/defaults/workflows.py b/openstack_dashboard/dashboards/admin/defaults/workflows.py
index 394e79f..27a5612 100644
--- a/openstack_dashboard/dashboards/admin/defaults/workflows.py
+++ b/openstack_dashboard/dashboards/admin/defaults/workflows.py
@@ -87,8 +87,10 @@ class UpdateDefaultQuotas(workflows.Workflow):
87 def handle(self, request, data): 87 def handle(self, request, data):
88 # Update the default quotas. 88 # Update the default quotas.
89 # `fixed_ips` update for quota class is not supported by novaclient 89 # `fixed_ips` update for quota class is not supported by novaclient
90 nova_data = dict([(key, data[key]) for key in quotas.NOVA_QUOTA_FIELDS 90 nova_data = {
91 if key != 'fixed_ips']) 91 key: value for key, value in data.items()
92 if key in quotas.NOVA_QUOTA_FIELDS and key != 'fixed_ips'
93 }
92 is_error_nova = False 94 is_error_nova = False
93 is_error_cinder = False 95 is_error_cinder = False
94 is_volume_service_enabled = cinder.is_volume_service_enabled(request) 96 is_volume_service_enabled = cinder.is_volume_service_enabled(request)
@@ -100,16 +102,18 @@ class UpdateDefaultQuotas(workflows.Workflow):
100 is_error_nova = True 102 is_error_nova = True
101 103
102 # Update the default quotas for cinder. 104 # Update the default quotas for cinder.
103 try: 105 if is_volume_service_enabled:
104 if is_volume_service_enabled: 106 cinder_data = {
105 cinder_data = dict([(key, data[key]) for key in 107 key: value for key, value in data.items()
106 quotas.CINDER_QUOTA_FIELDS]) 108 if key in quotas.CINDER_QUOTA_FIELDS
109 }
110 try:
107 cinder.default_quota_update(request, **cinder_data) 111 cinder.default_quota_update(request, **cinder_data)
108 else: 112 except Exception:
109 LOG.debug('Unable to update Cinder default quotas' 113 is_error_cinder = True
110 ' because the Cinder volume service is disabled.') 114 else:
111 except Exception: 115 LOG.debug('Unable to update Cinder default quotas'
112 is_error_cinder = True 116 ' because the Cinder volume service is disabled.')
113 117
114 # Analyze errors (if any) to determine what success and error messages 118 # Analyze errors (if any) to determine what success and error messages
115 # to display to the user. 119 # to display to the user.