purge-cluster: delete block partitions if using bluestore

pull/1964/head
zhangwentao 2017-09-29 14:04:17 +08:00
parent deb5d3ba1f
commit 86a6db0d58
1 changed files with 15 additions and 1 deletions

View File

@ -262,6 +262,12 @@
failed_when: false failed_when: false
register: ceph_data_partlabels register: ceph_data_partlabels
- name: see if ceph-disk-created block partitions are present
shell: |
ls /dev/disk/by-partlabel | grep -q "ceph.*block$"
failed_when: false
register: ceph_block_partlabels
- name: see if ceph-disk-created journal partitions are present - name: see if ceph-disk-created journal partitions are present
shell: | shell: |
ls /dev/disk/by-partlabel | grep -q "ceph.*.journal" ls /dev/disk/by-partlabel | grep -q "ceph.*.journal"
@ -403,6 +409,13 @@
- osd_scenario == "lvm" - osd_scenario == "lvm"
- item.journal_vg is defined - item.journal_vg is defined
- name: get ceph block partitions
shell: |
blkid | awk '/ceph block"/ { sub (":", "", $1); print $1 }'
when: ceph_block_partlabels.rc == 0
failed_when: false
register: ceph_block_partition_to_erase_path
- name: get ceph journal partitions - name: get ceph journal partitions
shell: | shell: |
blkid | awk '/ceph journal/ { sub (":", "", $1); print $1 }' blkid | awk '/ceph journal/ { sub (":", "", $1); print $1 }'
@ -437,11 +450,12 @@
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: with_items:
- "{{ ceph_block_partition_to_erase_path.stdout_lines | default([]) }}"
- "{{ ceph_journal_partition_to_erase_path.stdout_lines | default([]) }}" - "{{ ceph_journal_partition_to_erase_path.stdout_lines | default([]) }}"
- "{{ ceph_db_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([]) }}" - "{{ ceph_wal_partition_to_erase_path.stdout_lines | default([]) }}"
when: when:
- (ceph_journal_partlabels.rc == 0 or ceph_db_partlabels.rc == 0 or ceph_wal_partlabels.rc == 0) - (ceph_block_partlabels.rc == 0 or 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