From 5038364cb2072d3d8cacc12aef176717f0ee9a01 Mon Sep 17 00:00:00 2001 From: Lukas Bezdicka Date: Mon, 26 Feb 2018 14:36:34 +0100 Subject: [PATCH] FFU: Fix Cinder services action order We should try to disable pacemaker resource and shut down services in step 1 and make sure we check running services only once. Change-Id: I5676132be477695838c59a0d59c62e09e335a8f0 --- docker/services/cinder-api.yaml | 32 ++++++++++++----- docker/services/cinder-scheduler.yaml | 15 ++++++-- docker/services/cinder-volume.yaml | 15 ++++++-- docker/services/pacemaker/cinder-volume.yaml | 38 ++++++++++++++++++-- 4 files changed, 82 insertions(+), 18 deletions(-) diff --git a/docker/services/cinder-api.yaml b/docker/services/cinder-api.yaml index 9acf45d995..e6d91d3588 100644 --- a/docker/services/cinder-api.yaml +++ b/docker/services/cinder-api.yaml @@ -248,13 +248,32 @@ outputs: - name: Check is cinder_api is deployed command: systemctl is-enabled --quiet openstack-cinder-api ignore_errors: True - register: cinder_api_enabled + register: cinder_api_enabled_result + when: + - step|int == 0 + - release == 'ocata' + - name: Set fact cinder_api_enabled + set_fact: + cinder_api_enabled: "{{ cinder_api_enabled_result.rc == 0 }}" + when: + - step|int == 0 + - release == 'ocata' - name: Stop openstack-cinder-api service: name=openstack-cinder-api state=stopped when: - - step|int == 2 + - step|int == 1 - release == 'ocata' - - cinder_api_enabled.rc == 0 + - cinder_api_enabled|bool + - name: Extra removal of services for cinder + shell: | + cinder-manage service list |\ + grep -v Binary | tr '@' ' ' |\ + awk '{print $1 " " $2}' |\ + while read i ; do cinder-manage service remove $i ; done + when: + - step|int == 5 + - release == 'pike' + - is_bootstrap_node|bool - name: Extra migration for cinder command: cinder-manage db online_data_migrations when: @@ -262,12 +281,7 @@ outputs: - release == 'pike' - is_bootstrap_node|bool - name: Cinder package update - command: yum update -y "{{ item }}" - with_items: - - puppet-cinder - - python2-cinderclient - - python-cinder - - openstack-cinder + yum: name=openstack-cinder* state=latest when: - step|int == 6 - is_bootstrap_node|bool diff --git a/docker/services/cinder-scheduler.yaml b/docker/services/cinder-scheduler.yaml index 64b1267d86..e946c91f10 100644 --- a/docker/services/cinder-scheduler.yaml +++ b/docker/services/cinder-scheduler.yaml @@ -161,10 +161,19 @@ outputs: - name: Check if cinder_scheduler is deployed command: systemctl is-enabled --quiet openstack-cinder-scheduler ignore_errors: True - register: cinder_scheduler_enabled + register: cinder_scheduler_enabled_result + when: + - step|int == 0 + - release == 'ocata' + - name: Set fact cinder_scheduler_enabled + set_fact: + cinder_scheduler_enabled: "{{ cinder_scheduler_enabled_result.rc == 0 }}" + when: + - step|int == 0 + - release == 'ocata' - name: Stop openstack-cinder-scheduler service: name=openstack-cinder-scheduler state=stopped enabled=no when: - - step|int == 2 + - step|int == 1 - release == 'ocata' - - cinder_scheduler_enabled.rc == 0 + - cinder_scheduler_enabled|bool diff --git a/docker/services/cinder-volume.yaml b/docker/services/cinder-volume.yaml index 2b8c25a21c..0b20438a00 100644 --- a/docker/services/cinder-volume.yaml +++ b/docker/services/cinder-volume.yaml @@ -236,10 +236,19 @@ outputs: - name: Check if cinder_volume is deployed command: systemctl is-enabled --quiet openstack-cinder-volume ignore_errors: True - register: cinder_volume_enabled + register: cinder_volume_enabled_result + when: + - step|int == 0 + - release == 'ocata' + - name: Set fact cinder_volume_enabled + set_fact: + cinder_volume_enabled: "{{ cinder_volume_enabled_result.rc == 0 }}" + when: + - step|int == 0 + - release == 'ocata' - name: Stop openstack-cinder-volume service: name=openstack-cinder-volume state=stopped enabled=no when: - - step|int == 2 + - step|int == 1 - release == 'ocata' - - cinder_volume_enabled.rc == 0 + - cinder_volume_enabled|bool diff --git a/docker/services/pacemaker/cinder-volume.yaml b/docker/services/pacemaker/cinder-volume.yaml index 74afca3b01..19b2f2e816 100644 --- a/docker/services/pacemaker/cinder-volume.yaml +++ b/docker/services/pacemaker/cinder-volume.yaml @@ -291,9 +291,9 @@ outputs: set_fact: is_bootstrap_node={{bootstrap_node.stdout|lower == ansible_hostname|lower}} - name: Check cluster resource status pacemaker_resource: - resource: {get_attr: [CinderBase, role_data, service_name]} - state: started - check_mode: true + resource: openstack-cinder-volume + state: show + check_mode: false ignore_errors: true register: cinder_volume_res - when: (is_bootstrap_node) and (cinder_volume_res|succeeded) @@ -316,3 +316,35 @@ outputs: until: output.rc == 0 - name: Disable cinder_volume service from boot service: name=openstack-cinder-volume enabled=no + fast_forward_upgrade_tasks: + - name: Check cluster resource status + pacemaker_resource: + resource: openstack-cinder-volume + state: show + check_mode: false + ignore_errors: true + register: cinder_volume_res_result + when: + - step|int == 0 + - release == 'ocata' + - is_bootstrap_node|bool + - name: Set fact cinder_volume_res + set_fact: + cinder_volume_res: "{{ cinder_volume_res_result.rc == 0 }}" + when: + - step|int == 0 + - release == 'ocata' + - is_bootstrap_node|bool + - name: Disable the openstack-cinder-volume cluster resource + pacemaker_resource: + resource: openstack-cinder-volume + state: disable + wait_for_resource: true + register: cinder_volume_output + retries: 5 + until: cinder_volume_output.rc == 0 + when: + - step|int == 2 + - release == 'ocata' + - is_bootstrap_node|bool + - cinder_volume_res|bool