]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Remove deprecated use_namespaces option
authorCedric Brandily <zzelle@gmail.com>
Wed, 21 Oct 2015 18:52:40 +0000 (20:52 +0200)
committerCedric Brandily <zzelle@gmail.com>
Wed, 18 Nov 2015 18:17:29 +0000 (19:17 +0100)
The use_namespaces option has been defined as a workaround to kernels
not properly supporting namespaces. This limitation is behind us, it's
time to remove use_namespaces after its deprecation in Kilo in order to
simplify code and remove a poorly tested case (use_namespaces=False).

This change prepares for removal pullup_route method[1] which was only
used when use_namespaces=False.

[1] neutron.agent.linux.ip_lib

DocImpact
UpgradeImpact
Closes-Bug: #1508188
Related-Bug: #1435382
Depends-On: I303038eec560a6d99421140c2822aed8b518470b
Depends-On: I4feb2a15c7e1e4bfdbed2531b18b8e7d798ab3cc
Change-Id: I2fbf65df1250d9f9f1656b3964ee3b6de1ef1118

35 files changed:
etc/dhcp_agent.ini
etc/l3_agent.ini
etc/metering_agent.ini
neutron/agent/common/config.py
neutron/agent/dhcp/agent.py
neutron/agent/dhcp_agent.py
neutron/agent/l3/agent.py
neutron/agent/l3/config.py
neutron/agent/l3/dvr_local_router.py
neutron/agent/l3/namespace_manager.py
neutron/agent/l3/router_info.py
neutron/agent/l3_agent.py
neutron/agent/linux/dhcp.py
neutron/agent/linux/ip_lib.py
neutron/cmd/netns_cleanup.py
neutron/cmd/ovs_cleanup.py
neutron/db/l3_agentschedulers_db.py
neutron/db/l3_dvrscheduler_db.py
neutron/debug/debug_agent.py
neutron/debug/shell.py
neutron/services/firewall/agents/l3reference/firewall_l3_agent.py
neutron/services/metering/drivers/iptables/iptables_driver.py
neutron/tests/common/helpers.py
neutron/tests/functional/agent/l3/test_namespace_manager.py
neutron/tests/functional/agent/linux/test_dhcp.py
neutron/tests/functional/agent/test_dhcp_agent.py
neutron/tests/unit/agent/dhcp/test_agent.py
neutron/tests/unit/agent/l3/test_agent.py
neutron/tests/unit/agent/l3/test_dvr_local_router.py
neutron/tests/unit/agent/l3/test_ha_router.py
neutron/tests/unit/agent/l3/test_namespace_manager.py
neutron/tests/unit/agent/l3/test_router_info.py
neutron/tests/unit/agent/linux/test_dhcp.py
neutron/tests/unit/agent/metadata/test_driver.py
neutron/tests/unit/debug/test_commands.py

index 21e12488fa83fc3f83739c586ed3250b1caaaa6d..a41222826ecacb82ec3e5ad96e91b50b38948e93 100644 (file)
 # no additional setup of the DHCP server.
 # dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
 
-# Allow overlapping IP (Must have kernel build with CONFIG_NET_NS=y and
-# iproute2 package that supports namespaces). This option is deprecated and
-# will be removed in a future release, at which point the old behavior of
-# use_namespaces = True will be enforced.
-# use_namespaces = True
-
 # In some cases the neutron router is not present to provide the metadata
 # IP but the DHCP server can be used to provide this info. Setting this
 # value will force the DHCP server to append specific host routes to the
index ce740a1b9d3262162ab228cbb2d6075bfafbecc6..be0ab852bb5e89c71c5bdc72f1161b0e319219f2 100644 (file)
 # Example of interface_driver option for LinuxBridge
 # interface_driver = linuxbridge
 
-# Allow overlapping IP (Must have kernel build with CONFIG_NET_NS=y and
-# iproute2 package that supports namespaces). This option is deprecated and
-# will be removed in a future release, at which point the old behavior of
-# use_namespaces = True will be enforced.
-# use_namespaces = True
-
-# If use_namespaces is set as False then the agent can only configure one router.
-
-# This is done by setting the specific router_id.
+# If non-empty, the l3 agent can only configure a router that has the matching
+# router ID.
 # router_id =
 
 # When external_network_bridge is set, each L3 agent can be associated
index ac91234611dfc1f5382e8607aa174f9ca68c8bd8..ad7d003492ca69f93e1c6a5da91c7793c09ae7c9 100644 (file)
@@ -14,7 +14,3 @@
 # report_interval = 300
 
 # interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver
-
-# This option is deprecated and will be removed in a future release,
-# at which point the old behavior of use_namespaces = True will be enforced.
-# use_namespaces = True
index 6235c23b0881eb26a72faebd64e2c88134c64b43..5aaedd71c645a7151bf9fa920a3266d456853df0 100644 (file)
@@ -54,13 +54,6 @@ INTERFACE_DRIVER_OPTS = [
                help=_("The driver used to manage the virtual interface.")),
 ]
 
-USE_NAMESPACES_OPTS = [
-    cfg.BoolOpt('use_namespaces', default=True,
-                help=_("Allow overlapping IP. This option is deprecated and "
-                       "will be removed in a future release."),
-                deprecated_for_removal=True),
-]
-
 IPTABLES_OPTS = [
     cfg.BoolOpt('comment_iptables_rules', default=True,
                 help=_("Add comments to iptables rules.")),
@@ -148,10 +141,6 @@ def register_interface_driver_opts_helper(conf):
     conf.register_opts(INTERFACE_DRIVER_OPTS)
 
 
-def register_use_namespaces_opts_helper(conf):
-    conf.register_opts(USE_NAMESPACES_OPTS)
-
-
 def register_iptables_opts(conf):
     conf.register_opts(IPTABLES_OPTS, 'AGENT')
 
index 33d45ed07abc3540ed3a032ea472fd949d9b1672..58ca86b97abe6c034eab6b4c6350aabf8cf3db17 100644 (file)
@@ -58,9 +58,7 @@ class DhcpAgent(manager.Manager):
         self.cache = NetworkCache()
         self.dhcp_driver_cls = importutils.import_class(self.conf.dhcp_driver)
         ctx = context.get_admin_context_without_session()
-        self.plugin_rpc = DhcpPluginApi(topics.PLUGIN,
-                                        ctx, self.conf.use_namespaces,
-                                        self.conf.host)
+        self.plugin_rpc = DhcpPluginApi(topics.PLUGIN, ctx, self.conf.host)
         # create dhcp dir to store dhcp info
         dhcp_dir = os.path.dirname("/%s/dhcp/" % self.conf.state_path)
         utils.ensure_dir(dhcp_dir)
@@ -80,10 +78,7 @@ class DhcpAgent(manager.Manager):
                 self.conf
             )
             for net_id in existing_networks:
-                net = dhcp.NetModel(self.conf.use_namespaces,
-                                    {"id": net_id,
-                                     "subnets": [],
-                                     "ports": []})
+                net = dhcp.NetModel({"id": net_id, "subnets": [], "ports": []})
                 self.cache.put(net)
         except NotImplementedError:
             # just go ahead with an empty networks cache
@@ -250,8 +245,7 @@ class DhcpAgent(manager.Manager):
         """Disable DHCP for a network known to the agent."""
         network = self.cache.get_network_by_id(network_id)
         if network:
-            if (self.conf.use_namespaces and
-                self.conf.enable_isolated_metadata):
+            if self.conf.enable_isolated_metadata:
                 # NOTE(jschwarz): In the case where a network is deleted, all
                 # the subnets and ports are deleted before this function is
                 # called, so checking if 'should_enable_metadata' is True
@@ -406,10 +400,9 @@ class DhcpPluginApi(object):
 
     """
 
-    def __init__(self, topic, context, use_namespaces, host):
+    def __init__(self, topic, context, host):
         self.context = context
         self.host = host
-        self.use_namespaces = use_namespaces
         target = oslo_messaging.Target(
                 topic=topic,
                 namespace=constants.RPC_NAMESPACE_DHCP_PLUGIN,
@@ -421,7 +414,7 @@ class DhcpPluginApi(object):
         cctxt = self.client.prepare(version='1.1')
         networks = cctxt.call(self.context, 'get_active_networks_info',
                               host=self.host)
-        return [dhcp.NetModel(self.use_namespaces, n) for n in networks]
+        return [dhcp.NetModel(n) for n in networks]
 
     def get_network_info(self, network_id):
         """Make a remote process call to retrieve network info."""
@@ -429,7 +422,7 @@ class DhcpPluginApi(object):
         network = cctxt.call(self.context, 'get_network_info',
                              network_id=network_id, host=self.host)
         if network:
-            return dhcp.NetModel(self.use_namespaces, network)
+            return dhcp.NetModel(network)
 
     def create_dhcp_port(self, port):
         """Make a remote process call to create the dhcp port."""
@@ -547,7 +540,6 @@ class DhcpAgentWithStateReport(DhcpAgent):
             'topic': topics.DHCP_AGENT,
             'configurations': {
                 'dhcp_driver': self.conf.dhcp_driver,
-                'use_namespaces': self.conf.use_namespaces,
                 'dhcp_lease_duration': self.conf.dhcp_lease_duration,
                 'log_agent_heartbeats': self.conf.AGENT.log_agent_heartbeats},
             'start_flag': True,
index 634b3b6d3c93f4e66a423dd9ffa58666365c45c6..46245fc43e433a59e3f6bcbb5434bbf4dfc1adab 100644 (file)
@@ -30,7 +30,6 @@ from neutron import service as neutron_service
 
 def register_options(conf):
     config.register_interface_driver_opts_helper(conf)
-    config.register_use_namespaces_opts_helper(conf)
     config.register_agent_state_opts_helper(conf)
     config.register_availability_zone_opts_helper(conf)
     conf.register_opts(dhcp_config.DHCP_AGENT_OPTS)
index 2ade79910dad3bbd2e0e11e9dbbaa378c8a3ec13..0750e688b7d2182c2eedfa9c48fa19d66cd044b2 100644 (file)
@@ -226,7 +226,6 @@ class L3NATAgent(firewall_l3_agent.FWaaSL3AgentRpcCallback,
         self.namespaces_manager = namespace_manager.NamespaceManager(
             self.conf,
             self.driver,
-            self.conf.use_namespaces,
             self.metadata_driver)
 
         self._queue = queue.RouterProcessingQueue()
@@ -252,11 +251,6 @@ class L3NATAgent(firewall_l3_agent.FWaaSL3AgentRpcCallback,
             LOG.error(msg)
             raise SystemExit(1)
 
-        if not self.conf.use_namespaces and not self.conf.router_id:
-            msg = _LE('Router id is required if not using namespaces.')
-            LOG.error(msg)
-            raise SystemExit(1)
-
         if self.conf.ipv6_gateway:
             # ipv6_gateway configured. Check for valid v6 link-local address.
             try:
@@ -406,10 +400,7 @@ class L3NATAgent(firewall_l3_agent.FWaaSL3AgentRpcCallback,
                       self.conf.external_network_bridge)
             return
 
-        # If namespaces are disabled, only process the router associated
-        # with the configured agent id.
-        if (not self.conf.use_namespaces and
-            router['id'] != self.conf.router_id):
+        if self.conf.router_id and router['id'] != self.conf.router_id:
             raise n_exc.RouterNotCompatibleWithAgent(router_id=router['id'])
 
         # Either ex_net_id or handle_internal_only_routers must be set
@@ -539,12 +530,11 @@ class L3NATAgent(firewall_l3_agent.FWaaSL3AgentRpcCallback,
         timestamp = timeutils.utcnow()
 
         try:
-            if self.conf.use_namespaces:
-                routers = self.plugin_rpc.get_routers(context)
-            else:
+            if self.conf.router_id:
                 routers = self.plugin_rpc.get_routers(context,
                                                       [self.conf.router_id])
-
+            else:
+                routers = self.plugin_rpc.get_routers(context)
         except oslo_messaging.MessagingException:
             LOG.exception(_LE("Failed synchronizing routers due to RPC error"))
             raise n_exc.AbortSyncRouters()
@@ -608,7 +598,6 @@ class L3NATAgentWithStateReport(L3NATAgent):
             'topic': topics.L3_AGENT,
             'configurations': {
                 'agent_mode': self.conf.agent_mode,
-                'use_namespaces': self.conf.use_namespaces,
                 'router_id': self.conf.router_id,
                 'handle_internal_only_routers':
                 self.conf.handle_internal_only_routers,
index 69c605546c335c21164082e3118623d38008082f..856ddecc2fa31139e29b0095543349a1be2f56e8 100644 (file)
@@ -49,8 +49,8 @@ OPTS = [
                help=_("Send this many gratuitous ARPs for HA setup, if "
                       "less than or equal to 0, the feature is disabled")),
     cfg.StrOpt('router_id', default='',
-               help=_("If namespaces is disabled, the l3 agent can only "
-                      "configure a router that has the matching router ID.")),
+               help=_("If non-empty, the l3 agent can only configure a router "
+                      "that has the matching router ID.")),
     cfg.BoolOpt('handle_internal_only_routers',
                 default=True,
                 help=_("Agent should implement routers with no gateway")),
index f0e68cb1b203cabd775d43db75e116a0f5d843b9..03f67c3f4f61e1c5c3008e98b0f2ed92d2980439 100644 (file)
@@ -54,13 +54,7 @@ class DvrLocalRouter(dvr_router_base.DvrRouterBase):
         return [i for i in floating_ips if i['host'] == self.host]
 
     def _handle_fip_nat_rules(self, interface_name):
-        """Configures NAT rules for Floating IPs for DVR.
-
-           Remove all the rules. This is safe because if
-           use_namespaces is set as False then the agent can
-           only configure one router, otherwise each router's
-           NAT rules will be in their own namespace.
-        """
+        """Configures NAT rules for Floating IPs for DVR."""
         self.iptables_manager.ipv4['nat'].empty_chain('POSTROUTING')
         self.iptables_manager.ipv4['nat'].empty_chain('snat')
 
index 0b9f42ac11db3b43d6ae2ca1149463390f2b2591..00f2919fea7d663398673c2457d3cb646c4a6917 100644 (file)
@@ -49,17 +49,16 @@ class NamespaceManager(object):
         dvr_fip_ns.FIP_NS_PREFIX: dvr_fip_ns.FipNamespace,
     }
 
-    def __init__(self, agent_conf, driver, clean_stale, metadata_driver=None):
+    def __init__(self, agent_conf, driver, metadata_driver=None):
         """Initialize the NamespaceManager.
 
         :param agent_conf: configuration from l3 agent
         :param driver: to perform operations on devices
-        :param clean_stale: Whether to try to clean stale namespaces
         :param metadata_driver: used to cleanup stale metadata proxy processes
         """
         self.agent_conf = agent_conf
         self.driver = driver
-        self._clean_stale = clean_stale
+        self._clean_stale = True
         self.metadata_driver = metadata_driver
         if metadata_driver:
             self.process_monitor = external_process.ProcessMonitor(
index 038b3d715057717458c32da5685a5dca5e445ddd..af3ae7c6e9bc416fa0e70aa55dbdf81030f5024d 100644 (file)
@@ -49,13 +49,10 @@ class RouterInfo(object):
         # Invoke the setter for establishing initial SNAT action
         self.router = router
         self.use_ipv6 = use_ipv6
-        self.ns_name = None
-        self.router_namespace = None
-        if agent_conf.use_namespaces:
-            ns = namespaces.RouterNamespace(
-                router_id, agent_conf, interface_driver, use_ipv6)
-            self.router_namespace = ns
-            self.ns_name = ns.name
+        ns = namespaces.RouterNamespace(
+            router_id, agent_conf, interface_driver, use_ipv6)
+        self.router_namespace = ns
+        self.ns_name = ns.name
         self.iptables_manager = iptables_manager.IptablesManager(
             use_ipv6=use_ipv6,
             namespace=self.ns_name)
@@ -81,8 +78,7 @@ class RouterInfo(object):
                                       process_monitor,
                                       self.get_internal_device_name)
 
-        if self.router_namespace:
-            self.router_namespace.create()
+        self.router_namespace.create()
 
     @property
     def router(self):
@@ -267,8 +263,7 @@ class RouterInfo(object):
         self.router[l3_constants.FLOATINGIP_KEY] = []
         self.process(agent)
         self.disable_radvd()
-        if self.router_namespace:
-            self.router_namespace.delete()
+        self.router_namespace.delete()
 
     def _internal_network_updated(self, port, subnet_id, prefix, old_prefix,
                                   updated_cidrs):
index 8c34fe1ac440262f162aad6b08491dc9d62151ec..691b1ec6d8955db465fe01027487c2e5d24db28a 100644 (file)
@@ -36,7 +36,6 @@ def register_opts(conf):
     conf.register_opts(metadata_config.SHARED_OPTS)
     conf.register_opts(ha.OPTS)
     config.register_interface_driver_opts_helper(conf)
-    config.register_use_namespaces_opts_helper(conf)
     config.register_agent_state_opts_helper(conf)
     conf.register_opts(interface.OPTS)
     conf.register_opts(external_process.OPTS)
index aafee0a05d6b68cc5154bf4797407ba2cfb460f5..47cade5df01f03e3025e00214911ea6ec800cf66 100644 (file)
@@ -103,11 +103,10 @@ class DictModel(dict):
 
 class NetModel(DictModel):
 
-    def __init__(self, use_namespaces, d):
+    def __init__(self, d):
         super(NetModel, self).__init__(d)
 
-        self._ns_name = (use_namespaces and
-                         "%s%s" % (NS_PREFIX, self.id) or None)
+        self._ns_name = "%s%s" % (NS_PREFIX, self.id)
 
     @property
     def namespace(self):
@@ -232,13 +231,12 @@ class DhcpLocalProcess(DhcpBase):
             LOG.warning(_LW('Failed trying to delete interface: %s'),
                         self.interface_name)
 
-        if self.network.namespace:
-            ns_ip = ip_lib.IPWrapper(namespace=self.network.namespace)
-            try:
-                ns_ip.netns.delete(self.network.namespace)
-            except RuntimeError:
-                LOG.warning(_LW('Failed trying to delete namespace: %s'),
-                            self.network.namespace)
+        ns_ip = ip_lib.IPWrapper(namespace=self.network.namespace)
+        try:
+            ns_ip.netns.delete(self.network.namespace)
+        except RuntimeError:
+            LOG.warning(_LW('Failed trying to delete namespace: %s'),
+                        self.network.namespace)
 
     def _get_value_from_conf_file(self, kind, converter=None):
         """A helper function to read a value from one of the state files."""
@@ -971,7 +969,7 @@ class Dnsmasq(DhcpLocalProcess):
                    for s in network.subnets):
                 return True
 
-        if not conf.use_namespaces or not conf.enable_isolated_metadata:
+        if not conf.enable_isolated_metadata:
             return False
 
         isolated_subnets = cls.get_isolated_subnets(network)
@@ -1214,34 +1212,25 @@ class DeviceManager(object):
                     net = netaddr.IPNetwork(subnet.cidr)
                     ip_cidrs.append('%s/%s' % (gateway, net.prefixlen))
 
-        if (self.conf.enable_isolated_metadata and
-            self.conf.use_namespaces):
+        if self.conf.enable_isolated_metadata:
             ip_cidrs.append(METADATA_DEFAULT_CIDR)
 
         self.driver.init_l3(interface_name, ip_cidrs,
                             namespace=network.namespace)
 
-        # ensure that the dhcp interface is first in the list
-        if network.namespace is None:
-            device = ip_lib.IPDevice(interface_name)
-            device.route.pullup_route(interface_name,
-                                      ip_version=constants.IP_VERSION_4)
-
-        if self.conf.use_namespaces:
-            self._set_default_route(network, interface_name)
-            try:
-                self._cleanup_stale_devices(network, port)
-            except Exception:
-                # catch everything as we don't want to fail because of
-                # cleanup step
-                LOG.error(_LE("Exception during stale dhcp device cleanup"))
+        self._set_default_route(network, interface_name)
+        try:
+            self._cleanup_stale_devices(network, port)
+        except Exception:
+            # catch everything as we don't want to fail because of
+            # cleanup step
+            LOG.error(_LE("Exception during stale dhcp device cleanup"))
 
         return interface_name
 
     def update(self, network, device_name):
         """Update device settings for the network's DHCP on this host."""
-        if self.conf.use_namespaces:
-            self._set_default_route(network, device_name)
+        self._set_default_route(network, device_name)
 
     def destroy(self, network, device_name):
         """Destroy the device used for the network's DHCP on this host."""
index a9fbfc527bd23926251441fc5d59359c2594e3f2..ce6cd2c87867a44b687bca8260878e351381eeaf 100644 (file)
@@ -13,6 +13,7 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+import debtcollector
 import eventlet
 import netaddr
 import os
@@ -722,6 +723,7 @@ class IpRouteCommand(IpDeviceCommandBase):
 
         return retval
 
+    @debtcollector.removals.remove(message="Will be removed in the N cycle.")
     def pullup_route(self, interface_name, ip_version):
         """Ensures that the route entry for the interface is before all
         others on the same subnet.
index 8c54bbc44fd1737e20c0bbf3298b08c13b5d4c17..0a30545e5b336d7402ec34dd868e120b2060e3f9 100644 (file)
@@ -69,7 +69,6 @@ def setup_conf():
     conf = cfg.CONF
     conf.register_cli_opts(cli_opts)
     agent_config.register_interface_driver_opts_helper(conf)
-    agent_config.register_use_namespaces_opts_helper(conf)
     conf.register_opts(dhcp_config.DHCP_AGENT_OPTS)
     conf.register_opts(dhcp_config.DHCP_OPTS)
     conf.register_opts(dhcp_config.DNSMASQ_OPTS)
@@ -90,7 +89,7 @@ def kill_dhcp(conf, namespace):
         conf.dhcp_driver,
         conf=conf,
         process_monitor=_get_dhcp_process_monitor(conf),
-        network=dhcp.NetModel(conf.use_namespaces, {'id': network_id}),
+        network=dhcp.NetModel({'id': network_id}),
         plugin=FakeDhcpPlugin())
 
     if dhcp_driver.active:
index 70bb4a1b328071949b0113e319e9e5ad882117e2..ec9584228b96db049f34afd2df00c80d2ffb5ddd 100644 (file)
@@ -48,7 +48,6 @@ def setup_conf():
     conf.register_opts(l3_config.OPTS)
     conf.register_opts(interface.OPTS)
     agent_config.register_interface_driver_opts_helper(conf)
-    agent_config.register_use_namespaces_opts_helper(conf)
     return conf
 
 
index 9498c092f83736ba782b923c408b5e7d6a28e112..32b8cc3d4cd340c10b05fe9858dc91edeb1ddd39 100644 (file)
@@ -456,14 +456,13 @@ class L3AgentSchedulerDbMixin(l3agentscheduler.L3AgentSchedulerPluginBase,
                 continue
             agent_conf = self.get_configuration_dict(l3_agent)
             router_id = agent_conf.get('router_id', None)
-            use_namespaces = agent_conf.get('use_namespaces', True)
             handle_internal_only_routers = agent_conf.get(
                 'handle_internal_only_routers', True)
             gateway_external_network_id = agent_conf.get(
                 'gateway_external_network_id', None)
             agent_mode = agent_conf.get(constants.L3_AGENT_MODE,
                                         constants.L3_AGENT_MODE_LEGACY)
-            if not use_namespaces and router_id != sync_router['id']:
+            if router_id and router_id != sync_router['id']:
                 continue
             ex_net_id = (sync_router['external_gateway_info'] or {}).get(
                 'network_id')
index 8d4e203d4ab60f397eb1a446cc5bb9ab21f4ebc0..236d57a0c120b425889d1b6c589685d9e8d81a5b 100644 (file)
@@ -346,8 +346,7 @@ class L3_DVRsch_db_mixin(l3agent_sch_db.L3AgentSchedulerDbMixin):
                 continue
 
             router_id = agent_conf.get('router_id', None)
-            use_namespaces = agent_conf.get('use_namespaces', True)
-            if not use_namespaces and router_id != sync_router['id']:
+            if router_id and router_id != sync_router['id']:
                 continue
 
             handle_internal_only_routers = agent_conf.get(
index 8c4966b4997350b7743f7c4e628d1a4c42942540..6919224ff1382d7f7d9bf0227a4862844a6ff27f 100644 (file)
@@ -22,7 +22,6 @@ from oslo_log import log as logging
 
 from neutron.agent.linux import dhcp
 from neutron.agent.linux import ip_lib
-from neutron.agent.linux import utils
 from neutron.common import constants
 from neutron.i18n import _LW
 
@@ -61,9 +60,7 @@ class NeutronDebugAgent(object):
 
         port = self._create_port(network, device_owner)
         interface_name = self.driver.get_device_name(port)
-        namespace = None
-        if self.conf.use_namespaces:
-            namespace = self._get_namespace(port)
+        namespace = self._get_namespace(port)
 
         if ip_lib.device_exists(interface_name, namespace=namespace):
             LOG.debug('Reusing existing device: %s.', interface_name)
@@ -114,7 +111,7 @@ class NeutronDebugAgent(object):
             bridge = self.conf.external_network_bridge
         ip = ip_lib.IPWrapper()
         namespace = self._get_namespace(port)
-        if self.conf.use_namespaces and ip.netns.exists(namespace):
+        if ip.netns.exists(namespace):
             self.driver.unplug(self.driver.get_device_name(port),
                                bridge=bridge,
                                namespace=namespace)
@@ -141,13 +138,10 @@ class NeutronDebugAgent(object):
         port = dhcp.DictModel(self.client.show_port(port_id)['port'])
         ip = ip_lib.IPWrapper()
         namespace = self._get_namespace(port)
-        if self.conf.use_namespaces:
-            if not command:
-                return "sudo ip netns exec %s" % self._get_namespace(port)
-            namespace = ip.ensure_namespace(namespace)
-            return namespace.netns.execute(shlex.split(command))
-        else:
-            return utils.execute(shlex.split(command))
+        if not command:
+            return "sudo ip netns exec %s" % self._get_namespace(port)
+        namespace = ip.ensure_namespace(namespace)
+        return namespace.netns.execute(shlex.split(command))
 
     def ensure_probe(self, network_id):
         ports = self.client.list_ports(network_id=network_id,
index 59ee8101a474bde00d913ff7b151b98666e45cb3..00a8622edde218fe686a3adbc8ecacdffc1f780e 100644 (file)
@@ -73,7 +73,6 @@ class NeutronDebugShell(shell.NeutronShell):
         cfg.CONF.register_opts(interface.OPTS)
         cfg.CONF.register_opts(debug_agent.NeutronDebugAgent.OPTS)
         config.register_interface_driver_opts_helper(cfg.CONF)
-        config.register_use_namespaces_opts_helper(cfg.CONF)
         cfg.CONF(['--config-file', self.options.config_file])
         config.setup_logging()
         driver = utils.load_interface_driver(cfg.CONF)
index 41af391bb12f19ed9b48189d259155acd4da9f42..6b7df5acdb5662b7c0d253372ea728f8efc3798e 100644 (file)
@@ -93,8 +93,7 @@ class FWaaSL3AgentRpcCallback(api.FWaaSAgentRpcCallbackMixin):
             router['id']
             for router in routers
             if router['tenant_id'] == tenant_id]
-        local_ns_list = (root_ip.get_namespaces()
-                         if self.conf.use_namespaces else [])
+        local_ns_list = root_ip.get_namespaces()
 
         router_info_list = []
         # Pick up namespaces for Tenant Routers
@@ -103,11 +102,8 @@ class FWaaSL3AgentRpcCallback(api.FWaaSAgentRpcCallbackMixin):
             # the router - but this is not yet populated in router_info
             if rid not in self.router_info:
                 continue
-            if self.conf.use_namespaces:
-                router_ns = self.router_info[rid].ns_name
-                if router_ns in local_ns_list:
-                    router_info_list.append(self.router_info[rid])
-            else:
+            router_ns = self.router_info[rid].ns_name
+            if router_ns in local_ns_list:
                 router_info_list.append(self.router_info[rid])
         return router_info_list
 
index 6a43438b1488464f970c2766390391cf27ee0bc1..6ccb0b9035a203e86f5b653e93e62c5bfee27f34 100644 (file)
@@ -36,7 +36,6 @@ RULE = '-r-'
 LABEL = '-l-'
 
 config.register_interface_driver_opts_helper(cfg.CONF)
-config.register_use_namespaces_opts_helper(cfg.CONF)
 cfg.CONF.register_opts(interface.OPTS)
 
 
@@ -69,7 +68,8 @@ class RouterWithMetering(object):
         self.conf = conf
         self.id = router['id']
         self.router = router
-        self.ns_name = NS_PREFIX + self.id if conf.use_namespaces else None
+        # TODO(cbrandily): deduplicate ns_name generation in metering/l3
+        self.ns_name = NS_PREFIX + self.id
         self.iptables_manager = iptables_manager.IptablesManager(
             namespace=self.ns_name,
             binary_name=WRAP_NAME,
index 484c0216580e015efe6ea3eb3740d69eecb3550a..f7235bf4c4b7d9e255af4d7691bf2166c62111ae 100644 (file)
@@ -60,8 +60,7 @@ def _get_l3_agent_dict(host, agent_mode, internal_only=True,
                            'handle_internal_only_routers': internal_only,
                            'external_network_bridge': ext_bridge,
                            'gateway_external_network_id': ext_net_id,
-                           'router_id': router_id,
-                           'use_namespaces': router_id is None}}
+                           'router_id': router_id}}
 
 
 def _register_agent(agent):
@@ -88,7 +87,6 @@ def _get_dhcp_agent_dict(host, networks=0, az=DEFAULT_AZ):
         'agent_type': constants.AGENT_TYPE_DHCP,
         'availability_zone': az,
         'configurations': {'dhcp_driver': 'dhcp_driver',
-                           'use_namespaces': True,
                            'networks': networks}}
     return agent
 
index 6f070c2ab27e269c050a370b2bd16077d59d8f89..331e53c69470b3ee3a9c51b366b4e8cbb8646666 100644 (file)
@@ -32,7 +32,7 @@ class NamespaceManagerTestFramework(base.BaseSudoTestCase):
         self.agent_conf = mock.MagicMock()
         self.metadata_driver_mock = mock.Mock()
         self.namespace_manager = namespace_manager.NamespaceManager(
-            self.agent_conf, driver=None, clean_stale=True,
+            self.agent_conf, driver=None,
             metadata_driver=self.metadata_driver_mock)
 
     def _create_namespace(self, router_id, ns_class):
index 4ee433fa6e593b41ee64b9a621b862e096ea8122..dbd4de5038f9fc36d427c811bfd8312e0587e076 100644 (file)
@@ -32,13 +32,11 @@ class TestDhcp(functional_base.BaseSudoTestCase):
         super(TestDhcp, self).setUp()
         conf = cfg.ConfigOpts()
         conf.register_opts(config.INTERFACE_DRIVER_OPTS)
-        conf.register_opts(config.USE_NAMESPACES_OPTS)
         conf.register_opts(interface.OPTS)
         conf.register_opts(common_conf.core_opts)
         conf.register_opts(dhcp_conf.DHCP_AGENT_OPTS)
         conf.set_override('interface_driver', 'openvswitch')
         conf.set_override('host', 'foo_host')
-        conf.set_override('use_namespaces', True)
         self.conf = conf
         br_int = self.useFixture(net_helpers.OVSBridgeFixture()).bridge
         self.conf.set_override('ovs_integration_bridge', br_int.br_name)
index 40238a8c8263ee891d8412fc5b040acce1594aaf..8dcdc0337db8c74f27ba71c7811d4f8c000cac97 100644 (file)
@@ -130,7 +130,7 @@ class DHCPAgentOVSTestFramework(base.BaseSudoTestCase):
     def create_network_dict(self, net_id, subnets=None, ports=None):
         subnets = [] if not subnets else subnets
         ports = [] if not ports else ports
-        net_dict = dhcp.NetModel(use_namespaces=True, d={
+        net_dict = dhcp.NetModel(d={
             "id": net_id,
             "subnets": subnets,
             "ports": ports,
index 1f2c2603cd251bf8cf7a7049746fe9e0f6b6771c..a3e31843959a660dc06461d7579dd04dda206eaa 100644 (file)
@@ -143,20 +143,20 @@ fake_dist_port = dhcp.DictModel(dict(id='12345678-1234-aaaa-1234567890ab',
 FAKE_NETWORK_UUID = '12345678-1234-5678-1234567890ab'
 FAKE_NETWORK_DHCP_NS = "qdhcp-%s" % FAKE_NETWORK_UUID
 
-fake_network = dhcp.NetModel(True, dict(id=FAKE_NETWORK_UUID,
+fake_network = dhcp.NetModel(dict(id=FAKE_NETWORK_UUID,
                              tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa',
                              admin_state_up=True,
                              subnets=[fake_subnet1, fake_subnet2],
                              ports=[fake_port1]))
 
-fake_network_ipv6 = dhcp.NetModel(True, dict(
+fake_network_ipv6 = dhcp.NetModel(dict(
                              id='12345678-1234-5678-1234567890ab',
                              tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa',
                              admin_state_up=True,
                              subnets=[fake_ipv6_subnet],
                              ports=[fake_ipv6_port]))
 
-fake_network_ipv6_ipv4 = dhcp.NetModel(True, dict(
+fake_network_ipv6_ipv4 = dhcp.NetModel(dict(
                              id='12345678-1234-5678-1234567890ab',
                              tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa',
                              admin_state_up=True,
@@ -164,7 +164,7 @@ fake_network_ipv6_ipv4 = dhcp.NetModel(True, dict(
                              ports=[fake_port1]))
 
 isolated_network = dhcp.NetModel(
-    True, dict(
+    dict(
         id='12345678-1234-5678-1234567890ab',
         tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa',
         admin_state_up=True,
@@ -172,7 +172,7 @@ isolated_network = dhcp.NetModel(
         ports=[fake_port1]))
 
 nonisolated_dist_network = dhcp.NetModel(
-    True, dict(
+    dict(
         id='12345678-1234-5678-1234567890ab',
         tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa',
         admin_state_up=True,
@@ -180,7 +180,7 @@ nonisolated_dist_network = dhcp.NetModel(
         ports=[fake_port1, fake_port2]))
 
 empty_network = dhcp.NetModel(
-    True, dict(
+    dict(
         id='12345678-1234-5678-1234567890ab',
         tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa',
         admin_state_up=True,
@@ -188,28 +188,28 @@ empty_network = dhcp.NetModel(
         ports=[]))
 
 fake_meta_network = dhcp.NetModel(
-    True, dict(id='12345678-1234-5678-1234567890ab',
-               tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa',
-               admin_state_up=True,
-               subnets=[fake_meta_subnet],
-               ports=[fake_meta_port]))
+    dict(id='12345678-1234-5678-1234567890ab',
+         tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa',
+         admin_state_up=True,
+         subnets=[fake_meta_subnet],
+         ports=[fake_meta_port]))
 
-fake_meta_dvr_network = dhcp.NetModel(True, fake_meta_network.copy())
+fake_meta_dvr_network = dhcp.NetModel(fake_meta_network.copy())
 fake_meta_dvr_network.ports = [fake_meta_dvr_port]
 
 fake_dist_network = dhcp.NetModel(
-    True, dict(id='12345678-1234-5678-1234567890ab',
-               tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa',
-               admin_state_up=True,
-               subnets=[fake_meta_subnet],
-               ports=[fake_meta_port, fake_dist_port]))
+    dict(id='12345678-1234-5678-1234567890ab',
+         tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa',
+         admin_state_up=True,
+         subnets=[fake_meta_subnet],
+         ports=[fake_meta_port, fake_dist_port]))
 
 fake_down_network = dhcp.NetModel(
-    True, dict(id='12345678-dddd-dddd-1234567890ab',
-               tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa',
-               admin_state_up=False,
-               subnets=[],
-               ports=[]))
+    dict(id='12345678-dddd-dddd-1234567890ab',
+         tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa',
+         admin_state_up=False,
+         subnets=[],
+         ports=[]))
 
 
 class TestDhcpAgent(base.BaseTestCase):
@@ -842,7 +842,7 @@ class TestDhcpAgentEventHandler(base.BaseTestCase):
             disable.assert_called_once_with(fake_network.id)
 
     def test_refresh_dhcp_helper_no_dhcp_enabled_networks(self):
-        network = dhcp.NetModel(True, dict(id='net-id',
+        network = dhcp.NetModel(dict(id='net-id',
                                 tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa',
                                 admin_state_up=True,
                                 subnets=[],
@@ -859,7 +859,7 @@ class TestDhcpAgentEventHandler(base.BaseTestCase):
                 [mock.call.get_network_by_id('net-id')])
 
     def test_refresh_dhcp_helper_exception_during_rpc(self):
-        network = dhcp.NetModel(True, dict(id='net-id',
+        network = dhcp.NetModel(dict(id='net-id',
                                 tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa',
                                 admin_state_up=True,
                                 subnets=[],
@@ -887,7 +887,7 @@ class TestDhcpAgentEventHandler(base.BaseTestCase):
                                                  fake_network)
 
     def test_subnet_update_end_restart(self):
-        new_state = dhcp.NetModel(True, dict(id=fake_network.id,
+        new_state = dhcp.NetModel(dict(id=fake_network.id,
                                   tenant_id=fake_network.tenant_id,
                                   admin_state_up=True,
                                   subnets=[fake_subnet1, fake_subnet3],
@@ -904,7 +904,7 @@ class TestDhcpAgentEventHandler(base.BaseTestCase):
                                                  new_state)
 
     def test_subnet_update_end_delete_payload(self):
-        prev_state = dhcp.NetModel(True, dict(id=fake_network.id,
+        prev_state = dhcp.NetModel(dict(id=fake_network.id,
                                    tenant_id=fake_network.tenant_id,
                                    admin_state_up=True,
                                    subnets=[fake_subnet1, fake_subnet3],
@@ -998,7 +998,7 @@ class TestDhcpAgentEventHandler(base.BaseTestCase):
 class TestDhcpPluginApiProxy(base.BaseTestCase):
     def _test_dhcp_api(self, method, **kwargs):
         ctxt = context.get_admin_context()
-        proxy = dhcp_agent.DhcpPluginApi('foo', ctxt, None, host='foo')
+        proxy = dhcp_agent.DhcpPluginApi('foo', ctxt, host='foo')
 
         with mock.patch.object(proxy.client, 'call') as rpc_mock,\
                 mock.patch.object(proxy.client, 'prepare') as prepare_mock:
@@ -1104,10 +1104,10 @@ class TestNetworkCache(base.BaseTestCase):
 
     def test_put_port(self):
         fake_net = dhcp.NetModel(
-            True, dict(id='12345678-1234-5678-1234567890ab',
-                       tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa',
-                       subnets=[fake_subnet1],
-                       ports=[fake_port1]))
+            dict(id='12345678-1234-5678-1234567890ab',
+                 tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa',
+                 subnets=[fake_subnet1],
+                 ports=[fake_port1]))
         nc = dhcp_agent.NetworkCache()
         nc.put(fake_net)
         nc.put_port(fake_port2)
@@ -1116,10 +1116,10 @@ class TestNetworkCache(base.BaseTestCase):
 
     def test_put_port_existing(self):
         fake_net = dhcp.NetModel(
-            True, dict(id='12345678-1234-5678-1234567890ab',
-                       tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa',
-                       subnets=[fake_subnet1],
-                       ports=[fake_port1, fake_port2]))
+            dict(id='12345678-1234-5678-1234567890ab',
+                 tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa',
+                 subnets=[fake_subnet1],
+                 ports=[fake_port1, fake_port2]))
         nc = dhcp_agent.NetworkCache()
         nc.put(fake_net)
         nc.put_port(fake_port2)
@@ -1129,10 +1129,10 @@ class TestNetworkCache(base.BaseTestCase):
 
     def test_remove_port_existing(self):
         fake_net = dhcp.NetModel(
-            True, dict(id='12345678-1234-5678-1234567890ab',
-                       tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa',
-                       subnets=[fake_subnet1],
-                       ports=[fake_port1, fake_port2]))
+            dict(id='12345678-1234-5678-1234567890ab',
+                 tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa',
+                 subnets=[fake_subnet1],
+                 ports=[fake_port1, fake_port2]))
         nc = dhcp_agent.NetworkCache()
         nc.put(fake_net)
         nc.remove_port(fake_port2)
@@ -1189,11 +1189,9 @@ class TestDeviceManager(base.BaseTestCase):
     def setUp(self):
         super(TestDeviceManager, self).setUp()
         config.register_interface_driver_opts_helper(cfg.CONF)
-        config.register_use_namespaces_opts_helper(cfg.CONF)
         cfg.CONF.register_opts(dhcp_config.DHCP_AGENT_OPTS)
         cfg.CONF.set_override('interface_driver',
                               'neutron.agent.linux.interface.NullDriver')
-        cfg.CONF.set_override('use_namespaces', True)
         cfg.CONF.set_override('enable_isolated_metadata', True)
 
         self.ensure_device_is_ready_p = mock.patch(
@@ -1378,8 +1376,8 @@ class TestDeviceManager(base.BaseTestCase):
 
     def test_destroy(self):
         fake_net = dhcp.NetModel(
-            True, dict(id=FAKE_NETWORK_UUID,
-                       tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa'))
+            dict(id=FAKE_NETWORK_UUID,
+                 tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa'))
 
         with mock.patch('neutron.agent.linux.interface.NullDriver') as dvr_cls:
             mock_driver = mock.MagicMock()
@@ -1400,8 +1398,8 @@ class TestDeviceManager(base.BaseTestCase):
 
     def test_destroy_with_none(self):
         fake_net = dhcp.NetModel(
-            True, dict(id=FAKE_NETWORK_UUID,
-                       tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa'))
+            dict(id=FAKE_NETWORK_UUID,
+                 tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa'))
 
         with mock.patch('neutron.agent.linux.interface.NullDriver') as dvr_cls:
             mock_driver = mock.MagicMock()
@@ -1420,8 +1418,8 @@ class TestDeviceManager(base.BaseTestCase):
 
     def test_get_interface_name(self):
         fake_net = dhcp.NetModel(
-            True, dict(id='12345678-1234-5678-1234567890ab',
-                       tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa'))
+            dict(id='12345678-1234-5678-1234567890ab',
+                 tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa'))
 
         fake_port = dhcp.DictModel(
             dict(id='12345678-1234-aaaa-1234567890ab',
@@ -1445,8 +1443,8 @@ class TestDeviceManager(base.BaseTestCase):
 
     def test_get_device_id(self):
         fake_net = dhcp.NetModel(
-            True, dict(id='12345678-1234-5678-1234567890ab',
-                       tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa'))
+            dict(id='12345678-1234-5678-1234567890ab',
+                 tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa'))
         expected = ('dhcp1ae5f96c-c527-5079-82ea-371a01645457-12345678-1234-'
                     '5678-1234567890ab')
 
@@ -1459,7 +1457,6 @@ class TestDeviceManager(base.BaseTestCase):
 
     def test_update(self):
         # Try with namespaces and no metadata network
-        cfg.CONF.set_override('use_namespaces', True)
         cfg.CONF.set_override('enable_metadata_network', False)
         dh = dhcp.DeviceManager(cfg.CONF, None)
         dh._set_default_route = mock.Mock()
@@ -1470,18 +1467,7 @@ class TestDeviceManager(base.BaseTestCase):
         dh._set_default_route.assert_called_once_with(network,
                                                       'ns-12345678-12')
 
-        # No namespaces, shouldn't set default route.
-        cfg.CONF.set_override('use_namespaces', False)
-        cfg.CONF.set_override('enable_metadata_network', False)
-        dh = dhcp.DeviceManager(cfg.CONF, None)
-        dh._set_default_route = mock.Mock()
-
-        dh.update(FakeV4Network(), 'tap12345678-12')
-
-        self.assertFalse(dh._set_default_route.called)
-
         # Meta data network enabled, don't interfere with its gateway.
-        cfg.CONF.set_override('use_namespaces', True)
         cfg.CONF.set_override('enable_metadata_network', True)
         dh = dhcp.DeviceManager(cfg.CONF, None)
         dh._set_default_route = mock.Mock()
@@ -1490,16 +1476,6 @@ class TestDeviceManager(base.BaseTestCase):
 
         self.assertTrue(dh._set_default_route.called)
 
-        # For completeness
-        cfg.CONF.set_override('use_namespaces', False)
-        cfg.CONF.set_override('enable_metadata_network', True)
-        dh = dhcp.DeviceManager(cfg.CONF, None)
-        dh._set_default_route = mock.Mock()
-
-        dh.update(FakeV4Network(), 'ns-12345678-12')
-
-        self.assertFalse(dh._set_default_route.called)
-
     def test_set_default_route(self):
         dh = dhcp.DeviceManager(cfg.CONF, None)
         with mock.patch.object(dhcp.ip_lib, 'IPDevice') as mock_IPDevice:
@@ -1625,17 +1601,3 @@ class TestDictModel(base.BaseTestCase):
         m = dhcp.DictModel(d)
         self.assertEqual(m.a[0].b, 2)
         self.assertEqual(m.a[1].c, 3)
-
-
-class TestNetModel(base.BaseTestCase):
-    def test_ns_name(self):
-        network = dhcp.NetModel(True, {'id': 'foo'})
-        self.assertEqual(network.namespace, 'qdhcp-foo')
-
-    def test_ns_name_false_namespace(self):
-        network = dhcp.NetModel(False, {'id': 'foo'})
-        self.assertIsNone(network.namespace)
-
-    def test_ns_name_none_namespace(self):
-        network = dhcp.NetModel(None, {'id': 'foo'})
-        self.assertIsNone(network.namespace)
index c205e5d3e19ad2509c3e41a7a0c4099148de3674..1449e2ac06a1e844e6d3b6fa526c5a565861a19f 100644 (file)
@@ -68,12 +68,10 @@ class BasicRouterOperationsFramework(base.BaseTestCase):
         self.conf.register_opts(l3_config.OPTS)
         self.conf.register_opts(ha.OPTS)
         agent_config.register_interface_driver_opts_helper(self.conf)
-        agent_config.register_use_namespaces_opts_helper(self.conf)
         agent_config.register_process_monitor_opts(self.conf)
         agent_config.register_availability_zone_opts_helper(self.conf)
         self.conf.register_opts(interface.OPTS)
         self.conf.register_opts(external_process.OPTS)
-        self.conf.set_override('router_id', 'fake_id')
         self.conf.set_override('interface_driver',
                                'neutron.agent.linux.interface.NullDriver')
         self.conf.set_override('send_arp_for_ha', 1)
@@ -1776,15 +1774,8 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework):
         self._configure_metadata_proxy(enableflag=False)
 
     def test_router_id_specified_in_conf(self):
-        self.conf.set_override('use_namespaces', False)
-        self.conf.set_override('router_id', '')
-        self.assertRaises(SystemExit, l3_agent.L3NATAgent,
-                          HOSTNAME, self.conf)
-
         self.conf.set_override('router_id', '1234')
-        agent = l3_agent.L3NATAgent(HOSTNAME, self.conf)
-        self.assertEqual('1234', agent.conf.router_id)
-        self.assertFalse(agent.namespaces_manager._clean_stale)
+        self._configure_metadata_proxy()
 
     def test_process_routers_update_rpc_timeout_on_get_routers(self):
         agent = l3_agent.L3NATAgent(HOSTNAME, self.conf)
index 8cb1fb429ff7b2a14f0e67651d28e763f9fdc374..578cbb2f2f522ec20d08a5d35a06111971823dea 100644 (file)
@@ -51,7 +51,6 @@ class TestDvrRouterOperations(base.BaseTestCase):
         self.conf.register_opts(l3_config.OPTS)
         self.conf.register_opts(ha.OPTS)
         agent_config.register_interface_driver_opts_helper(self.conf)
-        agent_config.register_use_namespaces_opts_helper(self.conf)
         agent_config.register_process_monitor_opts(self.conf)
         self.conf.register_opts(interface.OPTS)
         self.conf.register_opts(external_process.OPTS)
index 99a46ade5a1d20b7f5fd4536dce756f231a9b382..d5e57f015afa2ae176a0b7aa7eb484fc78297e30 100644 (file)
@@ -29,8 +29,6 @@ class TestBasicRouterOperations(base.BaseTestCase):
         if not router:
             router = mock.MagicMock()
         self.agent_conf = mock.Mock()
-        # NOTE The use_namespaces config will soon be deprecated
-        self.agent_conf.use_namespaces = True
         self.router_id = _uuid()
         return ha_router.HaRouter(mock.sentinel.enqueue_state,
                                   self.router_id,
index 99cc3ae34adca5e1c2b1faacea856f84671f463b..62231197e8c35cb4b8b81fd1476b677163c96f8d 100644 (file)
@@ -31,8 +31,7 @@ class NamespaceManagerTestCaseFramework(base.BaseTestCase):
     def _create_namespace_manager(self):
         self.agent_conf = mock.Mock()
         self.driver = mock.Mock()
-        return namespace_manager.NamespaceManager(self.agent_conf,
-                                                  self.driver, True)
+        return namespace_manager.NamespaceManager(self.agent_conf, self.driver)
 
 
 class TestNamespaceManager(NamespaceManagerTestCaseFramework):
index 3033e571a3dba3751df2399a3e22843661092eb1..f1378af2d3361e696a29ae7b9c27ce4dd62297a6 100644 (file)
@@ -29,7 +29,6 @@ class TestRouterInfo(base.BaseTestCase):
         super(TestRouterInfo, self).setUp()
 
         conf = agent_config.setup_conf()
-        conf.use_namespaces = True
 
         self.ip_cls_p = mock.patch('neutron.agent.linux.ip_lib.IPWrapper')
         ip_cls = self.ip_cls_p.start()
@@ -129,8 +128,6 @@ class BasicRouterTestCaseFramework(base.BaseTestCase):
         if not router:
             router = mock.MagicMock()
         self.agent_conf = mock.Mock()
-        # NOTE The use_namespaces config will soon be deprecated
-        self.agent_conf.use_namespaces = True
         self.router_id = _uuid()
         return router_info.RouterInfo(self.router_id,
                                       router,
index 3a00ee86694f7b85d1ccdcbd74c2e6e665a6670e..2a1808c25a827d563fa1640c4e6471613eb29ac7 100644 (file)
@@ -798,7 +798,6 @@ class TestConfBase(base.BaseTestCase):
         self.conf.register_opts(dhcp_config.DNSMASQ_OPTS)
         self.conf.register_opts(external_process.OPTS)
         config.register_interface_driver_opts_helper(self.conf)
-        config.register_use_namespaces_opts_helper(self.conf)
 
 
 class TestBase(TestConfBase):
@@ -1889,11 +1888,6 @@ class TestDnsmasq(TestBase):
         self.safe.assert_has_calls([mock.call(exp_host_name, exp_host_data),
                                     mock.call(exp_opt_name, exp_opt_data)])
 
-    def test_should_enable_metadata_namespaces_disabled_returns_false(self):
-        self.conf.set_override('use_namespaces', False)
-        self.assertFalse(dhcp.Dnsmasq.should_enable_metadata(self.conf,
-                                                             mock.ANY))
-
     def test_should_enable_metadata_isolated_network_returns_true(self):
         self.assertTrue(dhcp.Dnsmasq.should_enable_metadata(
             self.conf, FakeV4NetworkNoRouter()))
index 3b718551f6b064b27279451f418432ca95b9f434..ea6047eb3913acca579da06a553020deede0e801 100644 (file)
@@ -69,7 +69,6 @@ class TestMetadataDriverProcess(base.BaseTestCase):
         agent_config.register_interface_driver_opts_helper(cfg.CONF)
         cfg.CONF.set_override('interface_driver',
                               'neutron.agent.linux.interface.NullDriver')
-        agent_config.register_use_namespaces_opts_helper(cfg.CONF)
 
         mock.patch('neutron.agent.l3.agent.L3PluginApi').start()
         mock.patch('neutron.agent.l3.ha.AgentMixin'
index 7ebb376c9f62190585c7f9fbf75883bd4bd9d7f6..1f9cb17354e7695bb35ecf9e93ead1b04dd52cfa 100644 (file)
@@ -38,8 +38,6 @@ class TestDebugCommands(base.BaseTestCase):
         cfg.CONF.register_opts(debug_agent.NeutronDebugAgent.OPTS)
         common_config.init([])
         config.register_interface_driver_opts_helper(cfg.CONF)
-        config.register_use_namespaces_opts_helper(cfg.CONF)
-        cfg.CONF.set_override('use_namespaces', True)
 
         device_exists_p = mock.patch(
             'neutron.agent.linux.ip_lib.device_exists', return_value=False)
@@ -226,21 +224,6 @@ class TestDebugCommands(base.BaseTestCase):
                                                        namespace=namespace,
                                                        bridge='br-ex')])
 
-    def test_delete_probe_without_namespace(self):
-        cfg.CONF.set_override('use_namespaces', False)
-        cmd = commands.DeleteProbe(self.app, None)
-        cmd_parser = cmd.get_parser('delete_probe')
-        args = ['fake_port']
-        parsed_args = cmd_parser.parse_args(args)
-        cmd.run(parsed_args)
-        self.client.assert_has_calls([mock.call.show_port('fake_port'),
-                                      mock.call.show_network('fake_net'),
-                                      mock.call.show_subnet('fake_subnet'),
-                                      mock.call.delete_port('fake_port')])
-        self.driver.assert_has_calls([mock.call.get_device_name(mock.ANY),
-                                      mock.call.unplug('tap12345678-12',
-                                                       bridge=None)])
-
     def test_list_probe(self):
         cmd = commands.ListProbe(self.app, None)
         cmd_parser = cmd.get_parser('list_probe')
@@ -262,17 +245,6 @@ class TestDebugCommands(base.BaseTestCase):
             ns.assert_has_calls([mock.call.execute(mock.ANY)])
         self.client.assert_has_calls([mock.call.show_port('fake_port')])
 
-    def test_exec_command_without_namespace(self):
-        cfg.CONF.set_override('use_namespaces', False)
-        cmd = commands.ExecProbe(self.app, None)
-        cmd_parser = cmd.get_parser('exec_command')
-        args = ['fake_port', 'fake_command']
-        parsed_args = cmd_parser.parse_args(args)
-        with mock.patch('neutron.agent.linux.utils.execute') as exe:
-            cmd.run(parsed_args)
-            exe.assert_has_calls([mock.call.execute(mock.ANY)])
-        self.client.assert_has_calls([mock.call.show_port('fake_port')])
-
     def test_clear_probe(self):
         cmd = commands.ClearProbe(self.app, None)
         cmd_parser = cmd.get_parser('clear_probe')