From 9c824b9818c296da894c7a48ad3b40707547faba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Mon, 21 Aug 2017 18:08:18 +0200 Subject: [PATCH] purge: add ability to purge bluestore osd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We now purge block db and/or wal partitions if we find any. Closes: https://github.com/ceph/ceph-ansible/issues/1770 Signed-off-by: Sébastien Han --- infrastructure-playbooks/purge-cluster.yml | 33 ++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/infrastructure-playbooks/purge-cluster.yml b/infrastructure-playbooks/purge-cluster.yml index 1bdd86ad0..0dbba2aa9 100644 --- a/infrastructure-playbooks/purge-cluster.yml +++ b/infrastructure-playbooks/purge-cluster.yml @@ -240,6 +240,18 @@ failed_when: false 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... # - name: see if encrypted partitions are present # shell: blkid -t TYPE=crypto_LUKS -o value -s PARTUUID @@ -328,6 +340,20 @@ failed_when: false 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 shell: | # 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}') partition_nb=$(echo "{{ item }}" | egrep -o '[0-9]{1,2}$') 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: - - 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' - name: purge ceph mon cluster