aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Schuppert <mschuppert@redhat.com>2017-03-17 17:28:00 +0100
committerBryn M. Reeves <bmr@redhat.com>2017-03-24 16:37:07 +0000
commit4f7ea5d46f7531e8fdb8a58738a747f79a9c4841 (patch)
tree4dba6d184fc83e53d9ef167e67457f7c61f74ee3
parent361d663d7d99b02186c3b47bf144f55c7080198f (diff)
downloadsos-4f7ea5d46f7531e8fdb8a58738a747f79a9c4841.tar.gz
[openstack_*] Collect undercloud debug information
If auth information got sourced before sosreport run (OS_USERNAME, OS_PASSWORD, OS_TENANT_NAME) collect information from nova, neutron, keystone, glance, ironic and heat. Only undercloud specific heat information is collected in instack plugin. Closes: #955. Signed-off-by: Martin Schuppert <mschuppe@redhat.com>
-rw-r--r--sos/plugins/openstack_glance.py11
-rw-r--r--sos/plugins/openstack_heat.py11
-rw-r--r--sos/plugins/openstack_instack.py45
-rw-r--r--sos/plugins/openstack_ironic.py12
-rw-r--r--sos/plugins/openstack_keystone.py12
-rw-r--r--sos/plugins/openstack_neutron.py14
-rw-r--r--sos/plugins/openstack_nova.py68
7 files changed, 136 insertions, 37 deletions
diff --git a/sos/plugins/openstack_glance.py b/sos/plugins/openstack_glance.py
index a6e7bffe..c8e7550f 100644
--- a/sos/plugins/openstack_glance.py
+++ b/sos/plugins/openstack_glance.py
@@ -2,6 +2,7 @@
# Copyright (C) 2012 Rackspace US, Inc.,
# Justin Shepherd <jshepher@rackspace.com>
# Copyright (C) 2009 Red Hat, Inc., Joey Boggs <jboggs@redhat.com>
+# Copyright (C) 2017 Red Hat, Inc., Martin Schuppert <mschuppert@redhat.com>
# 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
@@ -18,6 +19,7 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
+import os
class OpenStackGlance(Plugin):
@@ -47,6 +49,15 @@ class OpenStackGlance(Plugin):
if self.get_option("verify"):
self.add_cmd_output("rpm -V %s" % ' '.join(packages))
+ vars = [p in os.environ for p in [
+ 'OS_USERNAME', 'OS_PASSWORD', 'OS_TENANT_NAME']]
+ if not all(vars):
+ self.soslog.warning("Not all environment variables set. Source "
+ "the environment file for the user intended "
+ "to connect to the OpenStack environment.")
+ else:
+ self.add_cmd_output("openstack image list --long")
+
def postproc(self):
protect_keys = [
"admin_password", "password", "qpid_password", "rabbit_password",
diff --git a/sos/plugins/openstack_heat.py b/sos/plugins/openstack_heat.py
index a863d4ed..4e7abd28 100644
--- a/sos/plugins/openstack_heat.py
+++ b/sos/plugins/openstack_heat.py
@@ -1,4 +1,5 @@
# Copyright (C) 2013 Red Hat, Inc.
+# Copyright (C) 2017 Red Hat, Inc., Martin Schuppert <mschuppert@redhat.com>
# 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
@@ -15,6 +16,7 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
+import os
class OpenStackHeat(Plugin):
@@ -32,6 +34,15 @@ class OpenStackHeat(Plugin):
suggest_filename="heat_db_version"
)
+ vars = [p in os.environ for p in [
+ 'OS_USERNAME', 'OS_PASSWORD', 'OS_TENANT_NAME']]
+ if not all(vars):
+ self.soslog.warning("Not all environment variables set. Source "
+ "the environment file for the user intended "
+ "to connect to the OpenStack environment.")
+ else:
+ self.add_cmd_output("openstack stack list")
+
self.limit = self.get_option("log_size")
if self.get_option("all_logs"):
self.add_copy_spec_limit("/var/log/heat/",
diff --git a/sos/plugins/openstack_instack.py b/sos/plugins/openstack_instack.py
index bf70b9dc..074325c9 100644
--- a/sos/plugins/openstack_instack.py
+++ b/sos/plugins/openstack_instack.py
@@ -1,4 +1,5 @@
# Copyright (C) 2015 Red Hat, Inc., Lee Yarwood <lyarwood@redhat.com>
+# Copyright (C) 2017 Red Hat, Inc., Martin Schuppert <mschuppert@redhat.com>
# 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
@@ -15,6 +16,7 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin
+import os
class OpenStackInstack(Plugin):
@@ -30,6 +32,49 @@ class OpenStackInstack(Plugin):
if self.get_option("verify"):
self.add_cmd_output("rpm -V %s" % ' '.join(packages))
+ self.limit = self.get_option("log_size")
+ if self.get_option("all_logs"):
+ self.add_copy_spec_limit("/var/log/mistral/",
+ sizelimit=self.limit)
+ self.add_copy_spec_limit("/var/log/zaqar/",
+ sizelimit=self.limit)
+ else:
+ self.add_copy_spec_limit("/var/log/mistral/*.log",
+ sizelimit=self.limit)
+ self.add_copy_spec_limit("/var/log/zaqar/*.log",
+ sizelimit=self.limit)
+
+ vars = [p in os.environ for p in [
+ 'OS_USERNAME', 'OS_PASSWORD', 'OS_TENANT_NAME']]
+ if not all(vars):
+ self.soslog.warning("Not all environment variables set. Source "
+ "the environment file for the user intended "
+ "to connect to the OpenStack environment.")
+ else:
+ # get status of overcloud stack and resources
+ self.add_cmd_output("openstack stack show overcloud")
+ self.add_cmd_output(
+ "openstack stack resource list -n 10 overcloud",
+ timeout=600)
+
+ # get details on failed deployments
+ cmd = "openstack stack resource list -f value -n 5 overcloud"
+ deployments = self.call_ext_prog(cmd, timeout=600)['output']
+ for deployment in deployments.splitlines():
+ if 'FAILED' in deployment:
+ check = [
+ "OS::Heat::StructuredDeployment",
+ "OS::Heat::SoftwareDeployment"]
+ if any(x in deployment for x in check):
+ deployment = deployment.split()[1]
+ cmd = "openstack software deployment show " \
+ "--long %s" % (deployment)
+ self.add_cmd_output(
+ cmd,
+ suggest_filename="failed-deployment-" +
+ deployment + ".log",
+ timeout=600)
+
def postproc(self):
protected_keys = [
"UNDERCLOUD_TUSKAR_PASSWORD", "UNDERCLOUD_ADMIN_PASSWORD",
diff --git a/sos/plugins/openstack_ironic.py b/sos/plugins/openstack_ironic.py
index 36626a01..23f7cf04 100644
--- a/sos/plugins/openstack_ironic.py
+++ b/sos/plugins/openstack_ironic.py
@@ -1,4 +1,5 @@
# Copyright (C) 2015 Red Hat, Inc., Lee Yarwood <lyarwood@redhat.com>
+# Copyright (C) 2017 Red Hat, Inc., Martin Schuppert <mschuppert@redhat.com>
# 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
@@ -15,6 +16,7 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
+import os
class OpenStackIronic(Plugin):
@@ -40,6 +42,16 @@ class OpenStackIronic(Plugin):
if self.get_option("verify"):
self.add_cmd_output("rpm -V %s" % ' '.join(packages))
+ vars = [p in os.environ for p in [
+ 'OS_USERNAME', 'OS_PASSWORD', 'OS_TENANT_NAME']]
+ if not all(vars):
+ self.soslog.warning("Not all environment variables set. Source "
+ "the environment file for the user intended "
+ "to connect to the OpenStack environment.")
+ else:
+ self.add_cmd_output("openstack baremetal node list --long")
+ self.add_cmd_output("openstack baremetal port list")
+
def postproc(self):
protect_keys = [
"dns_passkey", "memcache_secret_key", "rabbit_password",
diff --git a/sos/plugins/openstack_keystone.py b/sos/plugins/openstack_keystone.py
index 6aa564de..e33aaf05 100644
--- a/sos/plugins/openstack_keystone.py
+++ b/sos/plugins/openstack_keystone.py
@@ -1,4 +1,5 @@
# Copyright (C) 2013 Red Hat, Inc., Jeremy Agee <jagee@redhat.com>
+# Copyright (C) 2017 Red Hat, Inc., Martin Schuppert <mschuppert@redhat.com>
# 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
@@ -15,6 +16,7 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
+import os
class OpenStackKeystone(Plugin):
@@ -43,6 +45,16 @@ class OpenStackKeystone(Plugin):
if self.get_option("verify"):
self.add_cmd_output("rpm -V %s" % ' '.join(packages))
+ vars = [p in os.environ for p in [
+ 'OS_USERNAME', 'OS_PASSWORD', 'OS_TENANT_NAME']]
+ if not all(vars):
+ self.soslog.warning("Not all environment variables set. Source "
+ "the environment file for the user intended "
+ "to connect to the OpenStack environment.")
+ else:
+ self.add_cmd_output("openstack endpoint list")
+ self.add_cmd_output("openstack catalog list")
+
def postproc(self):
protect_keys = [
"password", "qpid_password", "rabbit_password", "ssl_key_password",
diff --git a/sos/plugins/openstack_neutron.py b/sos/plugins/openstack_neutron.py
index cb9b0a38..a54cba0e 100644
--- a/sos/plugins/openstack_neutron.py
+++ b/sos/plugins/openstack_neutron.py
@@ -1,4 +1,5 @@
# Copyright (C) 2013 Red Hat, Inc., Brent Eagles <beagles@redhat.com>
+# Copyright (C) 2017 Red Hat, Inc., Martin Schuppert <mschuppert@redhat.com>
# 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
@@ -15,6 +16,7 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
+import os
class OpenStackNeutron(Plugin):
@@ -38,6 +40,18 @@ class OpenStackNeutron(Plugin):
if self.get_option("verify"):
self.add_cmd_output("rpm -V %s" % ' '.join(packages))
+ vars = [p in os.environ for p in [
+ 'OS_USERNAME', 'OS_PASSWORD', 'OS_TENANT_NAME']]
+ if not all(vars):
+ self.soslog.warning("Not all environment variables set. Source "
+ "the environment file for the user intended "
+ "to connect to the OpenStack environment.")
+ else:
+ self.add_cmd_output("openstack subnet list")
+ self.add_cmd_output("openstack port list")
+ self.add_cmd_output("openstack router list")
+ self.add_cmd_output("openstack network agent list")
+
def postproc(self):
protect_keys = [
"rabbit_password", "qpid_password", "nova_admin_password",
diff --git a/sos/plugins/openstack_nova.py b/sos/plugins/openstack_nova.py
index d4a8e940..4e82a9ec 100644
--- a/sos/plugins/openstack_nova.py
+++ b/sos/plugins/openstack_nova.py
@@ -3,6 +3,7 @@
# Justin Shepherd <jshepher@rackspace.com>
# Copyright (C) 2013 Red Hat, Inc., Jeremy Agee <jagee@redhat.com>
# Copyright (C) 2015 Red Hat, Inc., Abhijeet Kasurde <akasurde@redhat.com>
+# Copyright (C) 2017 Red Hat, Inc., Martin Schuppert <mschuppert@redhat.com>
# 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
@@ -28,44 +29,37 @@ class OpenStackNova(Plugin):
plugin_name = "openstack_nova"
profiles = ('openstack', 'openstack_controller', 'openstack_compute')
- option_list = [("cmds", "gathers openstack nova commands", "slow", False)]
-
def setup(self):
- if self.get_option("cmds"):
- for os_var in ['OS_USERNAME', 'OS_PASSWORD', 'OS_TENANT_NAME']:
- if os_var not in os.environ:
- self.soslog.warning("%s not found in environment variables"
- " which is required" % (os_var))
- self.add_cmd_output(
- "nova 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 flavor-list",
- suggest_filename="nova_flavor_list")
- self.add_cmd_output(
- "nova network-list",
- suggest_filename="nova_network_list")
- self.add_cmd_output(
- "nova list",
- suggest_filename="nova_vm_list")
- self.add_cmd_output(
- "nova agent-list",
- suggest_filename="nova_agent_list")
- self.add_cmd_output(
- "nova version-list",
- suggest_filename="nova_version_list")
- self.add_cmd_output(
- "nova host-list",
- suggest_filename="nova_host_list")
+ # commands we do not need to source the environment file
+ self.add_cmd_output("nova-manage db version")
+ self.add_cmd_output("nova-manage fixed list")
+ self.add_cmd_output("nova-manage floating list")
+
+ vars = [p in os.environ for p in [
+ 'OS_USERNAME', 'OS_PASSWORD', 'OS_TENANT_NAME']]
+ if not all(vars):
+ self.soslog.warning("Not all environment variables set. Source "
+ "the environment file for the user intended "
+ "to connect to the OpenStack environment.")
+ else:
+ self.add_cmd_output("nova service-list")
+ self.add_cmd_output("openstack flavor list --long")
+ self.add_cmd_output("nova network-list")
+ self.add_cmd_output("nova list")
+ self.add_cmd_output("nova agent-list")
+ self.add_cmd_output("nova version-list")
+ self.add_cmd_output("nova host-list")
+ self.add_cmd_output("openstack quota show")
+ self.add_cmd_output("openstack hypervisor stats show")
+ # get details for each nova instance
+ cmd = "openstack server list -f value"
+ nova_instances = self.call_ext_prog(cmd)['output']
+ for instance in nova_instances.splitlines():
+ instance = instance.split()[0]
+ cmd = "openstack server show %s" % (instance)
+ self.add_cmd_output(
+ cmd,
+ suggest_filename="instance-" + instance + ".log")
self.limit = self.get_option("log_size")
if self.get_option("all_logs"):