Merge "Terminate macvtap agent when physical_interface_mapping config not present"

This commit is contained in:
Jenkins 2017-02-06 11:17:03 +00:00 committed by Gerrit Code Review
commit f8e942c5bd
3 changed files with 16 additions and 0 deletions

View File

@ -174,6 +174,11 @@ class MacvtapManager(amb.CommonAgentManagerBase):
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:
interface_mappings = helpers.parse_mappings(
cfg.CONF.macvtap.physical_interface_mappings)

View File

@ -189,6 +189,11 @@ class TestMacvtapMain(base.BaseTestCase):
macvtap_neutron_agent.parse_interface_mappings()
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):
cfg.CONF.set_override('firewall_driver',
'neutron.agent.firewall.NoopFirewallDriver',

View File

@ -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.