Skip to content

Commit

Permalink
part2: Use common for devnode sanitation.
Browse files Browse the repository at this point in the history
sanitize_devnode will follow the symlink alias and print the block
device full path on stdout.
Use the interface instead of local snippets.

Signed-off-by: Eric Chanudet <[email protected]>

OXT-1654

(cherry picked from commit bb0483f)
Signed-off-by: Eric Chanudet <[email protected]>
  • Loading branch information
Eric Chanudet committed Jul 25, 2019
1 parent 027f5cb commit fb009ec
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions part2/stages/Remove-partitions
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,13 @@

# Remove every VG assigned to that disk.
vgs=$(vgs --noheading -o vg_name)
if [ -L ${TARGET_DISK} ]; then
dev="/dev/$(readlink ${TARGET_DISK})"
else
dev="${TARGET_DISK}"
fi
for vg in ${vgs}; do
# List all PV backing current VG.
pvs="$(vgs --noheading -o pv_name ${vg})"
pvs_on_target=""
pvs_others=""
for p in ${pvs}; do
if [ -L "${p}" ]; then
# NVMe will sometimes appear as symlinks to the actual device in
# the devfs (e.g: /dev/512GB_ -> nvme0n1p1).
dev="/dev/$(readlink ${p})"
else
dev="${p##/dev}"
fi
dev=$(sanitize_devnode "${p}")
if [ "${dev##${TARGET_DISK}}" != "${dev}" ]; then
pvs_on_target="${pvs_of_vg} ${dev}"
else
Expand Down

0 comments on commit fb009ec

Please sign in to comment.