vr: Fix vpc router in UNKNOWN state (#3465)

If there are more than 10 vpc tiers or public ip subnets in a VPC, eth1X will be added in vpc router.
The redundant state is UNKNOWN in this case.
This commit is contained in:
Wei Zhou 2019-07-10 22:18:37 +02:00 committed by Rohit Yadav
parent b509e086f9
commit b7988a3e5f

View File

@ -27,10 +27,10 @@ fi
ROUTER_TYPE=$(cat /etc/cloudstack/cmdline.json | grep type | awk '{print $2;}' | sed -e 's/[,\"]//g')
if [ "$ROUTER_TYPE" = "router" ]
then
ROUTER_STATE=$(ip addr | grep eth0 | grep inet | wc -l | xargs bash -c 'if [ $0 == 2 ]; then echo "MASTER"; else echo "BACKUP"; fi')
ROUTER_STATE=$(ip addr show dev eth0 | grep inet | wc -l | xargs bash -c 'if [ $0 == 2 ]; then echo "MASTER"; else echo "BACKUP"; fi')
STATUS=$ROUTER_STATE
else
ROUTER_STATE=$(ip addr | grep eth1 | grep state | awk '{print $9;}')
ROUTER_STATE=$(ip addr show dev eth1 | grep state | awk '{print $9;}')
if [ "$ROUTER_STATE" = "UP" ]
then
STATUS=MASTER