Adding support for VMs with ephemeral disk

In this case the managed disks start at /dev/sdb
This commit is contained in:
Paul Edwards 2022-10-21 14:14:25 +01:00
Родитель 69cddeee94
Коммит 8ec30e88a7
2 изменённых файлов: 58 добавлений и 15 удалений

Просмотреть файл

@ -12,4 +12,8 @@
storageSas \
storageContainer \
ossDiskSetup \
deployPolicyEngine
deployPolicyEngine \
mdtStorageSku \
mdtNumDisks \
ostStorageSku \
ostNumDisks

Просмотреть файл

@ -13,6 +13,19 @@ storage_sas="$4"
storage_container="$5"
oss_disk_setup="$6"
deploy_policy_engine="$7"
mdt_storage_sku="$8"
num_mdts="$9"
ost_storage_sku="${10}"
num_osts="${11}"
if [ "$HOSTNAME" = "$mds" ]; then
storage_sku="$mdt_storage_sku"
num_disks="$num_mdts"
else
storage_sku="$ost_storage_sku"
num_disks="$num_osts"
fi
echo mds="$1"
echo n_oss="$2"
@ -20,6 +33,14 @@ echo storage_account="$3"
echo storage_sas="${4/sig=*/sig=REDACTED}"
echo storage_container="$5"
echo oss_disk_setup="$6"
echo deploy_policy_engine="$7"
echo mdt_storage_sku="$8"
echo num_msts="$9"
echo ost_storage_sku="${10}"
echo num_osts="${11}"
echo storage_sku="$storage_sku"
echo num_disks="$num_disks"
rbh="${mds}rbh"
@ -48,21 +69,39 @@ if [ "$HOSTNAME" = "$rbh" ]; then
else
# vars used in script
if [ -e /dev/nvme0n1 ]; then
devices='/dev/nvme*n1'
n_devices=$(echo $devices | wc -w)
echo "Using $n_devices NVME devices"
elif [ -e /dev/sdc ]; then
devices='/dev/sd[c-m]'
n_devices=$(echo $devices | wc -w)
echo "Using $n_devices NVME devices"
elif [ -e /dev/sdb ]; then
devices='/dev/sdb'
n_devices=1
echo "Using ephemeral disk on /dev/sdb"
if [ "$storage_sku" = "Ephemeral" ]; then
if [ -e /dev/nvme0n1 ]; then
devices='/dev/nvme*n1'
n_devices=$(echo $devices | wc -w)
echo "Using $n_devices NVME devices"
elif [ -e /dev/sdb ]; then
devices='/dev/sdb'
n_devices=1
echo "Using ephemeral disk on /dev/sdb"
else
echo "ERROR: cannot find devices for storage"
exit 1
fi
else
echo "ERROR: cannot find devices for storage"
exit 1
if [ -e /dev/nvme0n1 ]; then
devices='/dev/nvme*n1'
n_devices=$(echo $devices | wc -w)
echo "Using $n_devices NVME devices"
elif [ -e /dev/sdb ]; then
devices='/dev/sd[b-m]'
n_devices=$(echo $devices | wc -w)
if [ "$n_devices" -gt "$num_disks" ]; then
echo "VM has ephemeral disk, ignoring /dev/sdb"
devices='/dev/sd[c-m]'
n_devices=$(echo $devices | wc -w)
fi
echo "Using $n_devices managed disks"
else
echo "ERROR: cannot find devices for storage"
exit 1
fi
fi
if [[ "$n_devices" -gt "1" && ( "$oss_disk_setup" = "raid" || "$HOSTNAME" = "$mds" ) ]]; then