Floating IP associate with a wrong UUID port fails

Bug #1367262 reported by Édouard Thuleau
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Juniper Openstack
Status tracked in Trunk
Trunk
In Progress
Undecided
Unassigned
OpenContrail
Fix Committed
Undecided
Numan Siddique

Bug Description

With release 1.10 if we associate a floating IP to not existing valid UUID resource port, the API returns 500 crash error instead of a not found port error:

$ neutron floatingip-associate 31cef026-c99b-4692-8bd2-ccfa241beecd 5039cc3b-59d2-4754-a2b6-e04c55df0e3a
Request Failed: internal server error while processing your request.

The VNC API traceback:

127.0.0.1 - - [2014-09-09 12:14:53] "GET /virtual-machine-interface/5039cc3b-59d2-4754-a2b6-e04c55df0e3a?fields=logical_router_back_refs%2Cinstance_ip_back_refs%2Cfloating_ip_back_refs HTTP/1.1" 404 208 0.002436
<class 'cfgm_common.exceptions.NoIdError'>
Python 2.7.3: /usr/bin/python
Tue Sep 9 12:14:53 2014

A problem occurred in a Python script. Here is the sequence of
function calls leading up to the error, in the order they occurred.

 /usr/lib/python2.7/dist-packages/vnc_openstack/neutron_plugin_interface.py in plugin_update_floatingip(self=<vnc_openstack.neutron_plugin_interface.NeutronPluginInterface object>, context={u'is_admin': False, u'operation': u'UPDATE', u'roles': [u'_member_'], u'tenant': u'488605922c75407d9a614ea4822bcb96', u'tenant_id': u'488605922c75407d9a614ea4822bcb96', u'type': u'floatingip', u'user_id': u'712bcdf0bede4d559a76bf891e1557fb'}, floatingip={u'fields': None, u'filters': None, u'id': u'31cef026-c99b-4692-8bd2-ccfa241beecd', u'resource': {'id': u'31cef026-c99b-4692-8bd2-ccfa241beecd', u'port_id': u'5039cc3b-59d2-4754-a2b6-e04c55df0e3a'}})
  495 cfgdb = self._get_user_cfgdb(context)
  496 floatingip_info = cfgdb.floatingip_update(floatingip['id'],
  497 floatingip['resource'])
  498 return floatingip_info
  499 except Exception as e:
floatingip = {u'fields': None, u'filters': None, u'id': u'31cef026-c99b-4692-8bd2-ccfa241beecd', u'resource': {'id': u'31cef026-c99b-4692-8bd2-ccfa241beecd', u'port_id': u'5039cc3b-59d2-4754-a2b6-e04c55df0e3a'}}

 /usr/lib/python2.7/dist-packages/vnc_openstack/neutron_plugin_db.py in floatingip_update(self=<vnc_openstack.neutron_plugin_db.DBInterface object>, fip_id=u'31cef026-c99b-4692-8bd2-ccfa241beecd', fip_q={'id': u'31cef026-c99b-4692-8bd2-ccfa241beecd', u'port_id': u'5039cc3b-59d2-4754-a2b6-e04c55df0e3a'})
 3366 def floatingip_update(self, fip_id, fip_q):
 3367 fip_q['id'] = fip_id
 3368 fip_obj = self._floatingip_neutron_to_vnc(fip_q, UPDATE)
 3369 self._vnc_lib.floating_ip_update(fip_obj)
 3370
fip_obj undefined
self = <vnc_openstack.neutron_plugin_db.DBInterface object>
self._floatingip_neutron_to_vnc = <bound method DBInterface._floatingip_neutron_to..._openstack.neutron_plugin_db.DBInterface object>>
fip_q = {'id': u'31cef026-c99b-4692-8bd2-ccfa241beecd', u'port_id': u'5039cc3b-59d2-4754-a2b6-e04c55df0e3a'}
global UPDATE = 3

 /usr/lib/python2.7/dist-packages/vnc_openstack/neutron_plugin_db.py in _floatingip_neutron_to_vnc(self=<vnc_openstack.neutron_plugin_db.DBInterface object>, fip_q={'id': u'31cef026-c99b-4692-8bd2-ccfa241beecd', u'port_id': u'5039cc3b-59d2-4754-a2b6-e04c55df0e3a'}, oper=3)
 1940 if fip_q.get('port_id'):
 1941 port_obj = self._virtual_machine_interface_read(
 1942 port_id=fip_q['port_id'])
 1943 fip_obj.set_virtual_machine_interface(port_obj)
 1944 else:
port_id undefined
fip_q = {'id': u'31cef026-c99b-4692-8bd2-ccfa241beecd', u'port_id': u'5039cc3b-59d2-4754-a2b6-e04c55df0e3a'}

 /usr/lib/python2.7/dist-packages/vnc_openstack/neutron_plugin_db.py in _virtual_machine_interface_read(self=<vnc_openstack.neutron_plugin_db.DBInterface object>, port_id=u'5039cc3b-59d2-4754-a2b6-e04c55df0e3a', fq_name=None, fields=None)
  669 except KeyError:
  670 port_obj = self._vnc_lib.virtual_machine_interface_read(
  671 id=port_id, fields=n_extra_fields)
  672 fq_name_str = json.dumps(port_obj.get_fq_name())
  673 self._db_cache['vnc_ports'][port_id] = port_obj
builtinid = <built-in function id>
port_id = u'5039cc3b-59d2-4754-a2b6-e04c55df0e3a'
fields = None
n_extra_fields = ['logical_router_back_refs', 'instance_ip_back_refs', 'floating_ip_back_refs']

 /usr/lib/python2.7/dist-packages/vnc_api/gen/vnc_api_client_gen.py in virtual_machine_interface_read(self=<vnc_api.vnc_api.VncApi object>, fq_name=None, fq_name_str=None, id=u'5039cc3b-59d2-4754-a2b6-e04c55df0e3a', ifmap_id=None, fields=['logical_router_back_refs', 'instance_ip_back_refs', 'floating_ip_back_refs'])
 5477 query_params = {'exclude_back_refs':True,
 5478 'exclude_children':True,}
 5479 content = self._request_server(rest.OP_GET, uri, query_params)
rest.OP_GET = 2
uri = u'/virtual-machine-interface/5039cc3b-59d2-4754-a2b6-e04c55df0e3a'
query_params = {'fields': 'logical_router_back_refs,instance_ip_back_refs,floating_ip_back_refs'}

 /usr/lib/python2.7/dist-packages/vnc_api/vnc_api.py in _request_server(self=<vnc_api.vnc_api.VncApi object>, op=2, url=u'/virtual-machine-interface/5039cc3b-59d2-4754-a2b6-e04c55df0e3a', data={'fields': 'logical_router_back_refs,instance_ip_back_refs,floating_ip_back_refs'}, retry_on_error=True, retry_after_authn=False)
  356 elif status == 404:
  357 raise NoIdError('Error: oper %s url %s body %s response %s'
  358 % (op, url, data, content))
  359 elif status == 403:
  360 raise PermissionDenied(content)
op = 2
url = u'/virtual-machine-interface/5039cc3b-59d2-4754-a2b6-e04c55df0e3a'
data = {'fields': 'logical_router_back_refs,instance_ip_back_refs,floating_ip_back_refs'}
content = u'No virtual-machine-interface object found for id 5039cc3b-59d2-4754-a2b6-e04c55df0e3a'
<class 'cfgm_common.exceptions.NoIdError'>: Unknown id: Error: oper 2 url /virtual-machine-interface/5039cc3b-59d2-4754-a2b6-e04c55df0e3a body {'fields': 'logical_router_back_refs,instance_ip_back_refs,floating_ip_back_refs'} response No virtual-machine-interface object found for id 5039cc3b-59d2-4754-a2b6-e04c55df0e3a
    __class__ = <class 'cfgm_common.exceptions.NoIdError'>
    __delattr__ = <method-wrapper '__delattr__' of NoIdError object>
    __dict__ = {'_unknown_id': u"Error: oper 2 url /virtual-machine-interface/5...ound for id 5039cc3b-59d2-4754-a2b6-e04c55df0e3a"}
    __doc__ = None
    __format__ = <built-in method __format__ of NoIdError object>
    __getattribute__ = <method-wrapper '__getattribute__' of NoIdError object>
    __getitem__ = <method-wrapper '__getitem__' of NoIdError object>
    __getslice__ = <method-wrapper '__getslice__' of NoIdError object>
    __hash__ = <method-wrapper '__hash__' of NoIdError object>
    __init__ = <bound method NoIdError.__init__ of NoIdError()>
    __module__ = 'cfgm_common.exceptions'
    __new__ = <built-in method __new__ of type object>
    __reduce__ = <built-in method __reduce__ of NoIdError object>
    __reduce_ex__ = <built-in method __reduce_ex__ of NoIdError object>
    __repr__ = <method-wrapper '__repr__' of NoIdError object>
    __setattr__ = <method-wrapper '__setattr__' of NoIdError object>
    __setstate__ = <built-in method __setstate__ of NoIdError object>
    __sizeof__ = <built-in method __sizeof__ of NoIdError object>
    __str__ = <bound method NoIdError.__str__ of NoIdError()>
    __subclasshook__ = <built-in method __subclasshook__ of type object>
    __unicode__ = <built-in method __unicode__ of NoIdError object>
    __weakref__ = None
    _unknown_id = u"Error: oper 2 url /virtual-machine-interface/5...ound for id 5039cc3b-59d2-4754-a2b6-e04c55df0e3a"
    args = ()
    message = ''

The above is a description of an error in a Python program. Here is
the original traceback:

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/vnc_openstack/neutron_plugin_interface.py", line 497, in plugin_update_floatingip
    floatingip['resource'])
  File "/usr/lib/python2.7/dist-packages/vnc_openstack/neutron_plugin_db.py", line 3368, in floatingip_update
    fip_obj = self._floatingip_neutron_to_vnc(fip_q, UPDATE)
  File "/usr/lib/python2.7/dist-packages/vnc_openstack/neutron_plugin_db.py", line 1942, in _floatingip_neutron_to_vnc
    port_id=fip_q['port_id'])
  File "/usr/lib/python2.7/dist-packages/vnc_openstack/neutron_plugin_db.py", line 671, in _virtual_machine_interface_read
    id=port_id, fields=n_extra_fields)
  File "/usr/lib/python2.7/dist-packages/vnc_api/gen/vnc_api_client_gen.py", line 5479, in virtual_machine_interface_read
    content = self._request_server(rest.OP_GET, uri, query_params)
  File "/usr/lib/python2.7/dist-packages/vnc_api/vnc_api.py", line 358, in _request_server
    % (op, url, data, content))
NoIdError: Unknown id: Error: oper 2 url /virtual-machine-interface/5039cc3b-59d2-4754-a2b6-e04c55df0e3a body {'fields': 'logical_router_back_refs,instance_ip_back_refs,floating_ip_back_refs'} response No virtual-machine-interface object found for id 5039cc3b-59d2-4754-a2b6-e04c55df0e3a

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/bottle.py", line 764, in _handle
    return route.call(**args)
  File "/usr/lib/python2.7/dist-packages/bottle.py", line 1625, in wrapper
    rv = callback(*a, **ka)
  File "/usr/lib/python2.7/dist-packages/bottle.py", line 1575, in wrapper
    rv = callback(*a, **ka)
  File "/usr/lib/python2.7/dist-packages/vnc_openstack/neutron_plugin_interface.py", line 561, in plugin_http_post_floatingip
    return self.plugin_update_floatingip(context, floatingip)
  File "/usr/lib/python2.7/dist-packages/vnc_openstack/neutron_plugin_interface.py", line 501, in plugin_update_floatingip
    raise e
NoIdError: Unknown id: Error: oper 2 url /virtual-machine-interface/5039cc3b-59d2-4754-a2b6-e04c55df0e3a body {'fields': 'logical_router_back_refs,instance_ip_back_refs,floating_ip_back_refs'} response No virtual-machine-interface object found for id 5039cc3b-59d2-4754-a2b6-e04c55df0e3a

Changed in opencontrail:
assignee: nobody → Numan Siddique (numansiddique)
status: New → In Progress
Changed in juniperopenstack:
importance: Undecided → Medium
assignee: nobody → Numan Siddique (numansiddique)
milestone: none → r1.11
Revision history for this message
Numan Siddique (numansiddique) wrote :
Changed in juniperopenstack:
status: New → Fix Committed
Changed in opencontrail:
status: In Progress → Fix Committed
Changed in juniperopenstack:
milestone: r1.11 → none
tags: added: config
Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] master

Review in progress for https://review.opencontrail.org/15495
Submitter: Antoine Eiche (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/15495
Committed: http://github.org/Juniper/contrail-neutron-plugin/commit/4f748c2c4db21763b82f7acacf60b0ce2253ac27
Submitter: Zuul
Branch: master

commit 4f748c2c4db21763b82f7acacf60b0ce2253ac27
Author: Antoine Eiche <email address hidden>
Date: Mon Nov 30 15:18:08 2015 +0100

Raise PortNotFound exception on floatingip-associate

This allows plugin v3 to show a helpful error message to the user.

Change-Id: Ia67410cc7d8562c489c0f1fd99116abb89c60df9
Partial-Bug: #1367262

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.