diff --git a/systemvm/patches/debian/config/opt/cloud/bin/checkrouter.sh b/systemvm/patches/debian/config/opt/cloud/bin/checkrouter.sh index 12b2da4e62d..1e4335c0fcc 100755 --- a/systemvm/patches/debian/config/opt/cloud/bin/checkrouter.sh +++ b/systemvm/patches/debian/config/opt/cloud/bin/checkrouter.sh @@ -16,9 +16,10 @@ # specific language governing permissions and limitations # under the License. -STATUS=$(cat /etc/cloudstack/cmdline.json | grep redundant_state | awk '{print $2;}' | sed -e 's/[,\"]//g') -if [ "$?" -ne "0" ] +STATUS=BACKUP +ETH1_STATE=$(ip addr | grep eth1 | grep state | awk '{print $9;}') +if [ $ETH1_STATE = "UP" ] then - STATUS=MASTER + STATUS=MASTER fi -echo "Status: ${STATUS}" +echo "Status: ${STATUS}" \ No newline at end of file diff --git a/systemvm/patches/debian/config/opt/cloud/bin/master.py b/systemvm/patches/debian/config/opt/cloud/bin/master.py index fb6ef6a6f9d..c3a1539688d 100755 --- a/systemvm/patches/debian/config/opt/cloud/bin/master.py +++ b/systemvm/patches/debian/config/opt/cloud/bin/master.py @@ -42,7 +42,9 @@ logging.basicConfig(filename=config.get_logger(), format=config.get_format()) config.cmdline() cl = CsCmdLine("cmdline", config) +#Update the configuration to set state as backup and let keepalived decide who is the real Master cl.set_master_state(False) +cl.save() config.set_address() red = CsRedundant(config) 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 12b2da4e62d..1e4335c0fcc 100755 --- a/systemvm/patches/debian/config/opt/cloud/templates/checkrouter.sh.templ +++ b/systemvm/patches/debian/config/opt/cloud/templates/checkrouter.sh.templ @@ -16,9 +16,10 @@ # specific language governing permissions and limitations # under the License. -STATUS=$(cat /etc/cloudstack/cmdline.json | grep redundant_state | awk '{print $2;}' | sed -e 's/[,\"]//g') -if [ "$?" -ne "0" ] +STATUS=BACKUP +ETH1_STATE=$(ip addr | grep eth1 | grep state | awk '{print $9;}') +if [ $ETH1_STATE = "UP" ] then - STATUS=MASTER + STATUS=MASTER fi -echo "Status: ${STATUS}" +echo "Status: ${STATUS}" \ No newline at end of file