]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
Check partition status 439/head
authorSébastien Han <seb@redhat.com>
Fri, 20 Nov 2015 15:05:30 +0000 (16:05 +0100)
committerSébastien Han <seb@redhat.com>
Mon, 23 Nov 2015 15:20:08 +0000 (16:20 +0100)
Verify that partitions (for both osd disks and journal disks) are sane
before attempting to prepare the device. Fail if parted fails for
whatever reason.

Closes: #437
Signed-off-by: Sébastien Han <seb@redhat.com>
roles/ceph-osd/tasks/check_devices.yml

index 447a6de0cee5b2f82f304c2b452b835112aba97f..2d39f87ea5fd10c723a3ba7c9ab725ff0574b4ea 100644 (file)
   failed_when: false
   register: ispartition
 
+- name: check the partition status of the osd disks
+  shell: "parted --script {{ item }} print > /dev/null 2>&1"
+  with_items: devices
+  changed_when: false
+  failed_when: false
+  register: osd_partition_status
+  when:
+    journal_collocation or
+    raw_multi_journal
+
+- name: check the partition status of the journal devices
+  shell: "parted --script {{ item }} print > /dev/null 2>&1"
+  with_items: raw_journal_devices
+  changed_when: false
+  failed_when: false
+  register: journal_partition_status
+  when: raw_multi_journal
+
+- name: fix partitions gpt header or labels of the osd disks
+  shell: sgdisk --zap-all --clear --mbrtogpt -g -- {{ item.1 }}
+  with_together:
+    - osd_partition_status.results
+    - devices
+  changed_when: false
+  when: (journal_collocation or raw_multi_journal) and item.0.rc != 0
+
+- name: fix partitions gpt header or labels of the journal devices
+  shell: sgdisk --zap-all --clear --mbrtogpt -g -- {{ item.1 }}
+  with_together:
+    - journal_partition_status.results
+    - raw_journal_devices
+  changed_when: false
+  when: raw_multi_journal and item.0.rc != 0
+
 - name: if partition named 'ceph' exists
   shell: "parted --script {{ item }} print | egrep -sq '^ 1.*ceph'"
   with_items: devices