[queens-only] Unmount cinder NFS shares during upgrade

Unmount any cinder NFS shares on the host when upgrading cinder from
running on the host to running in a kolla container. This ensures
there are no active NFS mounts in cinder's service directory prior to
launching the container. Kolla recusively changes the ownership of
/var/lib/cinder, so removing the mounts prevents kolla from inadvertently
changing the ownership of files on the NFS storage backends.

Closes-Bug: #1887435
Change-Id: I5f0cedb808c6371caee6918da5b8bef743971221
This commit is contained in:
Alan Bishop 2020-07-20 06:09:56 -07:00
parent 944abd50d8
commit 6df5268155
2 changed files with 53 additions and 3 deletions

View File

@ -175,6 +175,17 @@ outputs:
- name: Stop and disable cinder_volume service
when: cinder_volume_enabled|bool
service: name=openstack-cinder-volume state=stopped enabled=no
- name: Unmount cinder NFS shares mounted on the host
mount:
path: "{{ item.mount }}"
state: unmounted
loop: "{{ ansible_mounts }}"
loop_control:
label: "{{ item.mount }}"
index_var: cinder_mount_index
when:
- "'/var/lib/cinder/' in item.mount"
- "'nfs' in item.fstype"
- when: step|int == 3
block:
- name: Set fact for removal of openstack-cinder package
@ -198,9 +209,24 @@ outputs:
when:
- step|int == 0
- release == 'ocata'
- name: Stop openstack-cinder-volume
service: name=openstack-cinder-volume state=stopped enabled=no
when:
- when:
- step|int == 1
- release == 'ocata'
- cinder_volume_enabled|bool
block:
- name: Stop openstack-cinder-volume
service:
name: openstack-cinder-volume
state: stopped
enabled: no
- name: Unmount cinder NFS shares mounted on the host
mount:
path: "{{ item.mount }}"
state: unmounted
loop: "{{ ansible_mounts }}"
loop_control:
label: "{{ item.mount }}"
index_var: cinder_mount_index
when:
- "'/var/lib/cinder/' in item.mount"
- "'nfs' in item.fstype"

View File

@ -321,6 +321,17 @@ outputs:
until: output.rc == 0
- name: Disable cinder_volume service from boot
service: name=openstack-cinder-volume enabled=no
- name: Unmount cinder NFS shares mounted on the host
mount:
path: "{{ item.mount }}"
state: unmounted
loop: "{{ ansible_mounts }}"
loop_control:
label: "{{ item.mount }}"
index_var: cinder_mount_index
when:
- "'/var/lib/cinder/' in item.mount"
- "'nfs' in item.fstype"
- name: Update cinder_volume pcs resource bundle for new container image
when:
- step|int == 1
@ -384,3 +395,16 @@ outputs:
- release == 'ocata'
- is_bootstrap_node|bool
- cinder_volume_res|bool
- name: Unmount cinder NFS shares mounted on the host
mount:
path: "{{ item.mount }}"
state: unmounted
loop: "{{ ansible_mounts }}"
loop_control:
label: "{{ item.mount }}"
index_var: cinder_mount_index
when:
- step|int == 2
- release == 'ocata'
- "'/var/lib/cinder/' in item.mount"
- "'nfs' in item.fstype"