From fb33cb28aba7bfc829651e8881a9a6afa6a70a76 Mon Sep 17 00:00:00 2001 From: Wilder Rodrigues Date: Sat, 17 Oct 2015 14:48:08 +0200 Subject: [PATCH] CLOUDSTACK-8952 - Make the checkrouter.sh compatible with RVR as well --- .../debian/config/opt/cloud/bin/checkrouter.sh | 14 ++++++++++++-- .../opt/cloud/templates/checkrouter.sh.templ | 14 ++++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/systemvm/patches/debian/config/opt/cloud/bin/checkrouter.sh b/systemvm/patches/debian/config/opt/cloud/bin/checkrouter.sh index 9579b119cc1..f05b440e74b 100755 --- a/systemvm/patches/debian/config/opt/cloud/bin/checkrouter.sh +++ b/systemvm/patches/debian/config/opt/cloud/bin/checkrouter.sh @@ -16,10 +16,20 @@ # specific language governing permissions and limitations # under the License. -STATUS=BACKUP -ETH1_STATE=$(ip addr | grep eth1 | grep state | awk '{print $9;}') +STATUS=UNKNOWN +INTERFACE=eth1 +ROUTER_TYPE=$(cat /etc/cloudstack/cmdline.json | grep type | awk '{print $2;}' | sed -e 's/[,\"]//g') +if [ $ROUTER_TYPE = "router" ] +then + INTERFACE=eth2 +fi + +ETH1_STATE=$(ip addr | grep $INTERFACE | grep state | awk '{print $9;}') if [ $ETH1_STATE = "UP" ] then STATUS=MASTER +elif [ $ETH1_STATE = "DOWN" ] +then + STATUS=BACKUP fi echo "Status: ${STATUS}" \ No newline at end of file diff --git a/systemvm/patches/debian/config/opt/cloud/templates/checkrouter.sh.templ b/systemvm/patches/debian/config/opt/cloud/templates/checkrouter.sh.templ index 9579b119cc1..f05b440e74b 100755 --- a/systemvm/patches/debian/config/opt/cloud/templates/checkrouter.sh.templ +++ b/systemvm/patches/debian/config/opt/cloud/templates/checkrouter.sh.templ @@ -16,10 +16,20 @@ # specific language governing permissions and limitations # under the License. -STATUS=BACKUP -ETH1_STATE=$(ip addr | grep eth1 | grep state | awk '{print $9;}') +STATUS=UNKNOWN +INTERFACE=eth1 +ROUTER_TYPE=$(cat /etc/cloudstack/cmdline.json | grep type | awk '{print $2;}' | sed -e 's/[,\"]//g') +if [ $ROUTER_TYPE = "router" ] +then + INTERFACE=eth2 +fi + +ETH1_STATE=$(ip addr | grep $INTERFACE | grep state | awk '{print $9;}') if [ $ETH1_STATE = "UP" ] then STATUS=MASTER +elif [ $ETH1_STATE = "DOWN" ] +then + STATUS=BACKUP fi echo "Status: ${STATUS}" \ No newline at end of file