Macvtap: Allow noop alias as FW driver

The macvtap agent only works with the NoopFWDriver. If another
driver is configured it terminates. Today only the explicit
configuration "neutron.agent.firewall.NoopFirewallDriver" is
accepted. This patch enables the macvtap agent to also accept
the alias "noop"

Change-Id: I0d6f0b780a3881419243f12487e8b3d10e709f6c
Closes-Bug: #1587498
This commit is contained in:
Andreas Scheuring 2016-05-31 16:31:33 +02:00
parent 01a9d41ceb
commit 96d1d914ca
2 changed files with 14 additions and 5 deletions

View File

@ -186,11 +186,14 @@ def parse_interface_mappings():
def validate_firewall_driver():
fw_driver = cfg.CONF.SECURITYGROUP.firewall_driver
if fw_driver != 'neutron.agent.firewall.NoopFirewallDriver':
supported_fw_drivers = ['neutron.agent.firewall.NoopFirewallDriver',
'noop']
if fw_driver not in supported_fw_drivers:
LOG.error(_LE('Unsupported configuration option for "SECURITYGROUP.'
'firewall_driver"! Only "neutron.agent.firewall.'
'NoopFirewallDriver" is supported by macvtap agent, but'
'"%s" is configured. Agent terminated!'),
'firewall_driver"! Only the NoopFirewallDriver is '
'supported by macvtap agent, but "%s" is configured. '
'Set the firewall_driver to "noop" and start the '
'agent again. Agent terminated!'),
fw_driver)
sys.exit(1)

View File

@ -191,12 +191,18 @@ class TestMacvtapMain(base.BaseTestCase):
macvtap_neutron_agent.parse_interface_mappings()
mock_exit.assert_called_with(1)
def test_validate_firewall_driver_noop(self):
def test_validate_firewall_driver_noop_long(self):
cfg.CONF.set_override('firewall_driver',
'neutron.agent.firewall.NoopFirewallDriver',
'SECURITYGROUP')
macvtap_neutron_agent.validate_firewall_driver()
def test_validate_firewall_driver_noop(self):
cfg.CONF.set_override('firewall_driver',
'noop',
'SECURITYGROUP')
macvtap_neutron_agent.validate_firewall_driver()
def test_validate_firewall_driver_other(self):
cfg.CONF.set_override('firewall_driver',
'foo',