return key error when start container with kuryr binding veth driver

Bug #1631817 reported by Liping Mao
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
kuryr
Fix Released
Undecided
Liping Mao

Bug Description

Environment:
kuryr-libnetwork with kuryr veth binding driver. then start a container, get the following error log.

Error Log:
2016-10-09 14:01:31.923 17170 ERROR kuryr_libnetwork [-] Exception on /NetworkDriver.Join [POST]
2016-10-09 14:01:31.923 17170 ERROR kuryr_libnetwork Traceback (most recent call last):
2016-10-09 14:01:31.923 17170 ERROR kuryr_libnetwork File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1988, in wsgi_app
2016-10-09 14:01:31.923 17170 ERROR kuryr_libnetwork response = self.full_dispatch_request()
2016-10-09 14:01:31.923 17170 ERROR kuryr_libnetwork File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1641, in full_dispatch_request
2016-10-09 14:01:31.923 17170 ERROR kuryr_libnetwork rv = self.handle_user_exception(e)
2016-10-09 14:01:31.923 17170 ERROR kuryr_libnetwork File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1544, in handle_user_exception
2016-10-09 14:01:31.923 17170 ERROR kuryr_libnetwork reraise(exc_type, exc_value, tb)
2016-10-09 14:01:31.923 17170 ERROR kuryr_libnetwork File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1639, in full_dispatch_request
2016-10-09 14:01:31.923 17170 ERROR kuryr_libnetwork rv = self.dispatch_request()
2016-10-09 14:01:31.923 17170 ERROR kuryr_libnetwork File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1625, in dispatch_request
2016-10-09 14:01:31.923 17170 ERROR kuryr_libnetwork return self.view_functions[rule.endpoint](**req.view_args)
2016-10-09 14:01:31.923 17170 ERROR kuryr_libnetwork File "/opt/stack/kuryr-libnetwork/kuryr_libnetwork/controllers.py", line 961, in network_driver_join
2016-10-09 14:01:31.923 17170 ERROR kuryr_libnetwork endpoint_id, neutron_port, all_subnets, filtered_networks[0])
2016-10-09 14:01:31.923 17170 ERROR kuryr_libnetwork File "/opt/stack/kuryr/kuryr/lib/binding/__init__.py", line 38, in port_bind
2016-10-09 14:01:31.923 17170 ERROR kuryr_libnetwork nested_port=nested_port)
2016-10-09 14:01:31.923 17170 ERROR kuryr_libnetwork File "/opt/stack/kuryr/kuryr/lib/binding/drivers/veth.py", line 67, in port_bind
2016-10-09 14:01:31.923 17170 ERROR kuryr_libnetwork with ip.interfaces[container_ifname] as container_veth:
2016-10-09 14:01:31.923 17170 ERROR kuryr_libnetwork KeyError: u't_c640333a0-e4'
2016-10-09 14:01:31.923 17170 ERROR kuryr_libnetwork
[2016-10-09 14:01:31,923] ERROR in utils: Unexpected error happened: u't_c640333a0-e4'

This is because wrong logical in veth driver, should not use nested with here.
63 with ip.create(ifname=host_ifname, kind=KIND,
64 reuse=True, peer=container_ifname) as host_veth:
65 if not utils.is_up(host_veth):
66 host_veth.up()
67 -> with ip.interfaces[container_ifname] as container_veth:
68 utils._configure_container_iface(
69 container_veth, subnets,
70 fixed_ips=port.get(utils.FIXED_IP_KEY),
71 mtu=mtu, hwaddr=port[utils.MAC_ADDRESS_KEY].lower())
72 except pyroute2.CreateException:
(Pdb) p container_ifname
u't_c640333a0-e4'
(Pdb) p ip.interfaces[container_ifname]
*** KeyError: KeyError(u't_c640333a0-e4',)

Liping Mao (limao)
Changed in kuryr:
assignee: nobody → Liping Mao (limao)
Changed in kuryr:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to kuryr (master)

Reviewed: https://review.openstack.org/384248
Committed: https://git.openstack.org/cgit/openstack/kuryr/commit/?id=2740f78b9c60fa1e20c80cc3bf0dc65c09b8bf0a
Submitter: Jenkins
Branch: master

commit 2740f78b9c60fa1e20c80cc3bf0dc65c09b8bf0a
Author: Liping Mao <email address hidden>
Date: Mon Oct 10 08:58:59 2016 +0800

    return key error when start container with kuryr binding veth driver

    the veth should be created before we call ip.interfaces[container_ifname].

    Change-Id: Ifc56317433f3691841411be63e5e5f5ab56aeacf
    Closes-bug: #1631817

Changed in kuryr:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/kuryr 0.2.0

This issue was fixed in the openstack/kuryr 0.2.0 release.

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.