aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLee Yarwood <lyarwood@redhat.com>2016-02-21 13:56:53 +0000
committerBryn M. Reeves <bmr@redhat.com>2016-05-23 16:26:25 +0100
commit267af5364f0d68d714c615da4fc81eda7ef8b570 (patch)
treed271c89c94295485984b19a08ad7a9043a0123b6
parenteb00c492699e11417f0334abf33f02d97be1fbce (diff)
downloadsos-267af5364f0d68d714c615da4fc81eda7ef8b570.tar.gz
[openstack_neutron] Fetch /var/lib/ and remove namespace data collection
This directory contains dhcp, keepalived and metadata proxy state and configuration data useful when troubleshooting Neutron issues. We can also drop the duplicated namespace collection code from this plugin as it adds no value over the collection code in the Networking plugin now that we are collecting `/var/lib/neutron/`. Finally this change also corrects the DebianNeutron class to correctly inherit from OpenStackNeutron and removes the now unused `log` option. Resolves: #648, #256 Signed-off-by: Lee Yarwood <lyarwood@redhat.com>
-rw-r--r--sos/plugins/openstack_neutron.py74
1 files changed, 3 insertions, 71 deletions
diff --git a/sos/plugins/openstack_neutron.py b/sos/plugins/openstack_neutron.py
index 1dbca77c..9e375b26 100644
--- a/sos/plugins/openstack_neutron.py
+++ b/sos/plugins/openstack_neutron.py
@@ -14,24 +14,14 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-import re
-
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
-# The Networking plugin includes most of what is needed from a snapshot
-# of the networking, so we only need to focus on the parts that are specific
-# to OpenStack Networking. The Process plugin should capture the dnsmasq
-# command line. The libvirt plugin grabs the instance's XML definition which
-# has the interface names for an instance. So what remains is relevant database
-# info...
-
class OpenStackNeutron(Plugin):
"""OpenStack Networking
"""
plugin_name = "openstack_neutron"
profiles = ('openstack', 'openstack_controller', 'openstack_compute')
- option_list = [("log", "Gathers all Neutron logs", "slow", False)]
def setup(self):
@@ -44,7 +34,7 @@ class OpenStackNeutron(Plugin):
sizelimit=self.limit)
self.add_copy_spec("/etc/neutron/")
- self.netns_dumps()
+ self.add_copy_spec("/var/lib/neutron/")
def postproc(self):
protect_keys = [
@@ -60,66 +50,8 @@ class OpenStackNeutron(Plugin):
self.do_path_regex_sub("/etc/neutron/*", regexp, r"\1*********")
- def netns_dumps(self):
- # It would've been beautiful if we could get parts of the networking
- # plugin to run in different namespaces. There are a couple of options
- # in the short term: create a local instance and "borrow" some of the
- # functionality, or simply copy some of the functionality.
- prefixes = ["qdhcp", "qrouter"]
- ip_netns_result = self.call_ext_prog("ip netns")
- if not (ip_netns_result['status'] == 0):
- return
- nslist = ip_netns_result['output']
- lease_directories = []
- if nslist:
- for nsname in nslist.splitlines():
- prefix, netid = nsname.split('-', 1)
- if len(netid) > 0 and prefix in prefixes:
- self.ns_gather_data(nsname)
- lease_directories.append(
- "/var/lib/neutron/dhcp/%s/" % netid)
- self.add_copy_spec(lease_directories)
-
- # TODO: Refactor! Copied from Networking plugin.
- def get_interface_name(self, ip_addr_out):
- """Return a dictionary for which key are interface name according to
- the output of ifconifg-a stored in ifconfig_file.
- """
- out = {}
- for line in ip_addr_out.splitlines():
- match = re.match('.*link/ether', line)
- if match:
- int = match.string.split(':')[1].lstrip()
- out[int] = True
- return out
-
- def ns_gather_data(self, nsname):
- cmd_prefix = "ip netns exec %s " % nsname
- self.add_cmd_output([
- cmd_prefix + "iptables-save",
- cmd_prefix + "ifconfig -a",
- cmd_prefix + "route -n"
- ])
- # borrowed from networking plugin
- ip_addr_result = self.call_ext_prog(cmd_prefix + "ip -o addr")
- if ip_addr_result['status'] == 0:
- for eth in self.get_interface_name(ip_addr_result['output']):
- # Most, if not all, IFs in the namespaces are going to be
- # virtual. The '-a', '-c' and '-g' options are not likely to be
- # supported so these ops are not copied from the network
- # plugin.
- self.add_cmd_output([
- cmd_prefix + "ethtool "+eth,
- cmd_prefix + "ethtool -i "+eth,
- cmd_prefix + "ethtool -k "+eth,
- cmd_prefix + "ethtool -S "+eth
- ])
-
- # As all of the bridges are in the "global namespace", we do not need
- # to gather info on them.
-
-
-class DebianNeutron(OpenstackNeutron, DebianPlugin, UbuntuPlugin):
+
+class DebianNeutron(OpenStackNeutron, DebianPlugin, UbuntuPlugin):
packages = [
'neutron-common',
'neutron-plugin-cisco',