aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sos/plugins/__init__.py11
-rw-r--r--sos/plugins/openstack_cinder.py27
2 files changed, 26 insertions, 12 deletions
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
index 98364da1..fbcf235d 100644
--- a/sos/plugins/__init__.py
+++ b/sos/plugins/__init__.py
@@ -1052,6 +1052,17 @@ class Plugin(object):
else:
return html
+ def check_process_by_name(self, pr):
+ """Checks if a named process is listed in ps -ef output."""
+ ps = self.get_command_output("ps -ef")
+ status = False
+ if ps['status'] == 0:
+ for line in ps['output'].splitlines():
+ if pr in line:
+ status = True
+ break
+ return status
+
class RedHatPlugin(object):
"""Tagging class for Red Hat's Linux distributions"""
diff --git a/sos/plugins/openstack_cinder.py b/sos/plugins/openstack_cinder.py
index a023105c..cc9181ef 100644
--- a/sos/plugins/openstack_cinder.py
+++ b/sos/plugins/openstack_cinder.py
@@ -31,26 +31,29 @@ class OpenStackCinder(Plugin):
def setup(self):
- # collect commands output only if the openstack-cinder-api service
- # is running
- service_status = self.get_command_output(
- "systemctl status openstack-cinder-api.service"
- )
+ # check if either standalone (cinder-api) or httpd wsgi (cinder_wsgi)
+ # is up and running
+ cinder_process = ["cinder_wsgi", "cinder-api"]
+ in_ps = False
+ for process in cinder_process:
+ in_ps = self.check_process_by_name(process)
+ if in_ps:
+ break
container_status = self.get_command_output("docker ps")
in_container = False
+ cinder_config = ""
if container_status['status'] == 0:
for line in container_status['output'].splitlines():
if line.endswith("cinder_api"):
in_container = True
+ # if containerized we need to pass the config to the cont.
+ cinder_config = "--config-dir " + self.var_puppet_gen + \
+ "/etc/cinder/"
+ break
- 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/"
-
+ # collect commands output if the standalone, wsgi or container is up
+ if in_ps or in_container:
self.add_cmd_output(
"cinder-manage " + cinder_config + " db version",
suggest_filename="cinder_db_version"