Skip to content

Commit

Permalink
Modified vnc_openstack to catch proper error from the api-server and …
Browse files Browse the repository at this point in the history
…pass it to the neutron.

Closes Bug: #1604578

Change-Id: Ibd66e36d57a1079fb8a3032ea117d0a7c7f7b634
  • Loading branch information
sahilsabharwal committed Jul 28, 2016
1 parent 8063ea7 commit 44c1853
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/config/api-server/vnc_cfg_types.py
Expand Up @@ -430,10 +430,10 @@ def pre_dbe_create(cls, tenant_name, obj_dict, db_conn):
# for g/w ip, creation allowed but only can ref to router port.
if req_ip and cls.addr_mgmt.is_ip_allocated(req_ip, vn_fq_name):
if not cls._is_gateway_ip(vn_dict, req_ip):
return (False, (403, 'Ip address already in use'))
return (False, (400, 'Ip address already in use'))
elif cls._vmi_has_vm_ref(db_conn, obj_dict):
return (False,
(403, 'Gateway IP cannot be used by VM port'))
(400, 'Gateway IP cannot be used by VM port'))
# end if request has ip addr

try:
Expand Down
8 changes: 7 additions & 1 deletion src/config/vnc_openstack/vnc_openstack/neutron_plugin_db.py
Expand Up @@ -3527,8 +3527,14 @@ def _port_create_instance_ip(self, net_obj, port_obj, port_q, ip_family="v4"):
elif (IPAddress(fixed_ip['ip_address']).version == 6):
ip_family="v6"
subnet_id = fixed_ip.get('subnet_id')
ip_id = self._create_instance_ip(net_obj, port_obj, ip_addr,
try:
ip_id = self._create_instance_ip(net_obj, port_obj, ip_addr,
subnet_id, ip_family)
except BadRequest as e:
self._raise_contrail_exception(
'IpAddressInUse', net_id=net_obj.uuid,
ip_address=ip_addr)

created_iip_ids.append(ip_id)
except vnc_exc.HttpError as e:
# Resources are not available
Expand Down

0 comments on commit 44c1853

Please sign in to comment.