From dda4e7261e77e92434294fe671a7310ab4fc79d2 Mon Sep 17 00:00:00 2001 From: "Bryn M. Reeves" Date: Thu, 11 Sep 2014 12:53:51 +0100 Subject: [PATCH] [openstack] backport OpenStack plugins from master Signed-off-by: Bryn M. Reeves --- sos/plugins/openstack.py | 207 ------------------------------------ sos/plugins/openstack_ceilometer.py | 67 ++++++++++++ sos/plugins/openstack_cinder.py | 86 +++++++++++++++ sos/plugins/openstack_glance.py | 64 +++++++++++ sos/plugins/openstack_heat.py | 68 ++++++++++++ sos/plugins/openstack_horizon.py | 81 ++++++++++++++ sos/plugins/openstack_keystone.py | 79 ++++++++++++++ sos/plugins/openstack_neutron.py | 178 +++++++++++++++++++++++++++++++ sos/plugins/openstack_nova.py | 152 ++++++++++++++++++++++++++ sos/plugins/openstack_swift.py | 62 +++++++++++ 10 files changed, 837 insertions(+), 207 deletions(-) delete mode 100644 sos/plugins/openstack.py create mode 100644 sos/plugins/openstack_ceilometer.py create mode 100644 sos/plugins/openstack_cinder.py create mode 100644 sos/plugins/openstack_glance.py create mode 100644 sos/plugins/openstack_heat.py create mode 100644 sos/plugins/openstack_horizon.py create mode 100644 sos/plugins/openstack_keystone.py create mode 100644 sos/plugins/openstack_neutron.py create mode 100644 sos/plugins/openstack_nova.py create mode 100644 sos/plugins/openstack_swift.py diff --git a/sos/plugins/openstack.py b/sos/plugins/openstack.py deleted file mode 100644 index 8c52136..0000000 --- a/sos/plugins/openstack.py +++ /dev/null @@ -1,207 +0,0 @@ -## Copyright (C) 2009 Red Hat, Inc., Joey Boggs -## Copyright (C) 2012 Rackspace US, Inc., Justin Shepherd - -### This program is free software; you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2 of the License, or -## (at your option) any later version. - -## This program is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. - -## You should have received a copy of the GNU General Public License -## along with this program; if not, write to the Free Software -## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -import os - -from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin - - -class OpenStack(Plugin): - """openstack related information - """ - plugin_name = "openstack" - - option_list = [("log", "gathers all openstack logs", "slow", False)] - - -class DebianOpenStack(OpenStack, DebianPlugin, UbuntuPlugin): - """OpenStack related information for Debian based distributions - """ - - packages = ('cinder-api', - 'cinder-backup', - 'cinder-common', - 'cinder-scheduler', - 'cinder-volume', - 'glance', - 'glance-api', - 'glance-client', - 'glance-common', - 'glance-registry', - 'keystone', - 'melange', - 'nova-api-ec2', - 'nova-api-metadata', - 'nova-api-os-compute', - 'nova-api-os-volume', - 'nova-common', - 'nova-compute', - 'nova-compute-kvm', - 'nova-compute-lxc', - 'nova-compute-qemu', - 'nova-compute-uml', - 'nova-compute-xcp', - 'nova-compute-xen', - 'nova-xcp-plugins', - 'nova-consoleauth', - 'nova-network', - 'nova-scheduler', - 'nova-volume', - 'novnc', - 'openstack-dashboard', - 'quantum-common', - 'quantum-plugin-cisco', - 'quantum-plugin-linuxbridge-agent', - 'quantum-plugin-nicira', - 'quantum-plugin-openvswitch', - 'quantum-plugin-openvswitch-agent', - 'quantum-plugin-ryu', - 'quantum-plugin-ryu-agent', - 'quantum-server', - 'swift', - 'swift-account', - 'swift-container', - 'swift-object', - 'swift-proxy', - 'swauth', - 'python-cinder', - 'python-cinderclient', - 'python-django-horizon', - 'python-glance', - 'python-keystone', - 'python-keystoneclient', - 'python-melange', - 'python-nova', - 'python-novaclient', - 'python-novnc', - 'python-quantum', - 'python-quantumclient', - 'python-swift', - 'python-swauth') - - def setup(self): - # Nova - if os.path.exists("nova-manage"): - self.add_cmd_output( - "nova-manage config list 2>/dev/null | sort", - suggest_filename="nova_config_list") - self.add_cmd_output( - "nova-manage service list 2>/dev/null", - suggest_filename="nova_service_list") - self.add_cmd_output( - "nova-manage db version 2>/dev/null", - suggest_filename="nova_db_version") - self.add_cmd_output( - "nova-manage fixed list 2>/dev/null", - suggest_filename="nova_fixed_ip_list") - self.add_cmd_output( - "nova-manage floating list 2>/dev/null", - suggest_filename="nova_floating_ip_list") - self.add_cmd_output( - "nova-manage flavor list 2>/dev/null", - suggest_filename="nova_flavor_list") - self.add_cmd_output( - "nova-manage network list 2>/dev/null", - suggest_filename="nova_network_list") - self.add_cmd_output( - "nova-manage vm list 2>/dev/null", - suggest_filename="nova_vm_list") - self.add_copy_specs(["/etc/nova/", - "/var/log/nova/", - "/etc/default/nova-volume", - "/etc/sudoers.d/nova_sudoers", - "/etc/logrotate.d/nova-*"]) - # Cinder - if os.path.exists("/usr/bin/cinder-manage"): - self.addCmdOutput( - "/usr/bin/cinder-manage db version", - suggest_filename="cinder_db_version") - self.addCopySpecs(["/etc/cinder/", - "/var/log/cinder/", - "/etc/logrotate.d/cinder-*"]) - # Glance - if os.path.exists("glance-manage"): - self.add_cmd_output( - "glance-manage db_version", - suggest_filename="glance_db_version") - self.add_copy_specs(["/etc/glance/", - "/var/log/glance/", - "/etc/logrotate.d/glance-*"]) - # Keystone - self.add_copy_specs(["/etc/keystone/", - "/var/log/keystone/", - "/etc/logrotate.d/keystone"]) - # Swift - self.add_copy_specs(["/etc/swift/"]) - # Quantum - self.add_copy_specs(["/etc/quantum/", - "/var/log/quantum/"]) - - -class RedHatOpenStack(OpenStack, RedHatPlugin): - """OpenStack related information for Red Hat distributions - """ - - packages = ('openstack-nova', - 'openstack-glance', - 'openstack-dashboard', - 'openstack-keystone', - 'openstack-quantum', - 'openstack-swift', - 'openstack-swift-account', - 'openstack-swift-container', - 'openstack-swift-object', - 'openstack-swift-proxy', - 'swift', - 'python-nova', - 'python-glanceclient', - 'python-keystoneclient', - 'python-novaclient', - 'python-openstackclient', - 'python-quantumclient') - - def setup(self): - # If RHEL or Fedora then invoke script for openstack-status - if (os.path.isfile('/etc/redhat-release') - or os.path.isfile('/etc/fedora-release')): - self.add_cmd_output("openstack-status") - - # Nova - self.add_copy_specs(["/etc/nova/", - "/var/log/nova/", - "/var/lib/nova/", - "/etc/polkit-1/localauthority/50-local.d/50-nova.pkla", - "/etc/sudoers.d/nova", - "/etc/logrotate.d/openstack-nova"]) - - # Glance - self.add_copy_specs(["/etc/glance/", - "/var/log/glance/", - "/etc/logrotate.d/openstack-glance"]) - - # Keystone - self.add_copy_specs(["/etc/keystone/", - "/var/log/keystone/"]) - - # Quantum - self.add_copy_specs(["/etc/quantum/", - "/var/log/quantum/"]) - - def postproc(self): - self.do_file_sub('/etc/keystone/keystone.conf', - r"(admin_password\s*=\s*)(.*)", - r"\1******") diff --git a/sos/plugins/openstack_ceilometer.py b/sos/plugins/openstack_ceilometer.py new file mode 100644 --- /dev/null +++ b/sos/plugins/openstack_ceilometer.py @@ -0,0 +1,67 @@ +# Copyright (C) 2013 Red Hat, Inc., Eoghan Lynn +# Copyright (C) 2012 Rackspace US, Inc. +# 2012 Justin Shepherd +# Copyright (C) 2009 Red Hat, Inc. +# 2009 Joey Boggs + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin + + +class OpenStackCeilometer(Plugin): + """Openstack Ceilometer related information.""" + plugin_name = "openstack_ceilometer" + + option_list = [("log", "gathers openstack-ceilometer logs", "slow", False)] + + def setup(self): + # Ceilometer + self.add_copy_specs([ + "/etc/ceilometer/", + "/var/log/ceilometer" + ]) + + +class DebianOpenStackCeilometer(OpenStackCeilometer, DebianPlugin, + UbuntuPlugin): + """OpenStackCeilometer related information for Debian based distributions. + """ + + packages = ( + 'ceilometer-api', + 'ceilometer-agent-central', + 'ceilometer-agent-compute', + 'ceilometer-collector', + 'ceilometer-common', + 'python-ceilometer', + 'python-ceilometerclient' + ) + + +class RedHatOpenStackCeilometer(OpenStackCeilometer, RedHatPlugin): + """OpenStackCeilometer related information for Red Hat distributions.""" + + packages = ( + 'openstack-ceilometer', + 'openstack-ceilometer-api', + 'openstack-ceilometer-central', + 'openstack-ceilometer-collector', + 'openstack-ceilometer-common', + 'openstack-ceilometer-compute', + 'python-ceilometerclient' + ) + +# vim: et ts=4 sw=4 diff --git a/sos/plugins/openstack_cinder.py b/sos/plugins/openstack_cinder.py new file mode 100644 --- /dev/null +++ b/sos/plugins/openstack_cinder.py @@ -0,0 +1,86 @@ +# Copyright (C) 2009 Red Hat, Inc., Joey Boggs +# Copyright (C) 2012 Rackspace US, Inc., +# Justin Shepherd +# Copyright (C) 2013 Red Hat, Inc., Flavio Percoco +# Copyright (C) 2013 Red Hat, Inc., Jeremy Agee + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin + + +class OpenStackCinder(Plugin): + """openstack cinder related information + """ + plugin_name = "openstack_cinder" + + option_list = [("log", "gathers openstack cinder logs", "slow", True), + ("db", "gathers openstack cinder db version", "slow", + False)] + + def setup(self): + if self.get_option("db"): + self.add_cmd_output( + "cinder-manage db version", + suggest_filename="cinder_db_version") + + self.add_copy_specs(["/etc/cinder/"]) + + if self.get_option("log"): + self.add_copy_specs(["/var/log/cinder/"]) + + +class DebianOpenStackCinder(OpenStackCinder, DebianPlugin, UbuntuPlugin): + """OpenStack Cinder related information for Debian based distributions + """ + + cinder = False + packages = ( + 'cinder-api', + 'cinder-backup', + 'cinder-common', + 'cinder-scheduler', + 'cinder-volume', + 'python-cinder', + 'python-cinderclient' + ) + + def check_enabled(self): + self.cinder = self.is_installed("cinder-common") + return self.cinder + + def setup(self): + super(DebianOpenStackCinder, self).setup() + + +class RedHatOpenStackCinder(OpenStackCinder, RedHatPlugin): + """OpenStack related information for Red Hat distributions + """ + + cinder = False + packages = ('openstack-cinder', + 'python-cinder', + 'python-cinderclient') + + def check_enabled(self): + self.cinder = self.is_installed("openstack-cinder") + return self.cinder + + def setup(self): + super(RedHatOpenStackCinder, self).setup() + self.add_copy_specs(["/etc/sudoers.d/cinder"]) + + +# vim: et ts=4 sw=4 diff --git a/sos/plugins/openstack_glance.py b/sos/plugins/openstack_glance.py new file mode 100644 --- /dev/null +++ b/sos/plugins/openstack_glance.py @@ -0,0 +1,64 @@ +# Copyright (C) 2013 Red Hat, Inc., Flavio Percoco +# Copyright (C) 2012 Rackspace US, Inc., +# Justin Shepherd +# Copyright (C) 2009 Red Hat, Inc., Joey Boggs + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +from sos import plugins + + +class OpenStackGlance(plugins.Plugin): + """OpenstackGlance related information.""" + plugin_name = "openstack_glance" + + option_list = [("log", "gathers openstack-glance logs", "slow", False)] + + def setup(self): + # Glance + self.add_cmd_output( + "glance-manage db_version", + suggest_filename="glance_db_version" + ) + self.add_copy_specs([ + "/etc/glance/", + "/var/log/glance/" + ]) + + +class DebianOpenStackGlance(OpenStackGlance, + plugins.DebianPlugin, + plugins.UbuntuPlugin): + """OpenStackGlance related information for Debian based distributions.""" + + packages = ( + 'glance', + 'glance-api', + 'glance-client', + 'glance-common', + 'glance-registry', + 'python-glance' + ) + + +class RedHatOpenStackGlance(OpenStackGlance, plugins.RedHatPlugin): + """OpenStackGlance related information for Red Hat distributions.""" + + packages = ( + 'openstack-glance', + 'python-glanceclient' + ) + +# vim: et ts=4 sw=4 diff --git a/sos/plugins/openstack_heat.py b/sos/plugins/openstack_heat.py new file mode 100644 --- /dev/null +++ b/sos/plugins/openstack_heat.py @@ -0,0 +1,68 @@ +# Copyright (C) 2013 Red Hat, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +from sos import plugins + + +class OpenStackHeat(plugins.Plugin): + """openstack related information + """ + plugin_name = "openstack_heat" + + option_list = [("log", "gathers openstack-heat logs", "slow", False)] + + def setup(self): + # Heat + self.add_cmd_output( + "heat-manage db_version", + suggest_filename="heat_db_version" + ) + self.add_copy_specs([ + "/etc/heat/", + "/var/log/heat/" + ]) + + +class DebianOpenStack(OpenStackHeat, + plugins.DebianPlugin, + plugins.UbuntuPlugin): + """OpenStackHeat related information for Debian based distributions.""" + + packages = ( + 'heat-api', + 'heat-api-cfn', + 'heat-api-cloudwatch', + 'heat-common', + 'heat-engine', + 'python-heat', + 'python-heatclient' + ) + + +class RedHatOpenStack(OpenStackHeat, plugins.RedHatPlugin): + """OpenStackHeat related information for Red Hat distributions.""" + + packages = ( + 'openstack-heat-api', + 'openstack-heat-api-cfn', + 'openstack-heat-api-cloudwatch', + 'openstack-heat-cli', + 'openstack-heat-common', + 'openstack-heat-engine', + 'python-heatclient' + ) + +# vim: et ts=4 sw=4 diff --git a/sos/plugins/openstack_horizon.py b/sos/plugins/openstack_horizon.py new file mode 100644 --- /dev/null +++ b/sos/plugins/openstack_horizon.py @@ -0,0 +1,81 @@ +# Copyright (C) 2009 Red Hat, Inc., Joey Boggs +# Copyright (C) 2012 Rackspace US, Inc., +# Justin Shepherd +# Copyright (C) 2013 Red Hat, Inc., Jeremy Agee + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin + + +class OpenStackHorizon(Plugin): + """openstack horizon related information + """ + + plugin_name = "openstack_horizon" + option_list = [("log", "gathers openstack horizon logs", "slow", True)] + + def setup(self): + self.add_copy_spec("/etc/openstack-dashboard/") + if self.get_option("log"): + self.add_copy_spec("/var/log/horizon/") + + +class DebianOpenStackHorizon(OpenStackHorizon, DebianPlugin): + """OpenStack Horizon related information for Debian based distributions + """ + + packages = ( + 'python-django-horizon', + 'openstack-dashboard', + 'openstack-dashboard-apache' + ) + + def setup(self): + super(DebianOpenStackHorizon, self).setup() + self.add_copy_spec("/etc/apache2/sites-available/") + + +class UbuntuOpenStackHorizon(OpenStackHorizon, UbuntuPlugin): + """OpenStack Horizon related information for Ubuntu based distributions + """ + + packages = ( + 'python-django-horizon', + 'openstack-dashboard', + 'openstack-dashboard-ubuntu-theme' + ) + + def setup(self): + super(UbuntuOpenStackHorizon, self).setup() + self.add_copy_spec("/etc/apache2/conf.d/openstack-dashboard.conf") + + +class RedHatOpenStackHorizon(OpenStackHorizon, RedHatPlugin): + """OpenStack Horizon related information for Red Hat distributions + """ + + packages = ( + 'python-django-horizon', + 'openstack-dashboard' + ) + + def setup(self): + super(RedHatOpenStackHorizon, self).setup() + self.add_copy_spec("/etc/httpd/conf.d/openstack-dashboard.conf") + if self.get_option("log"): + self.add_copy_spec("/var/log/httpd/") + +# vim: et ts=4 sw=4 diff --git a/sos/plugins/openstack_keystone.py b/sos/plugins/openstack_keystone.py new file mode 100644 --- /dev/null +++ b/sos/plugins/openstack_keystone.py @@ -0,0 +1,79 @@ +# Copyright (C) 2013 Red Hat, Inc., Jeremy Agee + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin + + +class OpenStackKeystone(Plugin): + """openstack keystone related information + """ + plugin_name = "openstack_keystone" + + option_list = [("log", "gathers openstack keystone logs", "slow", True), + ("nopw", "dont gathers keystone passwords", "slow", True)] + + def setup(self): + self.add_copy_specs([ + "/etc/keystone/default_catalog.templates", + "/etc/keystone/keystone.conf", + "/etc/keystone/logging.conf", + "/etc/keystone/policy.json" + ]) + + if self.get_option("log"): + self.add_copy_spec("/var/log/keystone/") + + def postproc(self): + self.do_file_sub('/etc/keystone/keystone.conf', + r"(?m)^(admin_password.*=)(.*)", + r"\1 ******") + self.do_file_sub('/etc/keystone/keystone.conf', + r"(?m)^(admin_token.*=)(.*)", + r"\1 ******") + self.do_file_sub('/etc/keystone/keystone.conf', + r"(?m)^(connection.*=.*mysql://)(.*)(:)(.*)(@)(.*)", + r"\1\2:******@\6") + self.do_file_sub('/etc/keystone/keystone.conf', + r"(?m)^(password.*=)(.*)", + r"\1 ******") + self.do_file_sub('/etc/keystone/keystone.conf', + r"(?m)^(ca_password.*=)(.*)", + r"\1 ******") + + +class DebianOpenStackKeystone(OpenStackKeystone, DebianPlugin, UbuntuPlugin): + """OpenStack Keystone related information for Debian based distributions + """ + + packages = ( + 'keystone', + 'python-keystone', + 'python-keystoneclient' + ) + + +class RedHatOpenStackKeystone(OpenStackKeystone, RedHatPlugin): + """OpenStack Keystone related information for Red Hat distributions + """ + + packages = ( + 'openstack-keystone', + 'python-keystone', + 'python-django-openstack-auth', + 'python-keystoneclient' + ) + +# vim: et ts=4 sw=4 diff --git a/sos/plugins/openstack_neutron.py b/sos/plugins/openstack_neutron.py new file mode 100644 --- /dev/null +++ b/sos/plugins/openstack_neutron.py @@ -0,0 +1,175 @@ +# Copyright (C) 2013 Red Hat, Inc., Brent Eagles + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +import os +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 Neutron(Plugin): + """OpenStack Networking (quantum/neutron) related information + """ + plugin_name = "neutron" + + option_list = [("log", "Gathers all Neutron logs", "slow", False), + ("quantum", "Overrides checks for newer Neutron components", + "fast", False)] + + component_name = "neutron" + + def setup(self): + if os.path.exists("/etc/neutron/") and not self.get_option("quantum"): + self.component_name = self.plugin_name + else: + self.component_name = "quantum" + self.add_copy_specs([ + "/etc/%s/" % self.component_name, + "/var/log/%s/" % self.component_name + ]) + + self.netns_dumps() + + 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[0] == 0): + return + nslist = ip_netns_result[1] + 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/%s/dhcp/%s/" % + (self.component_name, netid)) + self.add_copy_specs(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_outputs([ + 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 link") + if ip_addr_result[0] == 0: + for eth in self.get_interface_name(ip_addr_result[1]): + # 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_outputs([ + 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. + + def gen_pkg_tuple(self, packages): + names = [] + for p in packages: + names.append(p % {"comp": self.component_name}) + return tuple(names) + + +class DebianNeutron(Neutron, DebianPlugin, UbuntuPlugin): + """OpenStack Neutron related information for Debian based distributions + """ + package_list_template = [ + '%(comp)s-common', + '%(comp)s-plugin-cisco', + '%(comp)s-plugin-linuxbridge-agent', + '%(comp)s-plugin-nicira', + '%(comp)s-plugin-openvswitch', + '%(comp)s-plugin-openvswitch-agent', + '%(comp)s-plugin-ryu', + '%(comp)s-plugin-ryu-agent', + '%(comp)s-server', + 'python-%(comp)s', + 'python-%(comp)sclient' + ] + + def check_enabled(self): + return self.is_installed("%s-common" % self.component_name) + + def setup(self): + super(DebianNeutron, self).setup() + self.packages = self.gen_pkg_tuple(self.package_list_template) + self.add_copy_spec("/etc/sudoers.d/%s_sudoers" % self.component_name) + + +class RedHatNeutron(Neutron, RedHatPlugin): + """OpenStack Neutron related information for Red Hat distributions + """ + + package_list_template = [ + 'openstack-%(comp)s', + 'openstack-%(comp)s-linuxbridge' + 'openstack-%(comp)s-metaplugin', + 'openstack-%(comp)s-openvswitch', + 'openstack-%(comp)s-bigswitch', + 'openstack-%(comp)s-brocade', + 'openstack-%(comp)s-cisco', + 'openstack-%(comp)s-hyperv', + 'openstack-%(comp)s-midonet', + 'openstack-%(comp)s-nec' + 'openstack-%(comp)s-nicira', + 'openstack-%(comp)s-plumgrid', + 'openstack-%(comp)s-ryu', + 'python-%(comp)s', + 'python-%(comp)sclient' + ] + + def check_enabled(self): + return self.is_installed("openstack-%s" % self.component_name) + + def setup(self): + super(RedHatNeutron, self).setup() + self.packages = self.gen_pkg_tuple(self.package_list_template) + self.add_copy_spec("/etc/sudoers.d/%s-rootwrap" % self.component_name) + +# vim: et ts=4 sw=4 diff --git a/sos/plugins/openstack_nova.py b/sos/plugins/openstack_nova.py new file mode 100644 index 0000000..a4186af --- /dev/null +++ b/sos/plugins/openstack_nova.py @@ -0,0 +1,152 @@ +# Copyright (C) 2009 Red Hat, Inc., Joey Boggs +# Copyright (C) 2012 Rackspace US, Inc., +# Justin Shepherd +# Copyright (C) 2013 Red Hat, Inc., Jeremy Agee + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin + + +class OpenStackNova(Plugin): + """openstack nova related information + """ + plugin_name = "openstack_nova" + + option_list = [("log", "gathers openstack nova logs", "slow", True), + ("cmds", "gathers openstack nova commands", "slow", False)] + + def setup(self): + if self.get_option("cmds"): + self.add_cmd_output( + "nova-manage config list", + suggest_filename="nova_config_list") + self.add_cmd_output( + "nova-manage service list", + suggest_filename="nova_service_list") + self.add_cmd_output( + "nova-manage db version", + suggest_filename="nova_db_version") + self.add_cmd_output( + "nova-manage fixed list", + suggest_filename="nova_fixed_ip_list") + self.add_cmd_output( + "nova-manage floating list", + suggest_filename="nova_floating_ip_list") + self.add_cmd_output( + "nova-manage flavor list", + suggest_filename="nova_flavor_list") + self.add_cmd_output( + "nova-manage network list", + suggest_filename="nova_network_list") + self.add_cmd_output( + "nova-manage vm list", + suggest_filename="nova_vm_list") + + if self.get_option("log"): + self.add_copy_spec("/var/log/nova/") + + self.add_copy_spec("/etc/nova/") + + def postproc(self): + protect_keys = [ + "ldap_dns_password", "neutron_admin_password", "rabbit_password", + "qpid_password", "powervm_mgr_passwd", "virtual_power_host_pass", + "xenapi_connection_password", "password", "host_password", + "vnc_password", "connection", "sql_connection", "admin_password" + ] + + regexp = r"((?m)^\s*#*(%s)\s*=\s*)(.*)" % "|".join(protect_keys) + + for conf_file in ["/etc/nova/nova.conf", "/etc/nova/api-paste.ini"]: + self.do_file_sub(conf_file, regexp, r"\1*********") + + +class DebianOpenStackNova(OpenStackNova, DebianPlugin, UbuntuPlugin): + """OpenStack nova related information for Debian based distributions + """ + + nova = False + packages = ( + 'nova-api-ec2', + 'nova-api-metadata', + 'nova-api-os-compute', + 'nova-api-os-volume', + 'nova-common', + 'nova-compute', + 'nova-compute-kvm', + 'nova-compute-lxc', + 'nova-compute-qemu', + 'nova-compute-uml', + 'nova-compute-xcp', + 'nova-compute-xen', + 'nova-xcp-plugins', + 'nova-consoleauth', + 'nova-network', + 'nova-scheduler', + 'nova-volume', + 'novnc', + 'python-nova', + 'python-novaclient', + 'python-novnc' + ) + + def check_enabled(self): + self.nova = self.is_installed("nova-common") + return self.nova + + def setup(self): + super(DebianOpenStackNova, self).setup() + self.add_copy_specs(["/etc/sudoers.d/nova_sudoers"]) + + +class RedHatOpenStackNova(OpenStackNova, RedHatPlugin): + """OpenStack nova related information for Red Hat distributions + """ + + nova = False + packages = ( + 'openstack-nova-common', + 'openstack-nova-network', + 'openstack-nova-conductor', + 'openstack-nova-conductor', + 'openstack-nova-scheduler', + 'openstack-nova-console', + 'openstack-nova-novncproxy', + 'openstack-nova-compute', + 'openstack-nova-api', + 'openstack-nova-cert', + 'openstack-nova-cells', + 'openstack-nova-objectstore', + 'python-nova', + 'python-novaclient', + 'novnc' + ) + + def check_enabled(self): + self.nova = self.is_installed("openstack-nova-common") + return self.nova + + def setup(self): + super(RedHatOpenStackNova, self).setup() + self.add_copy_specs([ + "/etc/logrotate.d/openstack-nova", + "/etc/polkit-1/localauthority/50-local.d/50-nova.pkla", + "/etc/sudoers.d/nova", + "/etc/security/limits.d/91-nova.conf", + "/etc/sysconfig/openstack-nova-novncproxy" + ]) + +# vim: et ts=4 sw=4 diff --git a/sos/plugins/openstack_swift.py b/sos/plugins/openstack_swift.py new file mode 100644 --- /dev/null +++ b/sos/plugins/openstack_swift.py @@ -0,0 +1,62 @@ +# Copyright (C) 2013 Red Hat, Inc., Flavio Percoco +# Copyright (C) 2012 Rackspace US, Inc., +# Justin Shepherd +# Copyright (C) 2009 Red Hat, Inc., Joey Boggs + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin + + +class OpenStackSwift(Plugin): + """OpenstackSwift related information.""" + plugin_name = "openstack_swift" + + option_list = [("log", "gathers openstack-swift logs", "slow", False)] + + def setup(self): + # Swift + self.add_copy_spec("/etc/swift/") + + +class DebianOpenStackSwift(OpenStackSwift, DebianPlugin, UbuntuPlugin): + """OpenStackSwift related information for Debian based distributions.""" + + packages = ( + 'swift', + 'swift-account', + 'swift-container', + 'swift-object', + 'swift-proxy', + 'swauth', + 'python-swift', + 'python-swauth' + ) + + +class RedHatOpenStackSwift(OpenStackSwift, RedHatPlugin): + """OpenStackSwift related information for Red Hat distributions.""" + + packages = ( + 'openstack-swift', + 'openstack-swift-account', + 'openstack-swift-container', + 'openstack-swift-object', + 'openstack-swift-proxy', + 'swift', + 'python-swiftclient' + ) + +# vim: et ts=4 sw=4 -- 1.9.3