shrink-osd: (ceph-disk only) remove gpt header

Removing the gpt header on devices will ease ceph-disk to ceph-volume
migration when using shrink-osd + add-osd playbooks.
ceph-disk requires GPT header where ceph-volume will complain if GPT
header is present.
That won't break ceph-disk (re)deployment since we check and add the GPT
header if needed when deploying ceph-disk ODs.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1613735

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
pull/4218/head
Guillaume Abrioux 2019-07-09 09:48:08 +02:00 committed by Dimitri Savineau
parent 94cdef2757
commit 4b49013369
1 changed files with 11 additions and 7 deletions

View File

@ -106,16 +106,14 @@
# NOTE(leseb): using '>' is the only way I could have the command working
- name: find osd device based on the id
shell: >
docker run --privileged=true -v /dev:/dev --entrypoint /usr/sbin/ceph-disk
{{ ceph_docker_registry}}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
{{ 'docker run --privileged=true -v /dev:/dev --entrypoint' if containerized_deployment else '' }} /usr/sbin/ceph-disk
{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else '' }}
list | awk -v pattern=osd.{{ item.0 }} '$0 ~ pattern {print $1}'
with_together:
- "{{ osd_to_kill.split(',') }}"
- "{{ osd_hosts }}"
register: osd_to_kill_disks
delegate_to: "{{ item.1 }}"
when:
- containerized_deployment
- name: find osd dedicated devices - container
shell: >
@ -161,8 +159,6 @@
with_together:
- "{{ osd_to_kill_disks.results }}"
- "{{ osd_hosts }}"
when:
- containerized_deployment
- name: zap ceph osd disks
shell: |
@ -172,7 +168,8 @@
-v /dev/:/dev/ \
-e OSD_DEVICE=/dev/{{ item.0.stdout }} \
{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} \
zap_device
zap_device;
parted -s /dev/{{ item.0.stdout }} mklabel msdos
delegate_to: "{{ item.1 }}"
with_together:
- "{{ resolved_parent_device.results }}"
@ -226,6 +223,13 @@
when:
- not containerized_deployment
- name: remove gpt header on device
command: parted -s /dev/"{{ item.0.stdout }}" mklabel msdos
delegate_to: "{{ item.1 }}"
with_together:
- "{{ resolved_parent_device.results }}"
- "{{ osd_hosts }}"
- name: remove osd(s) from crush_map when ceph-disk destroy fail
command: "{{ docker_exec_cmd }} ceph --cluster {{ cluster }} osd crush remove osd.{{ item }}"
run_once: true