diff options
author | Martin Schuppert <mschuppert@redhat.com> | 2017-12-29 09:20:33 +0100 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2018-04-16 16:50:33 +0100 |
commit | cf12ad5381e72556e092173f6cb0b918020cb6db (patch) | |
tree | 59d4ffbcd04ea11cd77e0e5fb3193a5329fe3199 | |
parent | 971b9581779da20384f0a4d8de5177c0b87d6892 (diff) | |
download | sos-cf12ad5381e72556e092173f6cb0b918020cb6db.tar.gz |
[openstack_cinder] check for api service running via cinder_wsgi
With OSP11 cinder api changed to run via https wsgi. To check for
running cinder-manage command we also need to take this situation.
The change checks for cinder_wsgi process.
Resolves: #1178
Signed-off-by: Martin Schuppert <mschuppert@redhat.com>
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/plugins/__init__.py | 11 | ||||
-rw-r--r-- | sos/plugins/openstack_cinder.py | 27 |
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" |