Merge "B&R: Recover Ceph data on standard with storage nodes"

This commit is contained in:
Zuul 2019-10-04 22:02:34 +00:00 committed by Gerrit Code Review
commit e9da7e9fc5
6 changed files with 61 additions and 24 deletions

View File

@ -658,10 +658,15 @@
apiserver_oidc.username_claim is not defined)
# Wipe ceph osds
# Note that due to Ansible mishandling of boolean values via extra-vars we are
# adding supplementary validation here.
# See: https://github.com/ansible/ansible/issues/17193
- name: Check for Ceph data wipe flag
fail:
msg: "wipe_ceph_osds is misconfigured. Valid value is either 'true' or 'false'"
when: (mode == "restore") and (not wipe_ceph_osds | type_debug == 'bool')
when: (mode == "restore") and (not wipe_ceph_osds | type_debug == 'bool') and
(wipe_ceph_osds != 'true') and
(wipe_ceph_osds != 'false')
- block:
- name: Wipe ceph osds

View File

@ -9,26 +9,6 @@
- name: Restore CEPH Monitor data
block:
# Get system_mode after restore
- name: Retrieve system mode
shell: source /etc/platform/platform.conf; echo $system_mode
register: restore_system_mode_result
- name: Fail if system mode is not defined
fail:
msg: "system_mode is missing in /etc/platform/platform.conf"
when: restore_system_mode_result.stdout_lines|length == 0
- name: Set facts
set_fact:
restore_system_mode: "{{ restore_system_mode_result.stdout_lines[0] }}"
- name: Create flag file in /etc/platform to skip wiping OSDs
file:
path: "{{ skip_ceph_osds_wipe_flag }}"
state: touch
when: restore_system_mode != 'simplex'
- name: Restore ceph.conf file
command: >-
tar -C / -xpf {{ target_backup_dir }}/{{ backup_filename }}

View File

@ -1,5 +1,4 @@
---
skip_ceph_osds_wipe_flag: /etc/platform/.skip_ceph_osds_wipe
ceph_mon_manifest_apply_log: /tmp/ceph_mon_apply_manifest.log
ceph_wait_time: 60
drbd_cephmon_res: /etc/drbd.d/drbd-cephmon.res

View File

@ -28,6 +28,16 @@
failed_when: false
register: search_result
# Note that due to Ansible mishandling of boolean values via extra-vars we are
# adding supplementary validation here.
# See: https://github.com/ansible/ansible/issues/17193
- name: Check for Ceph data wipe flag
fail:
msg: "wipe_ceph_osds is misconfigured. Valid value is either 'true' or 'false'"
when: (not wipe_ceph_osds | type_debug == 'bool') and
(wipe_ceph_osds != 'true') and
(wipe_ceph_osds != 'false')
- block:
- name: Extract override file from backup tarball
shell: >-

View File

@ -277,6 +277,14 @@
psql -c "update i_host set administrative='locked', operational='disabled',
availability='offline'" sysinv
become_user: postgres
when: wipe_ceph_osds|bool
- name: Set all the hosts, except storage nodes to locked/disabled/offline state
shell: >-
psql -c "update i_host set administrative='locked', operational='disabled',
availability='offline' where personality!='storage'" sysinv
become_user: postgres
when: not wipe_ceph_osds|bool
# Set platform-integ-apps to "uploaded" state, so that once ceph is up after
# controller-0 is unlocked for the first time, the manifest will be applied.
@ -347,8 +355,42 @@
# Restore ceph-mon data
- block:
- include_role:
name: recover-ceph-data
- block:
# Recover procedure for systems with storage nodes is different from
# that of systems with controller storage:
# - For controller storage we recover ceph-mon data by scanning OSDs.
# - For systems with storage nodes we get ceph-mon data from storage-0
# ceph-mon that is already up and will not be reinstalled.
- name: Check if setup has storage nodes
shell: source /etc/platform/openrc; system host-list | awk '$6=="storage"{exit 1}'
register: storage_nodes
failed_when: false
# Get system_mode after restore and create flag file to skip wiping OSDs
- name: Retrieve system mode
shell: source /etc/platform/platform.conf; echo $system_mode
register: restore_system_mode_result
- name: Fail if system mode is not defined
fail:
msg: "system_mode is missing in /etc/platform/platform.conf"
when: restore_system_mode_result.stdout_lines|length == 0
- name: Set system mode fact
set_fact:
restore_system_mode: "{{ restore_system_mode_result.stdout_lines[0] }}"
- name: Create flag file in /etc/platform to skip wiping OSDs
file:
path: "{{ skip_ceph_osds_wipe_flag }}"
state: touch
when: restore_system_mode != 'simplex'
# Recover ceph data for systems with controller storage
- include_role:
name: recover-ceph-data
when: storage_nodes.rc == 0
when: not wipe_ceph_osds|bool
- name: Inform user that restore_platform is run successfully

View File

@ -5,6 +5,7 @@ extension_permdir: /opt/extension
patch_vault_permdir: /opt/patch-vault
ldap_permdir: /var/lib/openldap-data
crushmap_file: crushmap.bin.backup
skip_ceph_osds_wipe_flag: /etc/platform/.skip_ceph_osds_wipe
# The staging area to process the data from the backup tarball
# after bootstrap controller-0 is done during the restore.