Merge "Refactor DHCP common config options"
This commit is contained in:
commit
6196c0873b
@ -93,16 +93,16 @@ class DHCPIPv4Responder(dhcp_base.DHCPResponderBase):
|
||||
value=struct.pack(
|
||||
'!i', cfg.CONF.dhcp_lease_duration)))
|
||||
|
||||
if cfg.CONF.DHCP.renewal_time > 0:
|
||||
if cfg.CONF.DHCP.dhcp_renewal_time > 0:
|
||||
option_list.append(
|
||||
dhcp.option(tag=dhcp.DHCP_RENEWAL_TIME_OPT,
|
||||
value=struct.pack(
|
||||
'!I', cfg.CONF.DHCP.renewal_time)))
|
||||
if cfg.CONF.DHCP.rebinding_time > 0:
|
||||
'!I', cfg.CONF.DHCP.dhcp_renewal_time)))
|
||||
if cfg.CONF.DHCP.dhcp_rebinding_time > 0:
|
||||
option_list.append(
|
||||
dhcp.option(tag=dhcp.DHCP_REBINDING_TIME_OPT,
|
||||
value=struct.pack(
|
||||
'!I', cfg.CONF.DHCP.rebinding_time)))
|
||||
'!I', cfg.CONF.DHCP.dhcp_rebinding_time)))
|
||||
|
||||
option_list.append(
|
||||
dhcp.option(tag=dhcp.DHCP_SUBNET_MASK_OPT,
|
||||
|
@ -163,6 +163,16 @@ AVAILABILITY_ZONE_OPTS = [
|
||||
]
|
||||
|
||||
|
||||
DHCP_PROTOCOL_OPTS = [
|
||||
cfg.IntOpt('dhcp_renewal_time', default=0,
|
||||
help=_("DHCP renewal time T1 (in seconds). If set to 0, it "
|
||||
"will default to half of the lease time.")),
|
||||
cfg.IntOpt('dhcp_rebinding_time', default=0,
|
||||
help=_("DHCP rebinding time T2 (in seconds). If set to 0, it "
|
||||
"will default to 7/8 of the lease time.")),
|
||||
]
|
||||
|
||||
|
||||
def get_log_args(conf, log_file_name, **kwargs):
|
||||
cmd_args = []
|
||||
if conf.debug:
|
||||
|
@ -18,6 +18,7 @@
|
||||
from oslo_config import cfg
|
||||
|
||||
from neutron._i18n import _
|
||||
from neutron.conf.agent import common
|
||||
|
||||
|
||||
DHCP_AGENT_OPTS = [
|
||||
@ -110,12 +111,6 @@ DNSMASQ_OPTS = [
|
||||
help=_('Limit number of leases to prevent a denial-of-service.')),
|
||||
cfg.BoolOpt('dhcp_broadcast_reply', default=False,
|
||||
help=_("Use broadcast in DHCP replies.")),
|
||||
cfg.IntOpt('dhcp_renewal_time', default=0,
|
||||
help=_("DHCP renewal time T1 (in seconds). If set to 0, it "
|
||||
"will default to half of the lease time.")),
|
||||
cfg.IntOpt('dhcp_rebinding_time', default=0,
|
||||
help=_("DHCP rebinding time T2 (in seconds). If set to 0, it "
|
||||
"will default to 7/8 of the lease time.")),
|
||||
cfg.BoolOpt('dnsmasq_enable_addr6_list', default=False,
|
||||
help=_("Enable dhcp-host entry with list of addresses when "
|
||||
"port has multiple IPv6 addresses in the same subnet."))
|
||||
@ -126,3 +121,4 @@ def register_agent_dhcp_opts(cfg=cfg.CONF):
|
||||
cfg.register_opts(DHCP_AGENT_OPTS)
|
||||
cfg.register_opts(DHCP_OPTS)
|
||||
cfg.register_opts(DNSMASQ_OPTS)
|
||||
cfg.register_opts(common.DHCP_PROTOCOL_OPTS)
|
||||
|
@ -16,6 +16,7 @@ from neutron_lib import constants as n_const
|
||||
from oslo_config import cfg
|
||||
|
||||
from neutron._i18n import _
|
||||
from neutron.conf.agent import common
|
||||
from neutron.plugins.ml2.drivers.openvswitch.agent.common \
|
||||
import constants
|
||||
|
||||
@ -184,12 +185,6 @@ dhcp_opts = [
|
||||
help=_("When set to True, the OVS agent DHCP "
|
||||
"extension will add related flows for "
|
||||
"DHCPv6 packets.")),
|
||||
cfg.IntOpt('renewal_time', default=0,
|
||||
help=_("DHCP renewal time T1 (in seconds). If set to 0, it "
|
||||
"will default to half of the lease time.")),
|
||||
cfg.IntOpt('rebinding_time', default=0,
|
||||
help=_("DHCP rebinding time T2 (in seconds). If set to 0, it "
|
||||
"will default to 7/8 of the lease time.")),
|
||||
]
|
||||
|
||||
|
||||
@ -197,6 +192,7 @@ def register_ovs_agent_opts(cfg=cfg.CONF):
|
||||
cfg.register_opts(ovs_opts, "OVS")
|
||||
cfg.register_opts(agent_opts, "AGENT")
|
||||
cfg.register_opts(dhcp_opts, "DHCP")
|
||||
cfg.register_opts(common.DHCP_PROTOCOL_OPTS, "DHCP")
|
||||
|
||||
|
||||
def register_ovs_opts(cfg=cfg.CONF):
|
||||
|
@ -261,8 +261,8 @@ class OVSConfigFixture(ConfigFixture):
|
||||
self.config.update({
|
||||
'dhcp': {
|
||||
'enable_ipv6': 'True',
|
||||
'renewal_time': '0',
|
||||
'rebinding_time': '0'}
|
||||
'dhcp_renewal_time': '0',
|
||||
'dhcp_rebinding_time': '0'}
|
||||
})
|
||||
|
||||
def _setUp(self):
|
||||
|
@ -1071,6 +1071,7 @@ class TestConfBase(base.BaseTestCase):
|
||||
self.conf.register_opts(base_config.core_opts)
|
||||
self.conf.register_opts(dhcp_config.DHCP_OPTS)
|
||||
self.conf.register_opts(dhcp_config.DNSMASQ_OPTS)
|
||||
self.conf.register_opts(config.DHCP_PROTOCOL_OPTS)
|
||||
config.register_external_process_opts(self.conf)
|
||||
config.register_interface_driver_opts_helper(self.conf)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user