]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
L3 agent should always use a unique CONF object
authorJohn Schwarz <jschwarz@redhat.com>
Mon, 29 Sep 2014 13:28:18 +0000 (16:28 +0300)
committerJohn Schwarz <jschwarz@redhat.com>
Thu, 2 Oct 2014 08:53:18 +0000 (11:53 +0300)
The l3 agent accepts an oslo configuration in its constructor and uses
it throughout the code, but there are some references to the global
configuration object held by the oslo library. Since HA functional
tests need to create two agents, the configuration should be consistent
throughout the code.

The important difference between the agents is their 'host' value so
that they create different namespaces, and 'state_path' value so the
agents get their own filesystem root.

Co-Authored-By: Assaf Muller <amuller@redhat.com>
Related-bug: #1374946
Change-Id: I3326889482681dd631ca59271ebd6a5d5129ae70

neutron/agent/l3_agent.py

index 308ab57edc30879ecb2a83a5453c220dde6073e4..9580b4561f7cf0e2e1b8e20d3a6a5d88c6373d5c 100644 (file)
@@ -776,7 +776,7 @@ class L3NATAgent(firewall_l3_agent.FWaaSL3AgentRpcCallback,
     def _get_metadata_proxy_callback(self, router_id):
 
         def callback(pid_file):
-            metadata_proxy_socket = cfg.CONF.metadata_proxy_socket
+            metadata_proxy_socket = self.conf.metadata_proxy_socket
             proxy_cmd = ['neutron-ns-metadata-proxy',
                          '--pid_file=%s' % pid_file,
                          '--metadata_proxy_socket=%s' % metadata_proxy_socket,
@@ -784,7 +784,7 @@ class L3NATAgent(firewall_l3_agent.FWaaSL3AgentRpcCallback,
                          '--state_path=%s' % self.conf.state_path,
                          '--metadata_port=%s' % self.conf.metadata_port]
             proxy_cmd.extend(config.get_log_args(
-                cfg.CONF, 'neutron-ns-metadata-proxy-%s.log' %
+                self.conf, 'neutron-ns-metadata-proxy-%s.log' %
                 router_id))
             return proxy_cmd
 
@@ -1949,7 +1949,7 @@ class L3NATAgentWithStateReport(L3NATAgent):
                 'interface_driver': self.conf.interface_driver},
             'start_flag': True,
             'agent_type': l3_constants.AGENT_TYPE_L3}
-        report_interval = cfg.CONF.AGENT.report_interval
+        report_interval = self.conf.AGENT.report_interval
         self.use_call = True
         if report_interval:
             self.heartbeat = loopingcall.FixedIntervalLoopingCall(