From 0306fa4d15c2b01423b2b4e2de692262eeb28bbb Mon Sep 17 00:00:00 2001 From: Jose Luis Franco Arza Date: Fri, 8 Sep 2017 12:58:24 +0200 Subject: [PATCH] Add validation task in docker services [Swift] Docker services are missing the pre-upgrade validation task in the upgrade_tasks section which verifies if the service is running before going on with the upgrade. Change-Id: I16f38d9e1042c5d83455a28882b4a024aac27699 Partial-Bug: #1704389 --- docker/services/swift-proxy.yaml | 9 +++++++++ docker/services/swift-storage.yaml | 17 ++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/docker/services/swift-proxy.yaml b/docker/services/swift-proxy.yaml index 3a27ab8514..2eaa9d6439 100644 --- a/docker/services/swift-proxy.yaml +++ b/docker/services/swift-proxy.yaml @@ -148,6 +148,15 @@ outputs: - /var/log/containers/httpd/swift-proxy - /srv/node upgrade_tasks: + - name: Check if swift_proxy is deployed + command: systemctl is-enabled --quiet openstack-swift-proxy + tags: common + ignore_errors: True + register: swift_proxy_enabled + - name: "PreUpgrade step0,validation: Check service openstack-swift-proxy is running" + command: systemctl is-active --quiet openstack-swift-proxy + when: swift_proxy_enabled.rc == 0 + tags: step0,validation - name: Stop and disable swift_proxy service tags: step2 service: name=openstack-swift-proxy state=stopped enabled=no diff --git a/docker/services/swift-storage.yaml b/docker/services/swift-storage.yaml index 2d7aff6ef2..5126abdd97 100644 --- a/docker/services/swift-storage.yaml +++ b/docker/services/swift-storage.yaml @@ -457,9 +457,11 @@ outputs: for_each: DEVICE: {get_param: SwiftRawDisks} upgrade_tasks: - - name: Stop and disable swift storage services - tags: step2 - service: name={{ item }} state=stopped enabled=no + - name: Check if swift storage services are deployed + command: systemctl is-enabled --quiet "{{ item }}" + tags: common + register: swift_services_enabled + ignore_errors: true with_items: - openstack-swift-account-auditor - openstack-swift-account-reaper @@ -474,6 +476,15 @@ outputs: - openstack-swift-object-replicator - openstack-swift-object-updater - openstack-swift-object + - name: "PreUpgrade step0,validation: Check swift storage services are running" + command: systemctl is-active --quiet "{{ item.item }}" + tags: step0,validation + with_items: "{{ swift_services_enabled.results }}" + when: item.rc == 0 + - name: Stop and disable swift storage services + tags: step2 + service: name={{ item.item }} state=stopped enabled=no + with_items: "{{ swift_services_enabled.results }}" - name: Remove openstack-swift-container,object,account packages if operator requests it yum: name={{ item }} state=removed tags: step2