Skip to content

Commit

Permalink
Block Storage: Correct deployment steps
Browse files Browse the repository at this point in the history
To deploy block storage service i.e. cinder, we should first remove
the service entries from old deployments to avoid any issues in
the new RHOSO deployment.

For that we need to rewrite the steps to:

1. Deploy cinder-api pod
2. List all scheduler and backup services from old deployment
3. Remove the old scheduler and backup services
4. Deploy scheduler, volume and backup services
5. Perform DB migration

This will ensure that our RHOSO deployment is fresh and does not
contain traces of errors from services of old deployment.
  • Loading branch information
rajathere committed Nov 4, 2024
1 parent fa7eb7b commit cfe2290
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 44 deletions.
73 changes: 59 additions & 14 deletions docs_user/modules/proc_adopting-the-block-storage-service.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ $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=<patch_name>
----
+
* Replace `<patch_name>` 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]
----
Expand Down Expand Up @@ -74,6 +74,62 @@ 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-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 |
+------------------+------------------------+------+---------+-------+----------------------------+
----

. Remove services for hosts that are in the `down` state:
+
----
$ oc exec -t cinder-api-0 -c cinder-api -- cinder-manage service remove <service_binary> <service_host>
----
+
* Replace `<service_binary>` with the name of the binary, for example, `cinder-backup`.
* Replace `<service_host>` 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=<patch_name>
----
+
* Replace `<patch_name>` 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:
Expand Down Expand Up @@ -103,31 +159,20 @@ 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
+------------------+------------------------+------+---------+-------+----------------------------+
| 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 <service_binary> <service_host>
----
+
* Replace `<service_binary>` with the name of the binary, for example, `cinder-backup`.
* Replace `<service_host>` with the host name, for example, `cinder-backup-0`.

. Apply the DB data migrations:
+
[NOTE]
Expand Down
58 changes: 28 additions & 30 deletions tests/roles/cinder_adoption/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,34 @@
{{ oc_header }}
oc patch openstackcontrolplane openstack --type=merge --patch '{{ cinder_api_patch }}'
- name: Get cinder-backup down services
ansible.builtin.shell: |
{{ shell_header }}
{{ oc_header }}
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 }}"

- name: Get cinder-scheduler down services
ansible.builtin.shell: |
{{ shell_header }}
{{ oc_header }}
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 }}
Expand Down Expand Up @@ -87,36 +115,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 }}
Expand Down

0 comments on commit cfe2290

Please sign in to comment.