Skip to content
This repository has been archived by the owner on Mar 30, 2023. It is now read-only.

Commit

Permalink
Fence a race condition by checking the presence of partitions (#123)
Browse files Browse the repository at this point in the history
Wait for partitions to appear in /dev
Make sure they are block devices before running mkfs
  • Loading branch information
jsteel44 authored and JohnGarbutt committed Jan 15, 2020
1 parent cd66bda commit 6ceef9e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
14 changes: 14 additions & 0 deletions fs-ansible/roles/lustre/tasks/format.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@
state: present
loop: "{{ mdts.keys() }}"

- name: Wait for MDT partition to appear in /dev
wait_for:
path: "/dev/{{ item }}p1"
timeout: 30
sleep: 5
loop: "{{ mdts.keys() }}"

- name: Reformat MDTs
command: "/usr/sbin/mkfs.lustre --mdt --reformat --fsname={{ fs_name }} --index={{ item.value }} --mgsnode={{ mgsnode }}{{ lnet_suffix }} /dev/{{ item.key }}p1"
loop: "{{ mdts|dict2items }}"
Expand All @@ -56,6 +63,13 @@
state: present
loop: "{{ osts.keys() }}"

- name: Wait for OST partition to appear in /dev
wait_for:
path: "/dev/{{ item }}p2"
timeout: 30
sleep: 5
loop: "{{ osts.keys() }}"

- name: Reformat OSTs
command: "/usr/sbin/mkfs.lustre --ost --reformat --fsname={{ fs_name }} --index={{ item.value }} --mgsnode={{ mgsnode }}{{ lnet_suffix }} /dev/{{ item.key }}p2"
loop: "{{ osts|dict2items }}"
18 changes: 17 additions & 1 deletion fs-ansible/roles/lustre/tasks/wipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,20 @@
device: "/dev/{{ item }}"
number: 2
state: absent
loop: "{{ (mdts.keys() + osts.keys()) | unique }}"
loop: "{{ (mdts.keys() + osts.keys()) | unique }}"

- name: Wait for MDT partition to disappear from /dev
wait_for:
path: "/dev/{{ item }}p1"
state: absent
timeout: 120
sleep: 5
loop: "{{ (mdts.keys() + osts.keys()) | unique }}"

- name: Wait for OST partition to disappear from /dev
wait_for:
path: "/dev/{{ item }}p2"
state: absent
timeout: 120
sleep: 5
loop: "{{ (mdts.keys() + osts.keys()) | unique }}"

0 comments on commit 6ceef9e

Please sign in to comment.