Skip to content

Commit

Permalink
c-s-s: Support GROWPART=true on NVMe
Browse files Browse the repository at this point in the history
By using sysfs, splitting device/partition is a lot more reliable.
This fixes using GROWPART=true on NVMe with Fedora Atomic Host,
as occurs in AWS with modern instance types.

Closes: openshift/os#133

Closes: projectatomic#275
Approved by: dm0-
  • Loading branch information
cgwalters authored and rh-atomic-bot committed Jul 13, 2018
1 parent 5eaf76c commit 413b408
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions container-storage-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -727,8 +727,20 @@ grow_root_pvs() {
# partitions on all disks, so as long as they match, growing the LV should
# also work.
for pv in $_ROOT_PVS; do
# Split device & partition. Ick.
growpart $( echo $pv | sed -r 's/([^0-9]*)([0-9]+)/\1 \2/' ) || true
if ! test -b $pv; then
Error "Not a block device: $pv"
fi
local major_hex minor_hex major_minor
local devpath partition parent_path parent_device
major_hex=$(stat -c '%t' $pv)
minor_hex=$(stat -c '%T' $pv)
major_minor=$((0x${major_hex})):$((0x${minor_hex}))
devpath=$(realpath /sys/dev/block/$major_minor)
partition=$(cat $devpath/partition)
parent_path=$(dirname $devpath)
parent_device=/dev/$(basename ${parent_path})
# TODO: Remove the || true here
growpart ${parent_device} ${partition} || true
pvresize $pv
done
}
Expand Down

0 comments on commit 413b408

Please sign in to comment.