Merge "Adjust the Ceph restore to support AIO-DX with 3 Ceph monitors"

This commit is contained in:
Zuul 2024-08-06 17:35:40 +00:00 committed by Gerrit Code Review
commit da9468c6df
2 changed files with 16 additions and 14 deletions

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# #
# Copyright (c) 2021-2023 Wind River Systems, Inc. # Copyright (c) 2021-2024 Wind River Systems, Inc.
# #
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
@ -15,6 +15,8 @@
# - https://github.com/ansible/ansible/issues/70092 # - https://github.com/ansible/ansible/issues/70092
sleep 2 sleep 2
CEPH_BIN=/usr/bin/ceph
FS_NAME=kube-cephfs FS_NAME=kube-cephfs
DATA_POOL_NAME=kube-cephfs-data DATA_POOL_NAME=kube-cephfs-data
METADATA_POOL_NAME=kube-cephfs-metadata METADATA_POOL_NAME=kube-cephfs-metadata
@ -29,13 +31,13 @@ set -x
/etc/init.d/ceph stop mds /etc/init.d/ceph stop mds
# Check if the filesystem for the system RWX provisioner is present # Check if the filesystem for the system RWX provisioner is present
ceph fs ls | grep ${FS_NAME} ${CEPH_BIN} fs ls | grep ${FS_NAME}
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
# Use existing metadata/data pools to recover cephfs # Use existing metadata/data pools to recover cephfs
ceph fs new ${FS_NAME} ${METADATA_POOL_NAME} ${DATA_POOL_NAME} --force ${CEPH_BIN} fs new ${FS_NAME} ${METADATA_POOL_NAME} ${DATA_POOL_NAME} --force
# Recover MDS state from filesystem # Recover MDS state from filesystem
ceph fs reset ${FS_NAME} --yes-i-really-mean-it ${CEPH_BIN} fs reset ${FS_NAME} --yes-i-really-mean-it
# Try to recover from some common errors # Try to recover from some common errors
cephfs-journal-tool --rank=${FS_NAME}:0 event recover_dentries summary cephfs-journal-tool --rank=${FS_NAME}:0 event recover_dentries summary

View File

@ -1,6 +1,6 @@
--- ---
# #
# Copyright (c) 2019-2023 Wind River Systems, Inc. # Copyright (c) 2019-2024 Wind River Systems, Inc.
# #
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
@ -257,7 +257,7 @@
- debug: var=prepare_ceph_partitions.stdout_lines - debug: var=prepare_ceph_partitions.stdout_lines
- name: Bring up ceph-mon - name: Bring up ceph-mon
command: /etc/init.d/ceph start mon command: /etc/init.d/ceph start mon.{{ mon_name }}
# Recover ceph-data from every osd with ceph-objectore-tool # Recover ceph-data from every osd with ceph-objectore-tool
- name: Recover ceph-data - name: Recover ceph-data
@ -267,7 +267,7 @@
- debug: var=ceph_data_out.stdout_lines - debug: var=ceph_data_out.stdout_lines
- name: Bring down ceph-mon - name: Bring down ceph-mon
command: /etc/init.d/ceph stop mon command: /etc/init.d/ceph stop mon.{{ mon_name }}
- name: Delete store.db file from ceph-mon - name: Delete store.db file from ceph-mon
file: file:
@ -306,10 +306,10 @@
state: absent state: absent
- name: Bring up ceph Monitor - name: Bring up ceph Monitor
command: /etc/init.d/ceph start mon command: /etc/init.d/ceph start mon.{{ mon_name }}
- name: Wait for ceph monitor to be up - name: Wait for ceph monitor to be up
shell: timeout 15 ceph -s shell: timeout 15 /usr/bin/ceph -s
retries: 5 retries: 5
delay: 2 delay: 2
register: result register: result
@ -329,14 +329,14 @@
until: result.rc == 0 until: result.rc == 0
- name: Enable Ceph Msgr v2 protocol - name: Enable Ceph Msgr v2 protocol
shell: ceph mon enable-msgr2 shell: /usr/bin/ceph mon enable-msgr2
retries: 5 retries: 5
delay: 2 delay: 2
register: result register: result
until: result.rc == 0 until: result.rc == 0
- name: Wait for V2 protocol to be enabled - name: Wait for V2 protocol to be enabled
shell: ceph -s shell: /usr/bin/ceph -s
register: result register: result
until: "'1 monitors have not enabled msgr2' not in result" until: "'1 monitors have not enabled msgr2' not in result"
retries: 30 retries: 30
@ -346,7 +346,7 @@
command: /usr/bin/ceph-mgr --cluster ceph --id controller-0 - start ceph-mgr command: /usr/bin/ceph-mgr --cluster ceph --id controller-0 - start ceph-mgr
- name: Wait for ceph-mgr to detect Ceph's pools - name: Wait for ceph-mgr to detect Ceph's pools
shell: ceph -s shell: /usr/bin/ceph -s
register: result register: result
until: "'0 pools' not in result" until: "'0 pools' not in result"
retries: 30 retries: 30
@ -362,8 +362,8 @@
path: "/etc/ceph/ceph.client.guest.keyring" path: "/etc/ceph/ceph.client.guest.keyring"
state: touch state: touch
- name: Restart ceph one more time to pick latest changes - name: Restart ceph-mon one more time to pick latest changes
command: /etc/init.d/ceph restart command: /etc/init.d/ceph restart mon.{{ mon_name }}
- name: Check and recover CephFs filesystem - name: Check and recover CephFs filesystem
script: recover_cephfs.sh script: recover_cephfs.sh