]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
purge-cluster: delete block partitions if using bluestore 1964/head
authorzhangwentao <zhangwentao@yanrongyun.com>
Fri, 29 Sep 2017 06:04:17 +0000 (14:04 +0800)
committerzhangwentao <zhangwentao@yanrongyun.com>
Fri, 29 Sep 2017 06:04:17 +0000 (14:04 +0800)
infrastructure-playbooks/purge-cluster.yml

index 67884ed9267dc5776935f2af1d6871952c6aea44..578b22d229285bfb1d6320d2eef9a8d93812e24c 100644 (file)
     failed_when: false
     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
     shell: |
       ls /dev/disk/by-partlabel | grep -q "ceph.*.journal"
       - osd_scenario == "lvm"
       - 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
     shell: |
       blkid | awk '/ceph journal/ { sub (":", "", $1); print $1 }'
       partition_nb=$(echo "{{ item }}" | egrep -o '[0-9]{1,2}$')
       sgdisk --delete $partition_nb $raw_device
     with_items:
+      - "{{ ceph_block_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_wal_partition_to_erase_path.stdout_lines | default([]) }}"
     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'
 
 - name: purge ceph mon cluster