mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
CLOUDSTACK-9287 - Make sure private gw interface is not used for default gw
This commit is contained in:
parent
250be376e8
commit
057b54aa3e
@ -307,7 +307,7 @@ class CsIP:
|
|||||||
# The code looks redundant here, but we actually have to cater for routers and
|
# 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
|
# VPC routers in a different manner. Please do not remove this block otherwise
|
||||||
# The VPC default route will be broken.
|
# 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"])
|
gateway = str(address["gateway"])
|
||||||
route.add_defaultroute(gateway)
|
route.add_defaultroute(gateway)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@ -41,6 +41,7 @@ from CsRoute import CsRoute
|
|||||||
import socket
|
import socket
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
|
PUBLIC_INTERFACE = ['eth0', 'eth1']
|
||||||
|
|
||||||
class CsRedundant(object):
|
class CsRedundant(object):
|
||||||
|
|
||||||
@ -228,7 +229,7 @@ class CsRedundant(object):
|
|||||||
self.set_lock()
|
self.set_lock()
|
||||||
logging.info("Router switched to fault mode")
|
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:
|
for ip in ips:
|
||||||
CsHelper.execute("ifconfig %s down" % ip.get_device())
|
CsHelper.execute("ifconfig %s down" % ip.get_device())
|
||||||
|
|
||||||
@ -257,7 +258,7 @@ class CsRedundant(object):
|
|||||||
logging.debug("Setting router to backup")
|
logging.debug("Setting router to backup")
|
||||||
|
|
||||||
dev = ''
|
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:
|
for ip in ips:
|
||||||
if dev == ip.get_device():
|
if dev == ip.get_device():
|
||||||
continue
|
continue
|
||||||
@ -291,7 +292,7 @@ class CsRedundant(object):
|
|||||||
logging.debug("Setting router to master")
|
logging.debug("Setting router to master")
|
||||||
|
|
||||||
dev = ''
|
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()
|
route = CsRoute()
|
||||||
for ip in ips:
|
for ip in ips:
|
||||||
if dev == ip.get_device():
|
if dev == ip.get_device():
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user