Refactor
This commit is contained in:
1 parent
9eeec2fa48
commit
e8ed9c707d
1 file changed
+12
-7
@@ -225,17 +225,22 @@ connect_container_to_bridge() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
if run_tool host ethtool -K $GUEST_IFNAME tx off >/dev/null &&
|
||||
ip link set $LOCAL_IFNAME master $BRIDGE &&
|
||||
ip link set $LOCAL_IFNAME up &&
|
||||
ip link set $GUEST_IFNAME netns $NETNS ; then
|
||||
ip netns exec $NETNS ip link set $GUEST_IFNAME name $CONTAINER_IFNAME
|
||||
else
|
||||
if ! run_tool host ethtool -K $GUEST_IFNAME tx off >/dev/null ||
|
||||
! ip link set $LOCAL_IFNAME master $BRIDGE ||
|
||||
! ip link set $LOCAL_IFNAME up ||
|
||||
! ip link set $GUEST_IFNAME netns $NETNS ; then
|
||||
# failed before we assigned the veth to the container's
|
||||
# namespace - delete it
|
||||
# namespace
|
||||
ip link del $LOCAL_IFNAME type veth || true
|
||||
return 1
|
||||
fi
|
||||
|
||||
if ! ip netns exec $NETNS ip link set $GUEST_IFNAME name $CONTAINER_IFNAME ; then
|
||||
# failed after we assigned the veth to the container's
|
||||
# namespace
|
||||
ip netns exec $NETNS ip link del $GUEST_IFNAME type veth || true
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
launch() {
|
||||
|
||||
Reference in new issue
Block a user