Merge pull request #1778 from ceph/fix-1770

purge: add ability to purge bluestore osd
pull/1625/head
Sébastien Han 2017-08-22 23:56:36 +02:00 committed by GitHub
commit 1ac0969c28
1 changed files with 31 additions and 2 deletions

View File

@ -240,6 +240,18 @@
failed_when: false failed_when: false
register: ceph_journal_partlabels register: ceph_journal_partlabels
- name: see if ceph-disk-created block db partitions are present
shell: |
ls /dev/disk/by-partlabel | grep -q "ceph.*.block.db"
failed_when: false
register: ceph_db_partlabels
- name: see if ceph-disk-created block wal partitions are present
shell: |
ls /dev/disk/by-partlabel | grep -q "ceph.*.block.wal"
failed_when: false
register: ceph_wal_partlabels
# Initial attempt, doing everything in Ansible... # Initial attempt, doing everything in Ansible...
# - name: see if encrypted partitions are present # - name: see if encrypted partitions are present
# shell: blkid -t TYPE=crypto_LUKS -o value -s PARTUUID # shell: blkid -t TYPE=crypto_LUKS -o value -s PARTUUID
@ -328,6 +340,20 @@
failed_when: false failed_when: false
register: ceph_journal_partition_to_erase_path register: ceph_journal_partition_to_erase_path
- name: get ceph db partitions
shell: |
blkid | awk '/ceph block.db/ { sub (":", "", $1); print $1 }'
when: ceph_db_partlabels.rc == 0
failed_when: false
register: ceph_db_partition_to_erase_path
- name: get ceph wal partitions
shell: |
blkid | awk '/ceph block.wal/ { sub (":", "", $1); print $1 }'
when: ceph_wal_partlabels.rc == 0
failed_when: false
register: ceph_wal_partition_to_erase_path
- name: zap ceph journal partitions - name: zap ceph journal partitions
shell: | shell: |
# if the disk passed is a raw device AND the boot system disk # if the disk passed is a raw device AND the boot system disk
@ -340,9 +366,12 @@
raw_device=$(echo "{{ item }}" | egrep -o '/dev/([hsv]d[a-z]{1,2}|cciss/c[0-9]d[0-9]|nvme[0-9]n[0-9]){1,2}') raw_device=$(echo "{{ item }}" | egrep -o '/dev/([hsv]d[a-z]{1,2}|cciss/c[0-9]d[0-9]|nvme[0-9]n[0-9]){1,2}')
partition_nb=$(echo "{{ item }}" | egrep -o '[0-9]{1,2}$') partition_nb=$(echo "{{ item }}" | egrep -o '[0-9]{1,2}$')
sgdisk --delete $partition_nb $raw_device sgdisk --delete $partition_nb $raw_device
with_items: "{{ ceph_journal_partition_to_erase_path.stdout_lines | default([]) }}" with_items:
- "{{ ceph_journal_partition_to_erase_path.stdout_lines | default([]) }}"
- "{{ ceph_db_partition_to_erase_path.stdout_lines | default([]) }}"
- "{{ ceph_wal_partition_to_erase_path.stdout_lines | default([]) }}"
when: when:
- ceph_journal_partlabels.rc == 0 - (ceph_journal_partlabels.rc == 0 or ceph_db_partlabels.rc == 0 or ceph_wal_partlabels.rc == 0)
- osd_scenario == 'non-collocated' - osd_scenario == 'non-collocated'
- name: purge ceph mon cluster - name: purge ceph mon cluster