Files
tripleo-validations/roles/overcloud_service_status/tasks/os_service.yml
Jiri Podivin 814a379b0b State and status check for cinder services was relaxed
Resolves: rhbz#2234945

Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: I423b11d3cf21cc53e231536323b6aad032791ed7
(cherry picked from commit 07388532c0)
2023-11-21 08:31:16 +00:00

95 lines
3.1 KiB
YAML

---
# Copyright 2021 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
- name: Extracting the endpoint url
set_fact:
endpoint: "{{ catalog.endpoints|selectattr('interface', 'eq', 'public')|first }}"
loop: "{{ auth_token.json.token.catalog }}"
loop_control:
loop_var: catalog
when: catalog.name == os_service
- fail:
msg: "No endpoint found for {{ os_service }} interface public in catalog"
when: endpoint is not defined
- name: Get services
uri:
url: "{{ endpoint.url }}/os-services"
method: GET
headers:
Accept: application/json
X-Auth-Token: "{{ auth_token.x_subject_token }}"
return_content: true
status_code: 200
register: os_services
- name: Verifying deprecated services are absent
assert:
that:
- service[0].binary != service[1]
fail_msg: "{{ service[0].binary }} should be removed on {{ service[0].host }}"
loop: "{{ os_services.json.services | product(overcloud_deprecated_services[os_service]) | list }}"
loop_control:
loop_var: service
when: os_service in overcloud_deprecated_services
register: deprecated_services_output
ignore_errors: true
- name: Verifying all services are up
assert:
that: >
(service.state == "up" and service.status == "enabled")
or service.status == "disabled"
or (service.status == "enabled" and service.state == "down" and service.binary is match("cinder-.*"))
fail_msg: "{{ service.binary }} on {{ service.host }} is problematic (service state is {{ service.state }} while it's {{ service.status }})"
loop: "{{ os_services.json.services }}"
loop_control:
loop_var: service
register: down_services_output
ignore_errors: true
- debug:
msg: "{{ service.binary }} on {{ service.host }} is down while it's enabled. But it isn't cause for concern."
loop: "{{ os_services.json.services }}"
loop_control:
loop_var: service
when:
- service.binary is match("cinder-.*")
- service.status == "enabled"
- service.state == "down"
- name: Asserted failure
fail:
msg: |
At least one of the assertion failed.
{% if 'failed' in deprecated_services_output %}
{% for service in deprecated_services_output.results %}
{% if service.failed %}
{{ service.msg }}
{% endif %}
{% endfor %}
{% endif %}
{% if 'failed' in down_services_output %}
{% for service in down_services_output.results %}
{% if service.failed %}
{{ service.msg }}
{% endif %}
{% endfor %}
{% endif %}
when: "'failed' in deprecated_services_output or 'failed' in down_services_output"