Merge branch 'master' of ssh://git.onelab.eu/git/sliver-openvswitch
authorGiuseppe Lettieri <g.lettieri@iet.unipi.it>
Tue, 11 Sep 2012 07:49:04 +0000 (09:49 +0200)
committerGiuseppe Lettieri <g.lettieri@iet.unipi.it>
Tue, 11 Sep 2012 07:49:04 +0000 (09:49 +0200)
Conflicts:
planetlab/scripts/sliver-ovs

1  2 
planetlab/scripts/sliver-ovs

@@@ -193,12 -184,9 +193,12 @@@ function create_port () 
      port=$1; shift
      [[ -n "$@" ]] || error "$COMMAND create-port <bridge> <port>"
  
 +    # ensure ovs-vswitchd is running
 +    is_switch_running || { echo "ovs-vswitchd not running" >&2 ; exit 1 ; }
 +
      set -e
-     if ! ovs-vsctl --db=$DB_SOCKET list-ports "$bridge" | grep -q "^$port\$"; then
-       ovs-vsctl --db=$DB_SOCKET add-port "$bridge" "$port" -- set interface "$port" type=tunnel
+     if ! ovs-vsctl --db=unix:$DB_SOCKET list-ports "$bridge" | grep -q "^$port\$"; then
+       ovs-vsctl --db=unix:$DB_SOCKET add-port "$bridge" "$port" -- set interface "$port" type=tunnel
      fi
      ovs-appctl --target=$SWITCH_SOCKET netdev-tunnel/get-port "$port"
      return 0
@@@ -212,16 -200,10 +212,15 @@@ function del_bridge () 
      [[ -n "$@" ]] && error "Usage: ${COMMAND} del-bridge <bridge name>"
  
      W=
 -    is_switch_running || W="--no-wait"
 +    if ! is_switch_running; then
 +      # we can delete the bridge even if ovs-vswitchd is not running,
 +      # but we need a running ovsdb-server
 +      is_db_running || { echo "ovsdb-server not running" >&2; exit 1; }
 +      W="--no-wait"
 +    fi
  
-     set -e
-     if ovs-vsctl --db=$DB_SOCKET $W br-exists "$bridge_name"; then
-       ovs-vsctl --db=$DB_SOCKET $W del-br $bridge_name
+     if ovs-vsctl --db=unix:$DB_SOCKET br-exists "$bridge_name"; then
+       ovs-vsctl --db=unix:$DB_SOCKET $W del-br $bridge_name
      fi
      return 0
  }
@@@ -231,17 -213,9 +230,17 @@@ function del_port () 
      bridge_name=$1; shift
      [[ -n "$@" ]] && error "Usage: ${COMMAND} del-port <port>"
  
 +    W=
 +    if ! is_switch_running; then
 +      # we can delete the port even if ovs-vswitchd is not running,
 +      # but we need a running ovsdb-server
 +      is_db_running || { echo "ovsdb-server not running" >&2; exit 1; }
 +      W="--no-wait"
 +    fi
 +
      set -e
-     if ovs-vsctl --db=$DB_SOCKET $W port-to-br "$1" >/dev/null 2>&1; then
-       ovs-vsctl --db=$DB_SOCKET $W del-port "$1"
+     if ovs-vsctl --db=unix:$DB_SOCKET port-to-br "$1" >/dev/null 2>&1; then
 -      ovs-vsctl --db=unix:$DB_SOCKET del-port "$1"
++      ovs-vsctl --db=unix:$DB_SOCKET $W del-port "$1"
      fi
      return 0
  }