Comment 5 for bug 1518271

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

Reviewed: https://review.opencontrail.org/15885
Committed: http://github.org/Juniper/contrail-controller/commit/1141a8678ce7e67b4512973a2cfac5b0db749f4d
Submitter: Zuul
Branch: R2.20

commit 1141a8678ce7e67b4512973a2cfac5b0db749f4d
Author: Dan Bode <email address hidden>
Date: Mon May 11 21:58:02 2015 -0700

Fix port-creation compat issue with openstack kilo

Backporting commit 4d25ef1878ce1f2d1c3a1b2d15f7de43957c11f4 from master
to R2.21.x

Closes-Bug: 1518271

===========================================================
Currently, my attempts to use the contrail driver for
basic operations with openstack kilo have not work.

Specifically, I am not able to create ports.

when I perform the following actions:

neutron net-create foo
neutron port-create 88d35f71-4b9e-4667-845f-5c5ff1523446

It fails with the error:

Request Failed: internal server error while processing your request.

Looking in the contrail-api logs I can
see the following stacktrace: (note, this
stacktrace is from contrail 2.0, but this
issue is still present in master):

Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/vnc_openstack/neutron_plugin_interface.py", line 392, in plugin_create_port
net_info = cfgdb.port_create(context, port['resource'])
File "/usr/lib/python2.7/dist-packages/vnc_openstack/neutron_plugin_db.py", line 3472, in port_create
port_obj = self._port_neutron_to_vnc(port_q, net_obj, CREATE)
File "/usr/lib/python2.7/dist-packages/vnc_openstack/neutron_plugin_db.py", line 1849, in _port_neutron_to_vnc
for fixed_ip in port_q.get('fixed_ips', []):
TypeError: 'NoneType' object is not iterable

Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/bottle.py", line 856, in _handle
return route.call(**args)
File "/usr/lib/python2.7/dist-packages/bottle.py", line 1721, in wrapper
rv = callback(*a, **ka)
File "/usr/lib/python2.7/dist-packages/vnc_openstack/neutron_plugin_interface.py", line 467, in plugin_http_post_port
return self.plugin_create_port(context, port)
File "/usr/lib/python2.7/dist-packages/vnc_openstack/neutron_plugin_interface.py", line 396, in plugin_create_port
raise e
TypeError: 'NoneType' object is not iterable

the issue seems to be that in kilo version of openstack, the value
of the fixed_ip keys is None instead of not defined when there
are no fixed_ips.

The issue goes away by just performing a check to see if the
value is None, and I can create ports.

Change-Id: I1180ca8d8ced938920985cc542de35e45e1fede6