Expose additional vif params to bind/unbind scripts

Currently vif binding exposes endpoint ID, interface
name and port ID to the bind/unbind scripts in
kuryr/usr/libexec/kuryr. As part of this change,
additional parameters like network ID, mac address,
tenant ID have also been to bring Kuryr binding
in parity with os-vif, Nova vif bind/unbind mechanism.
This should enable the networking backends that
rely on this additional information to support Kuryr
vif binding.

Closes-Bug: #1550360
Closes-Bug: #1550735
Change-Id: I562af3de03a6e754b3148cef102be2555ef424b9
This commit is contained in:
Fawad Khaliq 2016-02-26 09:41:57 -08:00
parent eac8baa53c
commit 332889c815
1 changed files with 10 additions and 4 deletions

View File

@ -113,10 +113,14 @@ def port_bind(endpoint_id, neutron_port, neutron_subnets):
vif_type = neutron_port.get(VIF_TYPE_KEY, FALLBACK_VIF_TYPE)
binding_exec_path = os.path.join(config.CONF.bindir, vif_type)
port_id = neutron_port['id']
network_id = neutron_port['network_id']
tenant_id = neutron_port['tenant_id']
mac_address = neutron_port['mac_address']
try:
stdout, stderr = processutils.execute(
binding_exec_path, BINDING_SUBCOMMAND, port_id, ifname,
endpoint_id, run_as_root=True)
endpoint_id, mac_address, network_id, tenant_id,
run_as_root=True)
except processutils.ProcessExecutionError:
with excutils.save_and_reraise_exception():
cleanup_veth(ifname)
@ -136,10 +140,12 @@ def port_unbind(endpoint_id, neutron_port):
vif_type = neutron_port.get(VIF_TYPE_KEY, FALLBACK_VIF_TYPE)
unbinding_exec_path = os.path.join(config.CONF.bindir, vif_type)
port_id = neutron_port['id']
stdout, stderr = processutils.execute(
unbinding_exec_path, UNBINDING_SUBCOMMAND, port_id, run_as_root=True)
ifname = endpoint_id[:8] + VETH_POSTFIX
port_id = neutron_port['id']
mac_address = neutron_port['mac_address']
stdout, stderr = processutils.execute(
unbinding_exec_path, UNBINDING_SUBCOMMAND, port_id, ifname,
endpoint_id, mac_address, run_as_root=True)
try:
cleanup_veth(ifname)
except pyroute2.netlink.NetlinkError: