Remove "create_bridge" routines
No longer needed in the weave script and thus, in weaveutil.
This commit is contained in:
1 parent
541adf6bb1
commit
1860f21efb
3 files changed
-57
No files matched your search
@@ -2,9 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
|
||||
"github.com/weaveworks/weave/common"
|
||||
weavenet "github.com/weaveworks/weave/net"
|
||||
)
|
||||
|
||||
@@ -22,36 +20,3 @@ func detectBridgeType(args []string) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func createBridge(args []string) error {
|
||||
if len(args) != 10 {
|
||||
cmdUsage("create-bridge", "<docker-bridge-name> <weave-bridge-name> <datapath-name> <mtu> <port> <mac> <no-fastdp> <no-bridged-fastdp> <proc-path> <expect-npc>")
|
||||
}
|
||||
|
||||
mtu, err := strconv.Atoi(args[3])
|
||||
if err != nil && args[3] != "" {
|
||||
return err
|
||||
}
|
||||
port, err := strconv.Atoi(args[4])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
config := weavenet.BridgeConfig{
|
||||
DockerBridgeName: args[0],
|
||||
WeaveBridgeName: args[1],
|
||||
DatapathName: args[2],
|
||||
MTU: mtu,
|
||||
Port: port,
|
||||
Mac: args[5],
|
||||
NoFastdp: args[6] != "",
|
||||
NoBridgedFastdp: args[7] != "",
|
||||
NPC: args[9] == "--expect-npc",
|
||||
}
|
||||
procPath := args[8]
|
||||
bridgeType, err := weavenet.EnsureBridge(procPath, &config, common.Log)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Println(bridgeType.String())
|
||||
return nil
|
||||
}
|
||||
@@ -17,7 +17,6 @@ func init() {
|
||||
"help": help,
|
||||
"netcheck": netcheck,
|
||||
"docker-tls-args": dockerTLSArgs,
|
||||
"create-bridge": createBridge,
|
||||
"detect-bridge-type": detectBridgeType,
|
||||
"create-datapath": createDatapath,
|
||||
"delete-datapath": deleteDatapath,
|
||||
|
||||
@@ -405,27 +405,6 @@ detect_bridge_type() {
|
||||
MTU=${WEAVE_MTU:-$(cat /sys/class/net/$BRIDGE/mtu)}
|
||||
}
|
||||
|
||||
try_create_bridge() {
|
||||
# Pass /dev/null because we do not have access to the weavedb files when this runs; BoltDB
|
||||
# cannot open the file anyway if weaver is running, which is likely for attach|expose|hide.
|
||||
MAC=$(util_op unique-id "/dev/null" "$HOST_ROOT")
|
||||
BRIDGE_TYPE=$(util_op create-bridge "$DOCKER_BRIDGE" "$BRIDGE" "$DATAPATH" "$WEAVE_MTU" "$PORT" "$MAC" "$WEAVE_NO_FASTDP" "$WEAVE_NO_BRIDGED_FASTDP" "$PROC_PATH" "$1")
|
||||
# Set some variables that are expected by code that comes later
|
||||
[ "$BRIDGE_TYPE" != "fastdp" ] || DATAPATH="$BRIDGE"
|
||||
MTU=${WEAVE_MTU:-$(cat /sys/class/net/$BRIDGE/mtu)}
|
||||
}
|
||||
|
||||
create_bridge() {
|
||||
validate_bridge_type
|
||||
if ! try_create_bridge "$@" ; then
|
||||
echo "Creating bridge '$BRIDGE' failed" >&2
|
||||
# reset to original value so we destroy both kinds
|
||||
DATAPATH=datapath
|
||||
destroy_bridge
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
validate_bridge_type() {
|
||||
detect_bridge_type || return 0
|
||||
|
||||
|
||||
Reference in new issue
Block a user