Add deprecation notice for prevent-arp-spoofing

Config option will have no effect for >= Ocata.
Also adds log WARNING.

Change-Id: I06b78152a9e42e5411d6a426073641ce474573ff
Closes-Bug: 1691080
This commit is contained in:
Edward Hope-Morley 2017-08-24 12:32:38 +01:00
parent 65b5274f63
commit 3c2553b055
4 changed files with 31 additions and 7 deletions

View File

@ -142,6 +142,10 @@ options:
.
Only supported in OpenStack Liberty or newer, which has the required
minimum version of Open vSwitch.
.
NOTE: this feature is deprecated and removed in Openstack >= Ocata. As of
that point the only way to disable protection will be via the port
security extension (see LP 1691080 for info).
enable-dpdk:
type: boolean
default: false

View File

@ -18,6 +18,8 @@ import uuid
from pci import PCINetDevices
from charmhelpers.core.hookenv import (
config,
log,
WARNING,
relation_get,
relation_ids,
related_units,
@ -29,8 +31,12 @@ from charmhelpers.core.host import (
lsb_release,
)
from charmhelpers.contrib.openstack import context
from charmhelpers.contrib.openstack.utils import get_host_ip
from charmhelpers.contrib.openstack.utils import config_flags_parser
from charmhelpers.contrib.openstack.utils import (
config_flags_parser,
get_host_ip,
os_release,
CompareOpenStackReleases,
)
from charmhelpers.contrib.network.ip import get_address_in_network
from charmhelpers.contrib.openstack.context import (
OSContextGenerator,
@ -123,6 +129,14 @@ class OVSPluginContext(context.NeutronContext):
ovs_ctxt['use_syslog'] = conf['use-syslog']
ovs_ctxt['verbose'] = conf['verbose']
ovs_ctxt['debug'] = conf['debug']
cmp_release = CompareOpenStackReleases(
os_release('neutron-common', base='icehouse'))
if conf['prevent-arp-spoofing'] and cmp_release >= 'ocata':
log("prevent-arp-spoofing is True yet this feature is deprecated "
"and no longer has any effect in your version of Openstack",
WARNING)
ovs_ctxt['prevent_arp_spoofing'] = conf['prevent-arp-spoofing']
ovs_ctxt['enable_dpdk'] = conf['enable-dpdk']

View File

@ -35,11 +35,9 @@ from charmhelpers.contrib.openstack.utils import (
os_application_version_set,
remote_restart,
CompareOpenStackReleases,
)
from collections import OrderedDict
from charmhelpers.contrib.openstack.utils import (
os_release,
)
from collections import OrderedDict
import neutron_ovs_context
from charmhelpers.contrib.network.ovs import (
add_bridge,

View File

@ -96,6 +96,8 @@ class OVSPluginContextTest(CharmTestCase):
{'em1': 'br-d2'}
)
@patch.object(charmhelpers.contrib.openstack.utils,
'get_os_codename_package')
@patch.object(charmhelpers.contrib.openstack.context, 'config',
lambda *args: None)
@patch.object(charmhelpers.contrib.openstack.context, 'relation_get')
@ -112,7 +114,8 @@ class OVSPluginContextTest(CharmTestCase):
@patch.object(charmhelpers.contrib.openstack.context, 'unit_private_ip')
def test_neutroncc_context_api_rel(self, _unit_priv_ip, _npa, _ens_pkgs,
_save_ff, _https, _is_clus, _unit_get,
_config, _runits, _rids, _rget):
_config, _runits, _rids, _rget,
_get_os_cdnm_pkg):
def mock_npa(plugin, section, manager):
if section == "driver":
return "neutron.randomdriver"
@ -134,6 +137,7 @@ class OVSPluginContextTest(CharmTestCase):
return config
_get_os_cdnm_pkg.return_value = 'ocata'
self.maxDiff = None
self.config.side_effect = mock_config
_npa.side_effect = mock_npa
@ -180,6 +184,8 @@ class OVSPluginContextTest(CharmTestCase):
}
self.assertEquals(expect, napi_ctxt())
@patch.object(charmhelpers.contrib.openstack.utils,
'get_os_codename_package')
@patch.object(charmhelpers.contrib.openstack.context, 'relation_get')
@patch.object(charmhelpers.contrib.openstack.context, 'relation_ids')
@patch.object(charmhelpers.contrib.openstack.context, 'related_units')
@ -198,13 +204,15 @@ class OVSPluginContextTest(CharmTestCase):
_https, _is_clus,
_unit_get,
_config, _runits,
_rids, _rget):
_rids, _rget,
_get_os_cdnm_pkg):
def mock_npa(plugin, section, manager):
if section == "driver":
return "neutron.randomdriver"
if section == "config":
return "neutron.randomconfig"
_get_os_cdnm_pkg.return_value = 'ocata'
_npa.side_effect = mock_npa
_config.return_value = 'ovs'
_unit_get.return_value = '127.0.0.13'