From b7988a3e5f1ef9774aefcb76a10be0cc00c4358f Mon Sep 17 00:00:00 2001 From: Wei Zhou Date: Wed, 10 Jul 2019 22:18:37 +0200 Subject: [PATCH] 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. --- systemvm/debian/opt/cloud/bin/checkrouter.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/systemvm/debian/opt/cloud/bin/checkrouter.sh b/systemvm/debian/opt/cloud/bin/checkrouter.sh index bb6c9f8a0f2..c0d2ea77019 100755 --- a/systemvm/debian/opt/cloud/bin/checkrouter.sh +++ b/systemvm/debian/opt/cloud/bin/checkrouter.sh @@ -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