aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sos/plugins/openstack_cinder.py30
-rw-r--r--sos/plugins/openstack_glance.py33
-rw-r--r--sos/plugins/openstack_heat.py23
-rw-r--r--sos/plugins/openstack_nova.py94
4 files changed, 129 insertions, 51 deletions
diff --git a/sos/plugins/openstack_cinder.py b/sos/plugins/openstack_cinder.py
index abfd267b..a023105c 100644
--- a/sos/plugins/openstack_cinder.py
+++ b/sos/plugins/openstack_cinder.py
@@ -27,16 +27,34 @@ class OpenStackCinder(Plugin):
plugin_name = "openstack_cinder"
profiles = ('openstack', 'openstack_controller')
- option_list = [("db", "gathers openstack cinder db version", "slow",
- False)]
-
var_puppet_gen = "/var/lib/config-data/puppet-generated/cinder"
def setup(self):
- if self.get_option("db"):
+
+ # collect commands output only if the openstack-cinder-api service
+ # is running
+ service_status = self.get_command_output(
+ "systemctl status openstack-cinder-api.service"
+ )
+
+ container_status = self.get_command_output("docker ps")
+ in_container = False
+ if container_status['status'] == 0:
+ for line in container_status['output'].splitlines():
+ if line.endswith("cinder_api"):
+ in_container = True
+
+ if (service_status['status'] == 0) or in_container:
+ cinder_config = ""
+ # if containerized we need to pass the config to the cont.
+ if in_container:
+ cinder_config = "--config-dir " + self.var_puppet_gen + \
+ "/etc/cinder/"
+
self.add_cmd_output(
- "cinder-manage db version",
- suggest_filename="cinder_db_version")
+ "cinder-manage " + cinder_config + " db version",
+ suggest_filename="cinder_db_version"
+ )
self.add_copy_spec([
"/etc/cinder/",
diff --git a/sos/plugins/openstack_glance.py b/sos/plugins/openstack_glance.py
index fdd789a8..4cdc6dc6 100644
--- a/sos/plugins/openstack_glance.py
+++ b/sos/plugins/openstack_glance.py
@@ -54,22 +54,37 @@ class OpenStackGlance(Plugin):
if self.get_option("verify"):
self.add_cmd_output("rpm -V %s" % ' '.join(self.packages))
- vars_all = [p in os.environ for p in [
- 'OS_USERNAME', 'OS_PASSWORD']]
-
- vars_any = [p in os.environ for p in [
- 'OS_TENANT_NAME', 'OS_PROJECT_NAME']]
-
# collect commands output only if the openstack-glance-api service
# is running
service_status = self.get_command_output(
- "systemctl status openstack-glance-api.service"
+ "systemctl status openstack-glance-api.service"
)
- if service_status['status'] == 0:
+
+ container_status = self.get_command_output("docker ps")
+ in_container = False
+ if container_status['status'] == 0:
+ for line in container_status['output'].splitlines():
+ if line.endswith("cinder_api"):
+ in_container = True
+
+ if (service_status['status'] == 0) or in_container:
+ glance_config = ""
+ # if containerized we need to pass the config to the cont.
+ if in_container:
+ glance_config = "--config-dir " + self.var_puppet_gen + \
+ "/etc/glance/"
+
self.add_cmd_output(
- "glance-manage db_version",
+ "glance-manage " + glance_config + " db_version",
suggest_filename="glance_db_version"
)
+
+ vars_all = [p in os.environ for p in [
+ 'OS_USERNAME', 'OS_PASSWORD']]
+
+ vars_any = [p in os.environ for p in [
+ 'OS_TENANT_NAME', 'OS_PROJECT_NAME']]
+
if not (all(vars_all) and any(vars_any)):
self.soslog.warning("Not all environment variables set. "
"Source the environment file for the user "
diff --git a/sos/plugins/openstack_heat.py b/sos/plugins/openstack_heat.py
index de34ed15..e3395fab 100644
--- a/sos/plugins/openstack_heat.py
+++ b/sos/plugins/openstack_heat.py
@@ -32,11 +32,26 @@ class OpenStackHeat(Plugin):
# collect commands output only if the openstack-heat-api service
# is running
- service_status = self.get_command_output("systemctl status "
- "openstack-heat-api.service")
- if service_status['status'] == 0:
+ service_status = self.get_command_output(
+ "systemctl status openstack-heat-api.service"
+ )
+
+ container_status = self.get_command_output("docker ps")
+ in_container = False
+ if container_status['status'] == 0:
+ for line in container_status['output'].splitlines():
+ if line.endswith("cinder_api"):
+ in_container = True
+
+ if (service_status['status'] == 0) or in_container:
+ heat_config = ""
+ # if containerized we need to pass the config to the cont.
+ if in_container:
+ heat_config = "--config-dir " + self.var_puppet_gen + \
+ "_api/etc/heat/"
+
self.add_cmd_output(
- "heat-manage db_version",
+ "heat-manage " + heat_config + " db_version",
suggest_filename="heat_db_version"
)
diff --git a/sos/plugins/openstack_nova.py b/sos/plugins/openstack_nova.py
index cdd29760..e8839a2a 100644
--- a/sos/plugins/openstack_nova.py
+++ b/sos/plugins/openstack_nova.py
@@ -32,40 +32,70 @@ class OpenStackNova(Plugin):
var_puppet_gen = "/var/lib/config-data/puppet-generated/nova"
def setup(self):
- # 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_all = [p in os.environ for p in [
- 'OS_USERNAME', 'OS_PASSWORD']]
-
- vars_any = [p in os.environ for p in [
- 'OS_TENANT_NAME', 'OS_PROJECT_NAME']]
+ # collect commands output only if the openstack-nova-api service
+ # is running
+ service_status = self.get_command_output(
+ "systemctl status openstack-nova-api.service"
+ )
- if not (all(vars_all) and any(vars_any)):
- 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")
+ container_status = self.get_command_output("docker ps")
+ in_container = False
+ if container_status['status'] == 0:
+ for line in container_status['output'].splitlines():
+ if line.endswith("cinder_api"):
+ in_container = True
+
+ if (service_status['status'] == 0) or in_container:
+ nova_config = ""
+ # if containerized we need to pass the config to the cont.
+ if in_container:
+ nova_config = "--config-dir " + self.var_puppet_gen + \
+ "/etc/nova/"
+
+ self.add_cmd_output(
+ "nova-manage " + nova_config + " db version",
+ suggest_filename="nova-manage_db_version"
+ )
+ self.add_cmd_output(
+ "nova-manage " + nova_config + " fixed list",
+ suggest_filename="nova-manage_fixed_list"
+ )
+ self.add_cmd_output(
+ "nova-manage " + nova_config + " floating list",
+ suggest_filename="nova-manage_floating_list"
+ )
+
+ vars_all = [p in os.environ for p in [
+ 'OS_USERNAME', 'OS_PASSWORD']]
+
+ vars_any = [p in os.environ for p in [
+ 'OS_TENANT_NAME', 'OS_PROJECT_NAME']]
+
+ if not (all(vars_all) and any(vars_any)):
+ 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 hypervisor-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"):