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
This commit is contained in:
Liping Mao 2016-10-10 08:58:59 +08:00
parent 98e27df5d7
commit 2740f78b9c
1 changed files with 5 additions and 5 deletions

View File

@ -64,11 +64,11 @@ def port_bind(endpoint_id, port, subnets, network=None, nested_port=None):
reuse=True, peer=container_ifname) as host_veth:
if not utils.is_up(host_veth):
host_veth.up()
with ip.interfaces[container_ifname] as container_veth:
utils._configure_container_iface(
container_veth, subnets,
fixed_ips=port.get(utils.FIXED_IP_KEY),
mtu=mtu, hwaddr=port[utils.MAC_ADDRESS_KEY].lower())
with ip.interfaces[container_ifname] as container_veth:
utils._configure_container_iface(
container_veth, subnets,
fixed_ips=port.get(utils.FIXED_IP_KEY),
mtu=mtu, hwaddr=port[utils.MAC_ADDRESS_KEY].lower())
except pyroute2.CreateException:
raise exceptions.VethCreationFailure(
'Virtual device creation failed.')