mcpcontrol: Avoid duplicate ip rules 13/67613/1
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Thu, 18 Apr 2019 15:16:32 +0000 (17:16 +0200)
committerAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Thu, 18 Apr 2019 15:17:04 +0000 (17:17 +0200)
Executing deploy.sh multiple times led to duplicating the ip rules.

Change-Id: Iad5886a851970f166996226fa3d115a93113c6db
Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
mcp/scripts/lib_jump_deploy.sh

index b7fe4c7..5d442eb 100644 (file)
@@ -329,8 +329,9 @@ function create_networks {
        ExecStart=/bin/sh -ec '\
          ${PREFIX}/brctl addif ${all_vnode_networks[0]} veth_mcp0 && \
          ${PREFIX}/brctl addif ${all_vnode_networks[1]} veth_mcp2 && \
+         while ${PREFIX}/ip rule del to ${SALT_MASTER} iif docker0 table 200 2>/dev/null; do true; done && \
          ${PREFIX}/ip rule add to ${SALT_MASTER} iif docker0 table 200 && \
-         ${PREFIX}/ip route add ${SALT_MASTER} dev ${all_vnode_networks[0]} table 200'
+         ${PREFIX}/ip route replace ${SALT_MASTER} dev ${all_vnode_networks[0]} table 200'
        EOF
   sudo ln -sf "${FUEL_VETHC_SERVICE}" "/etc/systemd/system/multi-user.target.wants/"
   sudo ln -sf "${FUEL_VETHA_SERVICE}" "/etc/systemd/system/multi-user.target.wants/"