From 057b54aa3e8a462b3ced9b53d7a55dd5a64a0e4e Mon Sep 17 00:00:00 2001 From: Remi Bergsma Date: Sun, 14 Feb 2016 14:39:53 +0100 Subject: [PATCH] CLOUDSTACK-9287 - Make sure private gw interface is not used for default gw --- .../patches/debian/config/opt/cloud/bin/cs/CsAddress.py | 2 +- .../patches/debian/config/opt/cloud/bin/cs/CsRedundant.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py index 41b5e9a9168..f74ff479123 100755 --- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py +++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py @@ -307,7 +307,7 @@ class CsIP: # The code looks redundant here, but we actually have to cater for routers and # VPC routers in a different manner. Please do not remove this block otherwise # The VPC default route will be broken. - if self.get_type() in ["public"]: + if self.get_type() in ["public"] and address["device"] in PUBLIC_INTERFACE: gateway = str(address["gateway"]) route.add_defaultroute(gateway) else: diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py index 77d0a6b9ccf..92f27cedc16 100755 --- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py +++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py @@ -41,6 +41,7 @@ from CsRoute import CsRoute import socket from time import sleep +PUBLIC_INTERFACE = ['eth0', 'eth1'] class CsRedundant(object): @@ -228,7 +229,7 @@ class CsRedundant(object): self.set_lock() logging.info("Router switched to fault mode") - ips = [ip for ip in self.address.get_ips() if ip.is_public()] + ips = [ip for ip in self.address.get_ips() if ip.is_public() and ip.get_device() in PUBLIC_INTERFACE] for ip in ips: CsHelper.execute("ifconfig %s down" % ip.get_device()) @@ -257,7 +258,7 @@ class CsRedundant(object): logging.debug("Setting router to backup") dev = '' - ips = [ip for ip in self.address.get_ips() if ip.is_public()] + ips = [ip for ip in self.address.get_ips() if ip.is_public() and ip.get_device() in PUBLIC_INTERFACE] for ip in ips: if dev == ip.get_device(): continue @@ -291,7 +292,7 @@ class CsRedundant(object): logging.debug("Setting router to master") dev = '' - ips = [ip for ip in self.address.get_ips() if ip.is_public()] + ips = [ip for ip in self.address.get_ips() if ip.is_public() and ip.get_device() in PUBLIC_INTERFACE] route = CsRoute() for ip in ips: if dev == ip.get_device():