docklet/conf/lxc-script/lxc-ifdown

17 lines
560 B
Bash
Executable File

#!/bin/sh
# $1 : name of container ( name in lxc-start with -n)
# $2 : net
# $3 : network flags, up or down
# $4 : network type, for example, veth
# $5 : value of lxc.network.veth.pair
ovs-vsctl --if-exists del-port $Bridge $5
cnt=$(ovs-vsctl list-ports ${Bridge} | wc -l)
if [ "$cnt" = "1" ]; then
greport=$(ovs-vsctl list-ports $(Bridge) | grep "^gre-[[:digit:]][[:digit:]]*-[[:digit:]][[:digit:]]*\.[[:digit:]][[:digit:]]*\.[[:digit:]][[:digit:]]*\.[[:digit:]][[:digit:]]*$" | wc -l)
if [ "$greport" = "1" ]; then
ovs-vsctl del-br $Bridge
fi
fi