X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=planetlab%2Fscripts%2Fsliver-ovs.in;h=f7a777868c18747722ebc1803d8563405b010a48;hb=6d7d2ace1494936d11b8cabcec26c7e4d0fdda68;hp=d72be7286a4ce0b7039cbbd54955d2f438d91630;hpb=ce5e922f9be1600e40cb2b55df5e54aded2fc9b2;p=sliver-openvswitch.git diff --git a/planetlab/scripts/sliver-ovs.in b/planetlab/scripts/sliver-ovs.in index d72be7286..f7a777868 100755 --- a/planetlab/scripts/sliver-ovs.in +++ b/planetlab/scripts/sliver-ovs.in @@ -67,10 +67,10 @@ function wait_server () { } function wait_device () { - tapname=$1; shift - timeout=$1; shift + local tapname=$1; shift + local timeout=$1; shift - expire=$(($(date +%s) + $timeout)) + local expire=$(($(date +%s) + $timeout)) while ! ip link show up | egrep -q "^[0-9]+: +$tapname:"; do echo "Waiting for $tapname to come UP...$(($expire - $(date +%s)))s left" >&2 @@ -97,19 +97,15 @@ function start_db () { [ -d $RUN_DIR ] || { echo "Could not initialize $RUN_DIR - exiting" ; exit 1 ; } ## run the stuff - if [ ! -f "$RUN_DIR/ovsdb-server.pid" ]; then ovsdb-server $DB_CONF_FILE \ --remote=punix:$DB_SOCKET \ - --remote=db:Open_vSwitch,manager_options \ - --private-key=db:SSL,private_key \ - --certificate=db:SSL,certificate \ - --bootstrap-ca-cert=db:SSL,ca_cert \ + --remote=db:Open_vSwitch,Open_vSwitch,manager_options \ + --private-key=db:Open_vSwitch,SSL,private_key \ + --certificate=db:Open_vSwitch,SSL,certificate \ + --bootstrap-ca-cert=db:Open_vSwitch,SSL,ca_cert \ --pidfile \ --log-file=$DB_LOG \ --detach >& /dev/null - else - echo 'ovsdb-server appears to be running already, *not* starting' - fi wait_server $RUN_DIR/ovsdb-server.pid ovsdb-server 30 } @@ -119,15 +115,11 @@ function start_switch () { # ensure ovsdb-server is running is_db_running || { echo "ovsdb-server not running" >&2 ; exit 1 ; } - if [ ! -f "$RUN_DIR/ovs-vswitchd.pid" ] ; then ovs-vswitchd \ --pidfile \ --log-file=$SWITCH_LOG \ --detach \ unix:$DB_SOCKET >& /dev/null - else - echo 'ovs-vswitchd appears to be running already, *not* starting' - fi wait_server $RUN_DIR/ovs-vswitchd.pid ovs-vswitchd 30 } @@ -177,6 +169,12 @@ function create_bridge () { -- set bridge "$bridge" datapath_type=planetlab \ -- set interface "$bridge" options:local_ip="$IP" option:local_netmask="$PREFIX" \ -- "$@" + + # check that the bridge has actually been created + if [ -z "$W" ]; then + local tap=$(ovs-appctl netdev-pltap/get-tapname "$bridge") + wait_device $tap 10 + fi } function create_port () {