Merge "Remove deprecated opt keepalived_use_no_track"
This commit is contained in:
commit
e44a8e9ae4
@ -117,13 +117,8 @@ class KeepalivedVipAddress(object):
|
|||||||
result = '%s dev %s' % (self.ip_address, self.interface_name)
|
result = '%s dev %s' % (self.ip_address, self.interface_name)
|
||||||
if self.scope:
|
if self.scope:
|
||||||
result += ' scope %s' % self.scope
|
result += ' scope %s' % self.scope
|
||||||
if cfg.CONF.keepalived_use_no_track and not self.track:
|
if not self.track and _is_keepalived_use_no_track_supported():
|
||||||
if _is_keepalived_use_no_track_supported():
|
|
||||||
result += ' no_track'
|
result += ' no_track'
|
||||||
else:
|
|
||||||
LOG.warning("keepalived_use_no_track cfg option is True but "
|
|
||||||
"keepalived on host seems to not support this "
|
|
||||||
"option")
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
@ -145,13 +140,8 @@ class KeepalivedVirtualRoute(object):
|
|||||||
output += ' dev %s' % self.interface_name
|
output += ' dev %s' % self.interface_name
|
||||||
if self.scope:
|
if self.scope:
|
||||||
output += ' scope %s' % self.scope
|
output += ' scope %s' % self.scope
|
||||||
if cfg.CONF.keepalived_use_no_track:
|
|
||||||
if _is_keepalived_use_no_track_supported():
|
if _is_keepalived_use_no_track_supported():
|
||||||
output += ' no_track'
|
output += ' no_track'
|
||||||
else:
|
|
||||||
LOG.warning("keepalived_use_no_track cfg option is True but "
|
|
||||||
"keepalived on host seems to not support this "
|
|
||||||
"option")
|
|
||||||
# NOTE(mstinsky): neutron and keepalived are adding the same routes on
|
# NOTE(mstinsky): neutron and keepalived are adding the same routes on
|
||||||
# primary routers. With this we ensure that both are adding the routes
|
# primary routers. With this we ensure that both are adding the routes
|
||||||
# with the same procotol and prevent duplicated routes which result in
|
# with the same procotol and prevent duplicated routes which result in
|
||||||
|
@ -107,17 +107,6 @@ OPTS = [
|
|||||||
'the state change monitor. NOTE: Setting to True '
|
'the state change monitor. NOTE: Setting to True '
|
||||||
'could affect the data plane when stopping or '
|
'could affect the data plane when stopping or '
|
||||||
'restarting the L3 agent.')),
|
'restarting the L3 agent.')),
|
||||||
cfg.BoolOpt('keepalived_use_no_track',
|
|
||||||
default=True,
|
|
||||||
deprecated_for_removal=True,
|
|
||||||
deprecated_reason='By keepalived version detection introduced '
|
|
||||||
'by https://review.opendev.org/757620 there '
|
|
||||||
'is no need for this config option. To be '
|
|
||||||
'removed in X.',
|
|
||||||
help=_('If keepalived without support for "no_track" option '
|
|
||||||
'is used, this should be set to False. '
|
|
||||||
'Support for this option was introduced in keepalived '
|
|
||||||
'2.x'))
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -220,61 +220,6 @@ class KeepalivedConfTestCase(KeepalivedBaseTestCase,
|
|||||||
self.assertEqual(['192.168.2.0/24', '192.168.3.0/24'], current_vips)
|
self.assertEqual(['192.168.2.0/24', '192.168.3.0/24'], current_vips)
|
||||||
|
|
||||||
|
|
||||||
class KeepalivedConfWithoutNoTrackTestCase(KeepalivedConfTestCase):
|
|
||||||
|
|
||||||
expected = KEEPALIVED_GLOBAL_CONFIG + textwrap.dedent("""
|
|
||||||
vrrp_instance VR_1 {
|
|
||||||
state MASTER
|
|
||||||
interface eth0
|
|
||||||
virtual_router_id 1
|
|
||||||
priority 50
|
|
||||||
garp_master_delay 60
|
|
||||||
advert_int 5
|
|
||||||
authentication {
|
|
||||||
auth_type AH
|
|
||||||
auth_pass pass123
|
|
||||||
}
|
|
||||||
track_interface {
|
|
||||||
eth0
|
|
||||||
}
|
|
||||||
virtual_ipaddress {
|
|
||||||
169.254.0.1/24 dev eth0
|
|
||||||
}
|
|
||||||
virtual_ipaddress_excluded {
|
|
||||||
192.168.1.0/24 dev eth1
|
|
||||||
192.168.2.0/24 dev eth2
|
|
||||||
192.168.3.0/24 dev eth2
|
|
||||||
192.168.55.0/24 dev eth10
|
|
||||||
}
|
|
||||||
virtual_routes {
|
|
||||||
0.0.0.0/0 via 192.168.1.1 dev eth1 protocol static
|
|
||||||
}
|
|
||||||
}
|
|
||||||
vrrp_instance VR_2 {
|
|
||||||
state MASTER
|
|
||||||
interface eth4
|
|
||||||
virtual_router_id 2
|
|
||||||
priority 50
|
|
||||||
garp_master_delay 60
|
|
||||||
mcast_src_ip 224.0.0.1
|
|
||||||
track_interface {
|
|
||||||
eth4
|
|
||||||
}
|
|
||||||
virtual_ipaddress {
|
|
||||||
169.254.0.2/24 dev eth4
|
|
||||||
}
|
|
||||||
virtual_ipaddress_excluded {
|
|
||||||
192.168.2.0/24 dev eth2
|
|
||||||
192.168.3.0/24 dev eth6
|
|
||||||
192.168.55.0/24 dev eth10
|
|
||||||
}
|
|
||||||
}""")
|
|
||||||
|
|
||||||
def setUp(self):
|
|
||||||
super(KeepalivedConfWithoutNoTrackTestCase, self).setUp()
|
|
||||||
cfg.CONF.set_override('keepalived_use_no_track', False)
|
|
||||||
|
|
||||||
|
|
||||||
class KeepalivedStateExceptionTestCase(KeepalivedBaseTestCase):
|
class KeepalivedStateExceptionTestCase(KeepalivedBaseTestCase):
|
||||||
def test_state_exception(self):
|
def test_state_exception(self):
|
||||||
invalid_vrrp_state = 'a seal walks'
|
invalid_vrrp_state = 'a seal walks'
|
||||||
@ -353,12 +298,6 @@ class KeepalivedInstanceRoutesTestCase(KeepalivedBaseTestCase):
|
|||||||
self.assertEqual(self._get_no_track_less_expected_config(),
|
self.assertEqual(self._get_no_track_less_expected_config(),
|
||||||
'\n'.join(routes.build_config()))
|
'\n'.join(routes.build_config()))
|
||||||
|
|
||||||
def test_build_config_without_no_track_option(self):
|
|
||||||
cfg.CONF.set_override('keepalived_use_no_track', False)
|
|
||||||
routes = self._get_instance_routes()
|
|
||||||
self.assertEqual(self._get_no_track_less_expected_config(),
|
|
||||||
'\n'.join(routes.build_config()))
|
|
||||||
|
|
||||||
|
|
||||||
class KeepalivedInstanceTestCase(KeepalivedBaseTestCase,
|
class KeepalivedInstanceTestCase(KeepalivedBaseTestCase,
|
||||||
KeepalivedConfBaseMixin):
|
KeepalivedConfBaseMixin):
|
||||||
@ -432,10 +371,6 @@ class KeepalivedInstanceTestCase(KeepalivedBaseTestCase,
|
|||||||
return_value=False):
|
return_value=False):
|
||||||
self._test_remove_addresses_by_interface("")
|
self._test_remove_addresses_by_interface("")
|
||||||
|
|
||||||
def test_remove_addresses_by_interface_without_no_track(self):
|
|
||||||
cfg.CONF.set_override('keepalived_use_no_track', False)
|
|
||||||
self._test_remove_addresses_by_interface("")
|
|
||||||
|
|
||||||
def test_build_config_no_vips(self):
|
def test_build_config_no_vips(self):
|
||||||
expected = textwrap.dedent("""\
|
expected = textwrap.dedent("""\
|
||||||
vrrp_instance VR_1 {
|
vrrp_instance VR_1 {
|
||||||
@ -514,13 +449,6 @@ class KeepalivedVirtualRouteTestCase(KeepalivedBaseTestCase):
|
|||||||
self.assertEqual('0.0.0.0/0 via 1.2.3.4 dev eth0 protocol static',
|
self.assertEqual('0.0.0.0/0 via 1.2.3.4 dev eth0 protocol static',
|
||||||
route.build_config())
|
route.build_config())
|
||||||
|
|
||||||
def test_virtual_route_with_dev_without_no_track(self):
|
|
||||||
cfg.CONF.set_override('keepalived_use_no_track', False)
|
|
||||||
route = keepalived.KeepalivedVirtualRoute(n_consts.IPv4_ANY, '1.2.3.4',
|
|
||||||
'eth0')
|
|
||||||
self.assertEqual('0.0.0.0/0 via 1.2.3.4 dev eth0 protocol static',
|
|
||||||
route.build_config())
|
|
||||||
|
|
||||||
def test_virtual_route_without_dev(self):
|
def test_virtual_route_without_dev(self):
|
||||||
with mock.patch.object(
|
with mock.patch.object(
|
||||||
keepalived, '_is_keepalived_use_no_track_supported',
|
keepalived, '_is_keepalived_use_no_track_supported',
|
||||||
@ -537,12 +465,6 @@ class KeepalivedVirtualRouteTestCase(KeepalivedBaseTestCase):
|
|||||||
self.assertEqual('50.0.0.0/8 via 1.2.3.4 protocol static',
|
self.assertEqual('50.0.0.0/8 via 1.2.3.4 protocol static',
|
||||||
route.build_config())
|
route.build_config())
|
||||||
|
|
||||||
def test_virtual_route_without_dev_without_no_track(self):
|
|
||||||
cfg.CONF.set_override('keepalived_use_no_track', False)
|
|
||||||
route = keepalived.KeepalivedVirtualRoute('50.0.0.0/8', '1.2.3.4')
|
|
||||||
self.assertEqual('50.0.0.0/8 via 1.2.3.4 protocol static',
|
|
||||||
route.build_config())
|
|
||||||
|
|
||||||
|
|
||||||
class KeepalivedTrackScriptTestCase(KeepalivedBaseTestCase):
|
class KeepalivedTrackScriptTestCase(KeepalivedBaseTestCase):
|
||||||
|
|
||||||
|
@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
upgrade:
|
||||||
|
- |
|
||||||
|
The deprecated config option ``keepalived_use_no_track`` is removed.
|
Loading…
Reference in New Issue
Block a user