From b6b23a8f7710882f22e569fcf0349f198d163a61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C5=82awek=20Kap=C5=82o=C5=84ski?= Date: Mon, 19 Mar 2018 15:21:43 +0100 Subject: [PATCH] Enable mutable config in Neutron New releases of oslo.config support a 'mutable' parameter to Opts. This is only respected when the new method mutate_config_files is called instead of reload_config_files. Neutron delegates making this call to oslo.service. This was provided in patchset Icec3e664f3fe72614e373b2938e8dee53cf8bc5e Further patches will be needed to make select config options be marked as mutable. This change enables support for oslo provided config options to be updated via SIGHUP such as log level. Task: 6389 Story: 2001545 Change-Id: I9442965607f3248706464643c6d87a04edcae24e --- neutron/agent/dhcp_agent.py | 2 +- neutron/agent/l3_agent.py | 2 +- .../drivers/linuxbridge/agent/linuxbridge_neutron_agent.py | 2 +- .../ml2/drivers/macvtap/agent/macvtap_neutron_agent.py | 2 +- .../ml2/drivers/openvswitch/agent/ovs_neutron_agent.py | 2 +- neutron/service.py | 5 +++-- neutron/services/metering/agents/metering_agent.py | 2 +- neutron/wsgi.py | 4 ++-- 8 files changed, 11 insertions(+), 10 deletions(-) diff --git a/neutron/agent/dhcp_agent.py b/neutron/agent/dhcp_agent.py index 3648f426fd6..02acede8e7c 100644 --- a/neutron/agent/dhcp_agent.py +++ b/neutron/agent/dhcp_agent.py @@ -47,4 +47,4 @@ def main(): topic=topics.DHCP_AGENT, report_interval=cfg.CONF.AGENT.report_interval, manager='neutron.agent.dhcp.agent.DhcpAgentWithStateReport') - service.launch(cfg.CONF, server).wait() + service.launch(cfg.CONF, server, restart_method='mutate').wait() diff --git a/neutron/agent/l3_agent.py b/neutron/agent/l3_agent.py index 20d91ce76c4..f4e5e6765ff 100644 --- a/neutron/agent/l3_agent.py +++ b/neutron/agent/l3_agent.py @@ -51,4 +51,4 @@ def main(manager='neutron.agent.l3.agent.L3NATAgentWithStateReport'): topic=topics.L3_AGENT, report_interval=cfg.CONF.AGENT.report_interval, manager=manager) - service.launch(cfg.CONF, server).wait() + service.launch(cfg.CONF, server, restart_method='mutate').wait() diff --git a/neutron/plugins/ml2/drivers/linuxbridge/agent/linuxbridge_neutron_agent.py b/neutron/plugins/ml2/drivers/linuxbridge/agent/linuxbridge_neutron_agent.py index fa577d8a068..a628c61768b 100644 --- a/neutron/plugins/ml2/drivers/linuxbridge/agent/linuxbridge_neutron_agent.py +++ b/neutron/plugins/ml2/drivers/linuxbridge/agent/linuxbridge_neutron_agent.py @@ -1034,5 +1034,5 @@ def main(): LB_AGENT_BINARY) setup_profiler.setup("neutron-linuxbridge-agent", cfg.CONF.host) LOG.info("Agent initialized successfully, now running... ") - launcher = service.launch(cfg.CONF, agent) + launcher = service.launch(cfg.CONF, agent, restart_method='mutate') launcher.wait() diff --git a/neutron/plugins/ml2/drivers/macvtap/agent/macvtap_neutron_agent.py b/neutron/plugins/ml2/drivers/macvtap/agent/macvtap_neutron_agent.py index 0feae7c291c..3a771fbba7f 100644 --- a/neutron/plugins/ml2/drivers/macvtap/agent/macvtap_neutron_agent.py +++ b/neutron/plugins/ml2/drivers/macvtap/agent/macvtap_neutron_agent.py @@ -222,5 +222,5 @@ def main(): constants.AGENT_TYPE_MACVTAP, MACVTAP_AGENT_BINARY) LOG.info("Agent initialized successfully, now running... ") - launcher = service.launch(cfg.CONF, agent) + launcher = service.launch(cfg.CONF, agent, restart_method='mutate') launcher.wait() diff --git a/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py b/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py index caccd7eda7c..945c89b3ba6 100644 --- a/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py +++ b/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py @@ -2132,7 +2132,7 @@ class OVSNeutronAgent(l2population_rpc.L2populationRpcCallBackTunnelMixin, self.catch_sigterm = False if self.catch_sighup: LOG.info("Agent caught SIGHUP, resetting.") - self.conf.reload_config_files() + self.conf.mutate_config_files() config.setup_logging() LOG.debug('Full set of CONF:') self.conf.log_opt_values(LOG, logging.DEBUG) diff --git a/neutron/service.py b/neutron/service.py index f31f44c01c2..158ada87dd7 100644 --- a/neutron/service.py +++ b/neutron/service.py @@ -200,7 +200,8 @@ class AllServicesNeutronWorker(neutron_worker.BaseWorker): def __init__(self, services, worker_process_count=1): super(AllServicesNeutronWorker, self).__init__(worker_process_count) self._services = services - self._launcher = common_service.Launcher(cfg.CONF) + self._launcher = common_service.Launcher(cfg.CONF, + restart_method='mutate') def start(self): for srv in self._services: @@ -226,7 +227,7 @@ def _start_workers(workers): try: if process_workers: worker_launcher = common_service.ProcessLauncher( - cfg.CONF, wait_interval=1.0 + cfg.CONF, wait_interval=1.0, restart_method='mutate' ) # add extra process worker and spawn there all workers with diff --git a/neutron/services/metering/agents/metering_agent.py b/neutron/services/metering/agents/metering_agent.py index ac4a45d77ee..77c3048808c 100644 --- a/neutron/services/metering/agents/metering_agent.py +++ b/neutron/services/metering/agents/metering_agent.py @@ -296,4 +296,4 @@ def main(): report_interval=cfg.CONF.AGENT.report_interval, manager='neutron.services.metering.agents.' 'metering_agent.MeteringAgentWithStateReport') - service.launch(cfg.CONF, server).wait() + service.launch(cfg.CONF, server, restart_method='mutate').wait() diff --git a/neutron/wsgi.py b/neutron/wsgi.py index a17ff5eccfc..0f827de71fb 100644 --- a/neutron/wsgi.py +++ b/neutron/wsgi.py @@ -192,8 +192,8 @@ class Server(object): # The API service runs in a number of child processes. # Minimize the cost of checking for child exit by extending the # wait interval past the default of 0.01s. - self._server = common_service.ProcessLauncher(cfg.CONF, - wait_interval=1.0) + self._server = common_service.ProcessLauncher( + cfg.CONF, wait_interval=1.0, restart_method='mutate') self._server.launch_service(service, workers=service.worker_process_count)