From 9d789cd4a7f44f838e21c5e97fea5f9c4bb57cb2 Mon Sep 17 00:00:00 2001 From: kexiaodong Date: Mon, 21 Dec 2015 00:21:11 -0800 Subject: [PATCH] Fix the unbind_port method in libexec of ovs. Change-Id: Iae52e4b2545281fb2e5f203d811877b928e15c89 Closes-Bug:#1528121 --- usr/libexec/kuryr/ovs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/usr/libexec/kuryr/ovs b/usr/libexec/kuryr/ovs index c391564c..e90b74aa 100755 --- a/usr/libexec/kuryr/ovs +++ b/usr/libexec/kuryr/ovs @@ -19,11 +19,19 @@ bind_port() { sudo ovs-vsctl add-port $INT_BRIDGE $2 sudo ovs-vsctl set interface $2 external_ids:attached-mac=$mac \ external_ids:iface-id=$1 external_ids:vm-id=$3 \ - external_ids:iface-status=active + external_ids:iface-status=active external_ids:owner=kuryr } unbind_port() { echo "unplugging veth $1..." + PORT=`sudo ovs-vsctl --data=bare --no-heading --columns=name \ + find interface external_ids:iface-id=$1 \ + external_ids:owner=kuryr` + if [ -z "$PORT" ]; then + echo >&2 "Failed to find port $1." + exit 1 + fi + sudo ovs-vsctl del-port $INT_BRIDGE $PORT } case $1 in