Don't define polling_interval option in two places

The option is currently defined in two places - as a generic agent
option and as a sriov agent specific one. This is a problem now that
oslo.config tracks location where options are defined
(I6dec1e09dcab203c6287f9c56c866f220a42f850) because when unit test
runner imports all modules, it registers the option from those two
separate locations, and since locations are different, it's considered
the options are duplicate, which results in the following error:

DuplicateOptError: duplicate option: polling_interval

To fix the issue, I removed the definition of the option from sriov
module and made sure the common agent options are registered whenever
the sriov module is imported.

Change-Id: I485532692f4b3a5804885e0325a8352fe6b1aa65
Closes-Bug: #1759345
This commit is contained in:
Ihar Hrachyshka 2018-03-27 11:32:37 -07:00
parent 62d0d75229
commit a1b49c796e
2 changed files with 2 additions and 7 deletions

View File

@ -21,12 +21,6 @@ from neutron._i18n import _
DEFAULT_DEVICE_MAPPINGS = []
DEFAULT_EXCLUDE_DEVICES = []
agent_opts = [
cfg.IntOpt('polling_interval', default=2,
help=_("The number of seconds the agent will wait between "
"polling for local device changes.")),
]
sriov_nic_opts = [
cfg.ListOpt('physical_device_mappings',
default=DEFAULT_DEVICE_MAPPINGS,
@ -53,5 +47,4 @@ sriov_nic_opts = [
def register_agent_sriov_nic_opts(cfg=cfg.CONF):
cfg.register_opts(agent_opts, 'AGENT')
cfg.register_opts(sriov_nic_opts, 'SRIOV_NIC')

View File

@ -18,6 +18,7 @@ from oslo_config import cfg
from neutron._i18n import _
from neutron.conf.agent import common as config
from neutron.conf.plugins.ml2.drivers import agent
from neutron.conf.plugins.ml2.drivers.mech_sriov import agent_common as \
agent_common_config
@ -54,5 +55,6 @@ def parse_exclude_devices(exclude_list):
return exclude_mapping
agent.register_agent_opts()
agent_common_config.register_agent_sriov_nic_opts()
config.register_agent_state_opts_helper(cfg.CONF)