Add option to pass boot disk type to gce create (#1308)

This commit is contained in:
sakridge 2018-09-22 16:43:47 -07:00 committed by GitHub
parent a51c2f193e
commit 3199f174a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 4 deletions

View File

@ -5,6 +5,7 @@ here=$(dirname "$0")
source "$here"/common.sh
cloudProvider=$(basename "$0" .sh)
bootDiskType=""
case $cloudProvider in
gce)
# shellcheck source=net/scripts/gce-provider.sh
@ -75,6 +76,7 @@ Manage testnet instances
IP Address.
For EC2, [address] is the "allocation ID" of the desired
Elastic IP.
-d [disk-type] - Specify a boot disk type (default None) Use pd-ssd to get ssd on GCE.
config-specific options:
none
@ -92,7 +94,7 @@ command=$1
shift
[[ $command = create || $command = config || $command = delete ]] || usage "Invalid command: $command"
while getopts "h?p:Pn:c:z:ga:" opt; do
while getopts "h?p:Pn:c:z:ga:d:" opt; do
case $opt in
h | \?)
usage
@ -120,6 +122,9 @@ while getopts "h?p:Pn:c:z:ga:" opt; do
a)
leaderAddress=$OPTARG
;;
d)
bootDiskType=$OPTARG
;;
*)
usage "Error: unhandled option: $opt"
;;
@ -378,16 +383,16 @@ EOF
cloud_CreateInstances "$prefix" "$prefix-leader" 1 \
"$imageName" "$leaderMachineType" "$leaderBootDiskSizeInGb" \
"$startupScript" "$leaderAddress"
"$startupScript" "$leaderAddress" "$bootDiskType"
cloud_CreateInstances "$prefix" "$prefix-validator" "$validatorNodeCount" \
"$imageName" "$validatorMachineType" "$validatorBootDiskSizeInGb" \
"$startupScript" ""
"$startupScript" "" "$bootDiskType"
if [[ $clientNodeCount -gt 0 ]]; then
cloud_CreateInstances "$prefix" "$prefix-client" "$clientNodeCount" \
"$imageName" "$clientMachineType" "$clientBootDiskSizeInGb" \
"$startupScript" ""
"$startupScript" "" "$bootDiskType"
fi
$metricsWriteDatapoint "testnet-deploy net-create-complete=1"

View File

@ -113,6 +113,7 @@ cloud_CreateInstances() {
declare optionalBootDiskSize="$6"
declare optionalStartupScript="$7"
declare optionalAddress="$8"
declare optionalBootDiskType="$9"
declare nodes
if [[ $numNodes = 1 ]]; then
@ -143,6 +144,11 @@ cloud_CreateInstances() {
--metadata-from-file "startup-script=$optionalStartupScript"
)
fi
if [[ -n $optionalBootDiskType ]]; then
args+=(
--boot-disk-type "${optionalBootDiskType}"
)
fi
if [[ -n $optionalAddress ]]; then
[[ $numNodes = 1 ]] || {