From 835cf06e032d1271ac831b2acc2ff542f1022848 Mon Sep 17 00:00:00 2001 From: Alexandru Avadanii Date: Sat, 18 Aug 2018 02:10:36 +0200 Subject: [lib.sh] Add veth pair handling support Upcoming docker integration requires special care for network interfaces Docker will hook to, so virsh networks can be mixed with Docker networks. We'll use veth pair(s) to hook together the Docker network(s) to their counterpart virsh-managed Linux bridge(s). JIRA: FUEL-383 Change-Id: I1a714dc8be73e79539d85bacac311d1ed05cc18d Signed-off-by: Alexandru Avadanii --- mcp/scripts/lib.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'mcp/scripts') diff --git a/mcp/scripts/lib.sh b/mcp/scripts/lib.sh index d7af97c9b..f5affb0d3 100644 --- a/mcp/scripts/lib.sh +++ b/mcp/scripts/lib.sh @@ -376,9 +376,9 @@ function jumpserver_check_requirements { } function create_networks { - local vnode_networks=("$@") + local all_vnode_networks=("mcpcontrol" "$@") # create required networks, including constant "mcpcontrol" - for net in "mcpcontrol" "${vnode_networks[@]}"; do + for net in "${all_vnode_networks[@]}"; do if virsh net-info "${net}" >/dev/null 2>&1; then virsh net-destroy "${net}" || true virsh net-undefine "${net}" @@ -391,6 +391,14 @@ function create_networks { virsh net-start "${net}" fi done + # create veth pairs for relevant networks (mcpcontrol, pxebr, mgmt) + for i in $(seq 0 2 4); do + sudo ip link del "veth_mcp$i" || true + sudo ip link add "veth_mcp$i" type veth peer name "veth_mcp$((i+1))" + sudo ip link set "veth_mcp$i" up mtu 9000 + sudo ip link set "veth_mcp$((i+1))" up mtu 9000 + sudo brctl addif "${all_vnode_networks[$((i/2))]}" "veth_mcp$i" + done } function create_vms { -- cgit 1.2.3-korg