diff --git a/docs_user/modules/proc_adopting-the-block-storage-service.adoc b/docs_user/modules/proc_adopting-the-block-storage-service.adoc index bf2f00db8..e93c9b88e 100644 --- a/docs_user/modules/proc_adopting-the-block-storage-service.adoc +++ b/docs_user/modules/proc_adopting-the-block-storage-service.adoc @@ -21,7 +21,7 @@ $CONTROLLER1_SSH cat /var/lib/config-data/puppet-generated/cinder/etc/cinder/cin .Procedure -. Create a new file, for example, `cinder.patch`, and apply the configuration: +. Create a new file, for example, `cinder_api.patch`, and apply the configuration: + ---- $ oc patch openstackcontrolplane openstack --type=merge --patch-file= @@ -29,7 +29,7 @@ $ oc patch openstackcontrolplane openstack --type=merge --patch-file=` with the name of your patch file. + -The following example shows a `cinder.patch` file for an RBD deployment: +The following example shows a `cinder_api.patch` file: + [source,yaml] ---- @@ -74,6 +74,61 @@ spec: customServiceConfig: | [DEFAULT] default_volume_type=tripleo + cinderScheduler: + replicas: 0 + cinderBackup: + networkAttachments: + - storage + replicas: 0 + cinderVolumes: + ceph: + networkAttachments: + - storage + replicas: 0 +---- + +. Retrieve the list of the previous scheduler and backup services: ++ +---- +$ openstack volume service list + ++------------------+------------------------+------+---------+-------+----------------------------+ +| Binary | Host | Zone | Status | State | Updated At | ++------------------+------------------------+------+---------+-------+----------------------------+ +| cinder-scheduler | standalone.localdomain | nova | enabled | down | 2024-11-04T17:47:14.000000 | +| cinder-backup | standalone.localdomain | nova | enabled | down | 2024-11-04T17:47:14.000000 | +| cinder-volume | hostgroup@tripleo_ceph | nova | enabled | down | 2024-11-04T17:47:14.000000 | ++------------------+------------------------+------+---------+-------+----------------------------+ +---- + +. Remove services for hosts that are in the `down` state: ++ +---- +$ oc exec -t cinder-api-0 -c cinder-api -- cinder-manage service remove +---- ++ +* Replace `` with the name of the binary, for example, `cinder-backup`. +* Replace `` with the host name, for example, `cinder-backup-0`. ++ + +. Deploy the scheduler, backup and volume services. ++ +* Create another file, for example, `cinder_services.patch`, and apply the configuration. ++ +---- +$ oc patch openstackcontrolplane openstack --type=merge --patch-file= +---- ++ +* Replace `` with the name of your patch file. ++ +* The following example shows a `cinder_services.patch` file for an RBD deployment: ++ +[source,yaml] +---- +spec: + cinder: + enabled: true + template: cinderScheduler: replicas: 1 cinderBackup: @@ -103,7 +158,7 @@ spec: report_discard_supported=True ---- -. Retrieve the list of the previous scheduler and backup services: +. Check if all the services are up and running. + ---- $ openstack volume service list @@ -111,23 +166,12 @@ $ openstack volume service list +------------------+------------------------+------+---------+-------+----------------------------+ | Binary | Host | Zone | Status | State | Updated At | +------------------+------------------------+------+---------+-------+----------------------------+ -| cinder-backup | standalone.localdomain | nova | enabled | down | 2023-06-28T11:00:59.000000 | -| cinder-scheduler | standalone.localdomain | nova | enabled | down | 2023-06-28T11:00:29.000000 | | cinder-volume | hostgroup@tripleo_ceph | nova | enabled | up | 2023-06-28T17:00:03.000000 | | cinder-scheduler | cinder-scheduler-0 | nova | enabled | up | 2023-06-28T17:00:02.000000 | | cinder-backup | cinder-backup-0 | nova | enabled | up | 2023-06-28T17:00:01.000000 | +------------------+------------------------+------+---------+-------+----------------------------+ ---- -. Remove services for hosts that are in the `down` state: -+ ----- -$ oc exec -it cinder-scheduler-0 -- cinder-manage service remove ----- -+ -* Replace `` with the name of the binary, for example, `cinder-backup`. -* Replace `` with the host name, for example, `cinder-backup-0`. - . Apply the DB data migrations: + [NOTE] diff --git a/tests/roles/cinder_adoption/defaults/main.yaml b/tests/roles/cinder_adoption/defaults/main.yaml index 23b623742..9918e4171 100644 --- a/tests/roles/cinder_adoption/defaults/main.yaml +++ b/tests/roles/cinder_adoption/defaults/main.yaml @@ -3,7 +3,7 @@ cinder_volume_backend: "" cinder_backup_backend: "" -cinder_scheduler_api_patch: | +cinder_api_patch: | spec: cinder: enabled: true @@ -24,6 +24,9 @@ cinder_scheduler_api_patch: | metallb.universe.tf/loadBalancerIPs: 172.17.0.80 spec: type: LoadBalancer + cinderScheduler: + # Avoid deploying scheduler until we clean up old services + replicas: 0 cinderBackup: networkAttachments: - storage @@ -34,6 +37,14 @@ cinder_scheduler_api_patch: | - storage replicas: 0 # no volumes by default +cinder_scheduler_patch: | + spec: + cinder: + enabled: true + template: + cinderScheduler: + replicas: 1 + cinder_volume_backend_patch: | spec: cinder: diff --git a/tests/roles/cinder_adoption/tasks/main.yaml b/tests/roles/cinder_adoption/tasks/main.yaml index ff4a8fb6c..55282922d 100644 --- a/tests/roles/cinder_adoption/tasks/main.yaml +++ b/tests/roles/cinder_adoption/tasks/main.yaml @@ -1,8 +1,54 @@ -- name: deploy podified Cinder scheduler and API +- name: deploy podified Cinder API ansible.builtin.shell: | {{ shell_header }} {{ oc_header }} - oc patch openstackcontrolplane openstack --type=merge --patch '{{ cinder_scheduler_api_patch }}' + oc patch openstackcontrolplane openstack --type=merge --patch '{{ cinder_api_patch }}' + +- name: wait for Cinder API to start up + ansible.builtin.shell: | + {{ shell_header }} + {{ oc_header }} + oc wait pod --for condition=Ready -l component=cinder-api + register: cinder_api_running + until: cinder_api_running is success + retries: 60 + delay: 2 + +# Ignoring "-o pipefail" to avoid errors in grep which are non-fatal +- name: Get cinder-backup down services + ansible.builtin.shell: | + {{ oc_header }} + set -eux + oc exec -t openstackclient -- openstack volume service list --service cinder-backup -f value | grep "down" | awk '{ print $2 }' + register: backup_down_services + +- name: Remove old cinder-backup service + ansible.builtin.shell: | + {{ shell_header }} + {{ oc_header }} + oc exec -t cinder-api-0 -c cinder-api -- cinder-manage service remove cinder-backup "{{ item }}" + loop: "{{ backup_down_services.stdout_lines }}" + +# Ignoring "-o pipefail" to avoid errors in grep which are non-fatal +- name: Get cinder-scheduler down services + ansible.builtin.shell: | + {{ oc_header }} + set -eux + oc exec -t openstackclient -- openstack volume service list --service cinder-scheduler -f value | grep "down" | awk '{ print $2 }' + register: scheduler_down_services + +- name: Remove old cinder-scheduler service + ansible.builtin.shell: | + {{ shell_header }} + {{ oc_header }} + oc exec -t cinder-api-0 -c cinder-api -- cinder-manage service remove cinder-scheduler "{{ item }}" + loop: "{{ scheduler_down_services.stdout_lines }}" + +- name: deploy podified Cinder scheduler + ansible.builtin.shell: | + {{ shell_header }} + {{ oc_header }} + oc patch openstackcontrolplane openstack --type=merge --patch '{{ cinder_scheduler_patch }}' - name: Get the default volume type from 17.1 ansible.builtin.shell: | @@ -31,7 +77,6 @@ {{ shell_header }} {{ oc_header }} oc wait pod --for condition=Ready -l component=cinder-scheduler - oc wait pod --for condition=Ready -l component=cinder-api [ -z "{{ cinder_volume_backend }}" ] || oc wait pod --for condition=Ready -l component=cinder-volume [ -z "{{ cinder_backup_backend }}" ] || oc wait pod --for condition=Ready -l component=cinder-backup register: cinder_running_result @@ -81,36 +126,6 @@ retries: 5 delay: 2 -- name: Get cinder-backup down services - when: cinder_backup_backend != '' - ansible.builtin.shell: | - {{ shell_header }} - {{ oc_header }} - oc exec -t openstackclient -- openstack volume service list --service cinder-backup --sort-column "Updated At" -c Host -f value | head -n -1 - register: backup_down_services - -- name: Remove old cinder-backup service - when: cinder_backup_backend != '' - ansible.builtin.shell: | - {{ shell_header }} - {{ oc_header }} - oc exec -t cinder-scheduler-0 -- cinder-manage service remove cinder-backup "{{ item }}" - loop: "{{ backup_down_services.stdout_lines }}" - -- name: Get cinder-scheduler down services - ansible.builtin.shell: | - {{ shell_header }} - {{ oc_header }} - oc exec -t openstackclient -- openstack volume service list --service cinder-scheduler --sort-column "Updated At" -c Host -f value | head -n -1 - register: scheduler_down_services - -- name: Remove old cinder-scheduler service - ansible.builtin.shell: | - {{ shell_header }} - {{ oc_header }} - oc exec -t cinder-scheduler-0 -- cinder-manage service remove cinder-scheduler "{{ item }}" - loop: "{{ scheduler_down_services.stdout_lines }}" - - name: Cinder online data migrations ansible.builtin.shell: | {{ shell_header }}