Skip to content

Commit 3515f57

Browse files
committed
Merge pull request #1189 from ekholabs/fix/4.6-rvr_routers_state-CLOUDSTACK-9118
CLOUDSTACK-9118 - As a Developer I want the checkrouter.sh script to report the right information about RVR routers stateThis PR fixes the RVR routers state information retrieved by the Management Server via the ```checkrouter.sh``` script. In order to cover the changes, a new test has been added to the component/test_routers_network_ops.py test suite: test_03_RVR_Network_check_router_state * pr/1189: CLOUDSTACK-9118 - Adds integration test to cover routers state. CLOUDSTACK-9118 - Improves the existing checkrouter.sh script Signed-off-by: Remi Bergsma <github@remi.nl>
2 parents 6d3fffa + 848ef78 commit 3515f57

3 files changed

Lines changed: 223 additions & 69 deletions

File tree

systemvm/patches/debian/config/opt/cloud/bin/checkrouter.sh

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,17 @@ INTERFACE=eth1
2121
ROUTER_TYPE=$(cat /etc/cloudstack/cmdline.json | grep type | awk '{print $2;}' | sed -e 's/[,\"]//g')
2222
if [ $ROUTER_TYPE = "router" ]
2323
then
24-
INTERFACE=eth2
24+
ROUTER_STATE=$(ip addr | grep eth0 | grep inet | wc -l | xargs bash -c 'if [ $0 == 2 ]; then echo "MASTER"; else echo "BACKUP"; fi')
25+
STATUS=$ROUTER_STATE
26+
else
27+
ROUTER_STATE=$(ip addr | grep $INTERFACE | grep state | awk '{print $9;}')
28+
if [ $ROUTER_STATE = "UP" ]
29+
then
30+
STATUS=MASTER
31+
elif [ $ROUTER_STATE = "DOWN" ]
32+
then
33+
STATUS=BACKUP
34+
fi
2535
fi
2636

27-
ETH1_STATE=$(ip addr | grep $INTERFACE | grep state | awk '{print $9;}')
28-
if [ $ETH1_STATE = "UP" ]
29-
then
30-
STATUS=MASTER
31-
elif [ $ETH1_STATE = "DOWN" ]
32-
then
33-
STATUS=BACKUP
34-
fi
3537
echo "Status: ${STATUS}"

systemvm/patches/debian/config/opt/cloud/templates/checkrouter.sh.templ

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,17 @@ INTERFACE=eth1
2121
ROUTER_TYPE=$(cat /etc/cloudstack/cmdline.json | grep type | awk '{print $2;}' | sed -e 's/[,\"]//g')
2222
if [ $ROUTER_TYPE = "router" ]
2323
then
24-
INTERFACE=eth2
24+
ROUTER_STATE=$(ip addr | grep eth0 | grep inet | wc -l | xargs bash -c 'if [ $0 == 2 ]; then echo "MASTER"; else echo "BACKUP"; fi')
25+
STATUS=$ROUTER_STATE
26+
else
27+
ROUTER_STATE=$(ip addr | grep $INTERFACE | grep state | awk '{print $9;}')
28+
if [ $ROUTER_STATE = "UP" ]
29+
then
30+
STATUS=MASTER
31+
elif [ $ROUTER_STATE = "DOWN" ]
32+
then
33+
STATUS=BACKUP
34+
fi
2535
fi
2636

27-
ETH1_STATE=$(ip addr | grep $INTERFACE | grep state | awk '{print $9;}')
28-
if [ $ETH1_STATE = "UP" ]
29-
then
30-
STATUS=MASTER
31-
elif [ $ETH1_STATE = "DOWN" ]
32-
then
33-
STATUS=BACKUP
34-
fi
3537
echo "Status: ${STATUS}"

0 commit comments

Comments
 (0)