replace use of dhcp_lease_time with dhcp_lease_duration

Having 2 separate dhcp lease period flags (dhcp_lease_duration
used by the quantum db plugin, and dhcp_lease_time used by the
dnsmasq dhcp agent) means that you could potentially have different
lease periods being set, and used by different parts of the codebase.

It seems to me there is no real need to have 2 separate flags, so this
commit basically replaces references to dhcp_lease_time (which is used
by the dnsmasq dhcpagent) with dhcp_lease_duration. This way, there
is only one flag to set, and both the quantum db plugin and dnsmasq
dhcp agent will use the same lease period.

Change-Id: Ia99dfa9284b6e737144f61a80c59cd898c0949bb
Fixes: bug #1192550
This commit is contained in:
Darren Birkett 2013-06-19 12:37:02 +00:00
parent 8eea1ae574
commit 95dbd03a0b
4 changed files with 5 additions and 5 deletions

View File

@ -684,7 +684,7 @@ class DhcpAgentWithStateReport(DhcpAgent):
'configurations': { 'configurations': {
'dhcp_driver': cfg.CONF.dhcp_driver, 'dhcp_driver': cfg.CONF.dhcp_driver,
'use_namespaces': cfg.CONF.use_namespaces, 'use_namespaces': cfg.CONF.use_namespaces,
'dhcp_lease_time': cfg.CONF.dhcp_lease_time}, 'dhcp_lease_duration': cfg.CONF.dhcp_lease_duration},
'start_flag': True, 'start_flag': True,
'agent_type': constants.AGENT_TYPE_DHCP} 'agent_type': constants.AGENT_TYPE_DHCP}
report_interval = cfg.CONF.AGENT.report_interval report_interval = cfg.CONF.AGENT.report_interval

View File

@ -38,9 +38,6 @@ OPTS = [
cfg.StrOpt('dhcp_confs', cfg.StrOpt('dhcp_confs',
default='$state_path/dhcp', default='$state_path/dhcp',
help=_('Location to store DHCP server config files')), help=_('Location to store DHCP server config files')),
cfg.IntOpt('dhcp_lease_time',
default=120,
help=_('Lifetime of a DHCP lease in seconds')),
cfg.StrOpt('dhcp_domain', cfg.StrOpt('dhcp_domain',
default='openstacklocal', default='openstacklocal',
help=_('Domain to use for building the hostnames')), help=_('Domain to use for building the hostnames')),
@ -303,7 +300,7 @@ class Dnsmasq(DhcpLocalProcess):
(set_tag, self._TAG_PREFIX % i, (set_tag, self._TAG_PREFIX % i,
netaddr.IPNetwork(subnet.cidr).network, netaddr.IPNetwork(subnet.cidr).network,
mode, mode,
self.conf.dhcp_lease_time)) self.conf.dhcp_lease_duration))
cmd.append('--conf-file=%s' % self.conf.dnsmasq_config_file) cmd.append('--conf-file=%s' % self.conf.dnsmasq_config_file)
if self.conf.dnsmasq_dns_server: if self.conf.dnsmasq_dns_server:

View File

@ -71,6 +71,7 @@ core_opts = [
cfg.IntOpt('max_fixed_ips_per_port', default=5, cfg.IntOpt('max_fixed_ips_per_port', default=5,
help=_("Maximum number of fixed ips per port")), help=_("Maximum number of fixed ips per port")),
cfg.IntOpt('dhcp_lease_duration', default=120, cfg.IntOpt('dhcp_lease_duration', default=120,
deprecated_name='dhcp_lease_time',
help=_("DHCP lease duration")), help=_("DHCP lease duration")),
cfg.BoolOpt('dhcp_agent_notification', default=True, cfg.BoolOpt('dhcp_agent_notification', default=True,
help=_("Allow sending resource operation" help=_("Allow sending resource operation"

View File

@ -23,6 +23,7 @@ from oslo.config import cfg
from quantum.agent.common import config from quantum.agent.common import config
from quantum.agent.linux import dhcp from quantum.agent.linux import dhcp
from quantum.common import config as base_config
from quantum.openstack.common import jsonutils from quantum.openstack.common import jsonutils
from quantum.tests import base from quantum.tests import base
@ -195,6 +196,7 @@ class TestBase(base.BaseTestCase):
args = ['--config-file', args = ['--config-file',
os.path.join(root, 'etc', 'quantum.conf.test')] os.path.join(root, 'etc', 'quantum.conf.test')]
self.conf = config.setup_conf() self.conf = config.setup_conf()
self.conf.register_opts(base_config.core_opts)
self.conf.register_opts(dhcp.OPTS) self.conf.register_opts(dhcp.OPTS)
self.conf.register_opt( self.conf.register_opt(
cfg.StrOpt('dhcp_lease_relay_socket', cfg.StrOpt('dhcp_lease_relay_socket',