Commit 5ce31101 authored by Maarten de Waard's avatar Maarten de Waard 🤘🏻
Browse files

Merge branch '14-allow-more-than-26-disks-per-instance' into 'master'

Resolve "Allow more than 26 disks per instance"

Closes #14

See merge request !8
parents 38d3f46e 2fa8a267
Pipeline #10828 passed with stages
in 1 minute and 17 seconds
......@@ -176,10 +176,27 @@ domount() {
exitWithFailure "$errorMessage"
fi
# Convert numeric disk slot index to device letter, so
# 0 becomes a, 1 becomes b, etc.
diskLetter=$(printf \\$(printf '%03o' $((97 + $diskSlot))))
device="/dev/xvd${diskLetter}1"
# Convert a numerical disk index (zero-based) to an actual device path like
# /dev/xvda1 (index 0), /dev/xvdz1 (25) or /dev/xvdbc1 (2 * 26 + 2 = 54).
# We use at most two letters in the variable part, so we can have 26
# single-letter ones and 26^2 double-letter ones, 702 in total. As the disk
# index is zero-based, 701 is the highest allowed index.
if [[ $diskSlot -gt 701 ]]
then
errorMessage="disk_slot is larger than 701, and thus not supported."
exitWithFailure "$errorMessage"
fi
if [[ $diskSlot -le 25 ]]
then
letter=$(printf \\$(printf '%03o' $((97 + $diskSlot))))
device="/dev/xvd${letter}1"
else
# Minus 1, because the quotient $diskIndex / 26 is one-based,
# not zero-based.
firstLetter=$(printf \\$(printf '%03o' $((97 + $diskSlot / 26 - 1))))
secondLetter=$(printf \\$(printf '%03o' $((97 + $diskSlot % 26))))
device="/dev/xvd${firstLetter}${secondLetter}1"
fi
debug "device: $device"
# Wait for the device file to appear. It might take the VPS kernel some
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment