Skip to content

Commit

Permalink
[vnc_openstack]: Fix to raise correct err msg
Browse files Browse the repository at this point in the history
Tempest test 'test_network_quota_exceeding' expects Confict exception
with ['network'] instead of u'virtual_network'. This patch fixes this
error message.

Change-Id: I41137290ee851746a7ec1aa041fe54cf29ccec21
Closes-Bug: #1712773
(cherry picked from commit f7e7d20)
  • Loading branch information
sahilsabharwal authored and aignatov committed Sep 4, 2020
1 parent 9a4c944 commit fa14d73
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/config/vnc_openstack/vnc_openstack/neutron_plugin_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ def get_uuid(self):
return self.uuid


# VNC to neutron resource type
_RESOURCE_VNC_TO_NEUTRON = {'virtual_network':
'network'}

class LocalVncApi(VncApi):
def __init__(self, api_server_obj, *args, **kwargs):
if api_server_obj:
Expand Down Expand Up @@ -637,6 +641,8 @@ def _resource_create(self, resource_type, obj):
self._raise_contrail_exception('BadRequest',
resource=resource_type, msg=str(e))
except OverQuota as e:
if resource_type in _RESOURCE_VNC_TO_NEUTRON:
resource_type = _RESOURCE_VNC_TO_NEUTRON[resource_type]
self._raise_contrail_exception('OverQuota',
overs=[resource_type], msg=str(e))
except AuthFailed as e:
Expand Down

0 comments on commit fa14d73

Please sign in to comment.