]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Rationalize neutron logs to help in troubleshooting router issues
authorRyan Moats <rmoats@us.ibm.com>
Fri, 21 Aug 2015 14:16:52 +0000 (09:16 -0500)
committerRyan Moats <rmoats@us.ibm.com>
Mon, 24 Aug 2015 13:48:08 +0000 (08:48 -0500)
Currently the neutron logs are not very useful for troubleshooting
router issues - this patch adds additional logging statements to
help the triage process.

Change-Id: I014e0119205d4a947a1be142aeeb29940c4de3bd
Signed-off-by: Ryan Moats <rmoats@us.ibm.com>
neutron/agent/l3/dvr_fip_ns.py
neutron/agent/l3/dvr_local_router.py
neutron/agent/l3/router_info.py
neutron/agent/linux/interface.py

index bec1eb6c5ea4a57c9947fca5b422d692a09a45e8..7b5894d19427ddf31f17152b19b59e3d53567bd1 100644 (file)
@@ -96,6 +96,7 @@ class FipNamespace(namespaces.Namespace):
 
     def _gateway_added(self, ex_gw_port, interface_name):
         """Add Floating IP gateway port."""
+        LOG.debug("add gateway interface(%s)", interface_name)
         ns_name = self.get_name()
         self.driver.plug(ex_gw_port['network_id'],
                          ex_gw_port['id'],
@@ -129,6 +130,7 @@ class FipNamespace(namespaces.Namespace):
 
     def create(self):
         # TODO(Carl) Get this functionality from mlavelle's namespace baseclass
+        LOG.debug("add fip-namespace(%s)", self.name)
         ip_wrapper_root = ip_lib.IPWrapper()
         ip_wrapper_root.netns.execute(['sysctl',
                                        '-w',
@@ -175,7 +177,6 @@ class FipNamespace(namespaces.Namespace):
         """
         self.agent_gateway_port = agent_gateway_port
 
-        # add fip-namespace and agent_gateway_port
         self.create()
 
         iface_name = self.get_ext_device_name(agent_gateway_port['id'])
@@ -189,6 +190,7 @@ class FipNamespace(namespaces.Namespace):
 
     def create_rtr_2_fip_link(self, ri):
         """Create interface between router and Floating IP namespace."""
+        LOG.debug("Create FIP link interfaces for router %s", ri.router_id)
         rtr_2_fip_name = self.get_rtr_ext_device_name(ri.router_id)
         fip_2_rtr_name = self.get_int_device_name(ri.router_id)
         fip_ns_name = self.get_name()
index 42399144cbf9ae866011afa18dc4cebe3ab8dd3b..6e5b37028309b3b63c33ab08f1fed00a990c2b98 100644 (file)
@@ -373,8 +373,9 @@ class DvrLocalRouter(dvr_router_base.DvrRouterBase):
         floating_ips = self.get_floating_ips()
         fip_agent_port = self.get_floating_agent_gw_interface(
             ex_gw_port['network_id'])
-        LOG.debug("FloatingIP agent gateway port received from the plugin: "
-                  "%s", fip_agent_port)
+        if fip_agent_port:
+            LOG.debug("FloatingIP agent gateway port received from the "
+                "plugin: %s", fip_agent_port)
         is_first = False
         if floating_ips:
             is_first = self.fip_ns.subscribe(self.router_id)
index 81bca38775afdc1d5cfeef732d3276c54ff5e17e..ba20be41eb391924277cab895c6b702547c5e463 100644 (file)
@@ -238,6 +238,8 @@ class RouterInfo(object):
             ip_cidr for ip_cidr in existing_cidrs - new_cidrs
             if common_utils.is_cidr_host(ip_cidr))
         for ip_cidr in fips_to_remove:
+            LOG.debug("Removing floating ip %s from interface %s in "
+                      "namespace %s", ip_cidr, interface_name, self.ns_name)
             self.remove_floating_ip(device, ip_cidr)
 
         return fip_statuses
@@ -268,6 +270,8 @@ class RouterInfo(object):
     def _internal_network_added(self, ns_name, network_id, port_id,
                                 fixed_ips, mac_address,
                                 interface_name, prefix):
+        LOG.debug("adding internal network: prefix(%s), port(%s)",
+                  prefix, port_id)
         self.driver.plug(network_id, port_id, interface_name, mac_address,
                          namespace=ns_name,
                          prefix=prefix)
@@ -299,7 +303,8 @@ class RouterInfo(object):
 
     def internal_network_removed(self, port):
         interface_name = self.get_internal_device_name(port['id'])
-
+        LOG.debug("removing internal network: port(%s) interface(%s)",
+                  port['id'], interface_name)
         if ip_lib.device_exists(interface_name, namespace=self.ns_name):
             self.driver.unplug(interface_name, namespace=self.ns_name,
                                prefix=INTERNAL_DEV_PREFIX)
@@ -360,11 +365,13 @@ class RouterInfo(object):
         enable_ra = False
         for p in new_ports:
             self.internal_network_added(p)
+            LOG.debug("appending port %s to internal_ports cache", p)
             self.internal_ports.append(p)
             enable_ra = enable_ra or self._port_has_ipv6_subnet(p)
 
         for p in old_ports:
             self.internal_network_removed(p)
+            LOG.debug("removing port %s from internal_ports cache", p)
             self.internal_ports.remove(p)
             enable_ra = enable_ra or self._port_has_ipv6_subnet(p)
 
@@ -375,6 +382,7 @@ class RouterInfo(object):
                 self.internal_ports[index] = updated_ports[p['id']]
                 interface_name = self.get_internal_device_name(p['id'])
                 ip_cidrs = common_utils.fixed_ip_cidrs(p['fixed_ips'])
+                LOG.debug("updating internal network for port %s", p)
                 self.internal_network_updated(interface_name, ip_cidrs)
                 enable_ra = enable_ra or self._port_has_ipv6_subnet(p)
 
@@ -432,6 +440,8 @@ class RouterInfo(object):
 
     def _external_gateway_added(self, ex_gw_port, interface_name,
                                 ns_name, preserve_ips):
+        LOG.debug("External gateway added: port(%s), interface(%s), ns(%s)",
+                  ex_gw_port, interface_name, ns_name)
         self._plug_external_gateway(ex_gw_port, interface_name, ns_name)
 
         # Build up the interface and gateway IP addresses that
@@ -473,6 +483,8 @@ class RouterInfo(object):
             ex_gw_port, interface_name, self.ns_name, preserve_ips)
 
     def external_gateway_removed(self, ex_gw_port, interface_name):
+        LOG.debug("External gateway removed: port(%s), interface(%s)",
+                  ex_gw_port, interface_name)
         self.driver.unplug(interface_name,
                            bridge=self.agent_conf.external_network_bridge,
                            namespace=self.ns_name,
@@ -611,6 +623,7 @@ class RouterInfo(object):
 
         :param agent: Passes the agent in order to send RPC messages.
         """
+        LOG.debug("process router updates")
         self._process_internal_ports()
         self.process_external(agent)
         # Process static routes for router
index 9207503e7ac4dfcd79038d88f9d109b20747ac7b..c76278bb2d6ec22d5fb75f9f9518cb7a126cccca 100644 (file)
@@ -116,6 +116,8 @@ class LinuxInterfaceDriver(object):
           associated to removed ips
         extra_subnets: An iterable of cidrs to add as routes without address
         """
+        LOG.debug("init_router_port: device_name(%s), namespace(%s)",
+                  device_name, namespace)
         self.init_l3(device_name=device_name,
                      ip_cidrs=ip_cidrs,
                      namespace=namespace,
@@ -134,8 +136,10 @@ class LinuxInterfaceDriver(object):
             device.route.list_onlink_routes(n_const.IP_VERSION_4) +
             device.route.list_onlink_routes(n_const.IP_VERSION_6))
         for route in new_onlink_routes - existing_onlink_routes:
+            LOG.debug("adding onlink route(%s)", route)
             device.route.add_onlink_route(route)
         for route in existing_onlink_routes - new_onlink_routes:
+            LOG.debug("deleting onlink route(%s)", route)
             device.route.delete_onlink_route(route)
 
     def check_bridge_exists(self, bridge):