Don't update cinder quotas if disabled
The quotas for cinder were being updated even if they were disabled, resulting in None being sent as the value, and an error being thrown by the API. This patch cleans up that code to use the same logic in all three cases for nova, cinder and neutron. Change-Id: I73209122df20689eee33da9dccffa994a04a3ec0 Closes-bug: #1671911
This commit is contained in:
parent
39eea5ce22
commit
3055a98763
@ -411,24 +411,26 @@ class CommonQuotaWorkflow(workflows.Workflow):
|
||||
# Update the project quotas.
|
||||
if api.base.is_service_enabled(request, 'compute'):
|
||||
nova_data = {key: data[key] for key in
|
||||
set(quotas.NOVA_QUOTA_FIELDS) - disabled_quotas}
|
||||
quotas.NOVA_QUOTA_FIELDS
|
||||
if key not in disabled_quotas}
|
||||
if nova_data:
|
||||
nova.tenant_quota_update(request, project_id, **nova_data)
|
||||
|
||||
if cinder.is_volume_service_enabled(request):
|
||||
cinder_data = dict([(key, data[key]) for key in
|
||||
quotas.CINDER_QUOTA_FIELDS])
|
||||
cinder.tenant_quota_update(request,
|
||||
project_id,
|
||||
**cinder_data)
|
||||
cinder_data = {key: data[key] for key in
|
||||
quotas.CINDER_QUOTA_FIELDS
|
||||
if key not in disabled_quotas and
|
||||
data[key] is not None}
|
||||
if cinder_data:
|
||||
cinder.tenant_quota_update(request, project_id, **cinder_data)
|
||||
|
||||
if api.base.is_service_enabled(request, 'network') and \
|
||||
api.neutron.is_quotas_extension_supported(request):
|
||||
neutron_data = {}
|
||||
for key in quotas.NEUTRON_QUOTA_FIELDS:
|
||||
if key not in disabled_quotas:
|
||||
neutron_data[key] = data[key]
|
||||
api.neutron.tenant_quota_update(request,
|
||||
project_id,
|
||||
if (api.base.is_service_enabled(request, 'network') and
|
||||
api.neutron.is_quotas_extension_supported(request)):
|
||||
neutron_data = {key: data[key] for key in
|
||||
quotas.NEUTRON_QUOTA_FIELDS
|
||||
if key not in disabled_quotas}
|
||||
if neutron_data:
|
||||
api.neutron.tenant_quota_update(request, project_id,
|
||||
**neutron_data)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user