Terminate macvtap agent when physical_interface_mapping config not present
Starting the macvtap agent without specifying at least one physical_interface_mappings does not make sense. As it only supports layer2 networks (flat, vlan) an interface mapping is mandatory. An existing agent deployment without an interface mapping can not serve any networks to instances! This patch terminates the agent when no mapping is provided. As without this mapping the agent cannot serve any networks for instances, this patch can't really break existing deployments. UpgradeImpact Agent terminates when no physical_interface_mapping configuration is provided. Change-Id: I647cf4da55fda54e32b7047b84e0d7f671629fa7 Closes-Bug: #1587444
This commit is contained in:
parent
4f36d4e3fe
commit
557e0c0a4c
@ -173,6 +173,11 @@ class MacvtapManager(amb.CommonAgentManagerBase):
|
|||||||
|
|
||||||
|
|
||||||
def parse_interface_mappings():
|
def parse_interface_mappings():
|
||||||
|
if not cfg.CONF.macvtap.physical_interface_mappings:
|
||||||
|
LOG.error(_LE("No physical_interface_mappings provided, but at least "
|
||||||
|
"one mapping is required. Agent terminated!"))
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
interface_mappings = n_utils.parse_mappings(
|
interface_mappings = n_utils.parse_mappings(
|
||||||
cfg.CONF.macvtap.physical_interface_mappings)
|
cfg.CONF.macvtap.physical_interface_mappings)
|
||||||
|
@ -191,6 +191,11 @@ class TestMacvtapMain(base.BaseTestCase):
|
|||||||
macvtap_neutron_agent.parse_interface_mappings()
|
macvtap_neutron_agent.parse_interface_mappings()
|
||||||
mock_exit.assert_called_with(1)
|
mock_exit.assert_called_with(1)
|
||||||
|
|
||||||
|
def test_parse_interface_mappings_no_mapping(self):
|
||||||
|
with mock.patch.object(sys, 'exit') as mock_exit:
|
||||||
|
macvtap_neutron_agent.parse_interface_mappings()
|
||||||
|
mock_exit.assert_called_with(1)
|
||||||
|
|
||||||
def test_validate_firewall_driver_noop_long(self):
|
def test_validate_firewall_driver_noop_long(self):
|
||||||
cfg.CONF.set_override('firewall_driver',
|
cfg.CONF.set_override('firewall_driver',
|
||||||
'neutron.agent.firewall.NoopFirewallDriver',
|
'neutron.agent.firewall.NoopFirewallDriver',
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
upgrade:
|
||||||
|
- After upgrade, a macvtap agent without
|
||||||
|
physical_interface_mappings configured can not
|
||||||
|
be started. Specify a valid mapping to be able
|
||||||
|
to start and use the macvtap agent.
|
Loading…
Reference in New Issue
Block a user