Configure boot disk size
This commit is contained in:
parent
a3178c3bc7
commit
9ca6a2d25b
19
net/gce.sh
19
net/gce.sh
|
@ -9,11 +9,14 @@ source "$here"/common.sh
|
||||||
prefix=testnet-dev-${USER//[^A-Za-z0-9]/}
|
prefix=testnet-dev-${USER//[^A-Za-z0-9]/}
|
||||||
validatorNodeCount=5
|
validatorNodeCount=5
|
||||||
clientNodeCount=1
|
clientNodeCount=1
|
||||||
|
leaderBootDiskSize=1TB
|
||||||
leaderMachineType=n1-standard-16
|
leaderMachineType=n1-standard-16
|
||||||
leaderAccelerator=
|
leaderAccelerator=
|
||||||
validatorMachineType=n1-standard-4
|
validatorMachineType=n1-standard-4
|
||||||
|
validatorBootDiskSize=$leaderBootDiskSize
|
||||||
validatorAccelerator=
|
validatorAccelerator=
|
||||||
clientMachineType=n1-standard-16
|
clientMachineType=n1-standard-16
|
||||||
|
clientBootDiskSize=40GB
|
||||||
clientAccelerator=
|
clientAccelerator=
|
||||||
|
|
||||||
imageName="ubuntu-16-04-cuda-9-2-new"
|
imageName="ubuntu-16-04-cuda-9-2-new"
|
||||||
|
@ -107,6 +110,7 @@ done
|
||||||
|
|
||||||
|
|
||||||
prepareInstancesAndWriteConfigFile() {
|
prepareInstancesAndWriteConfigFile() {
|
||||||
|
$metricsWriteDatapoint "testnet-deploy net-config-start=1"
|
||||||
|
|
||||||
cat >> "$configFile" <<EOF
|
cat >> "$configFile" <<EOF
|
||||||
# autogenerated at $(date)
|
# autogenerated at $(date)
|
||||||
|
@ -174,10 +178,13 @@ EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "Wrote $configFile"
|
echo "Wrote $configFile"
|
||||||
|
$metricsWriteDatapoint "testnet-deploy net-config-complete=1"
|
||||||
}
|
}
|
||||||
|
|
||||||
case $command in
|
case $command in
|
||||||
delete)
|
delete)
|
||||||
|
$metricsWriteDatapoint "testnet-deploy net-delete-start=1"
|
||||||
|
|
||||||
gcloud_FindInstances "name~^$prefix-"
|
gcloud_FindInstances "name~^$prefix-"
|
||||||
|
|
||||||
if [[ ${#instances[@]} -eq 0 ]]; then
|
if [[ ${#instances[@]} -eq 0 ]]; then
|
||||||
|
@ -186,11 +193,15 @@ delete)
|
||||||
fi
|
fi
|
||||||
gcloud_DeleteInstances "$yes"
|
gcloud_DeleteInstances "$yes"
|
||||||
rm -f "$configFile"
|
rm -f "$configFile"
|
||||||
|
|
||||||
|
$metricsWriteDatapoint "testnet-deploy net-delete-complete=1"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
create)
|
create)
|
||||||
[[ -n $validatorNodeCount ]] || usage "Need number of nodes"
|
[[ -n $validatorNodeCount ]] || usage "Need number of nodes"
|
||||||
|
|
||||||
|
$metricsWriteDatapoint "testnet-deploy net-create=1"
|
||||||
|
|
||||||
echo "Network composition:"
|
echo "Network composition:"
|
||||||
echo "Leader = $leaderMachineType (GPU=${leaderAccelerator:-none})"
|
echo "Leader = $leaderMachineType (GPU=${leaderAccelerator:-none})"
|
||||||
echo "Validators = $validatorNodeCount x $validatorMachineType (GPU=${validatorAccelerator:-none})"
|
echo "Validators = $validatorNodeCount x $validatorMachineType (GPU=${validatorAccelerator:-none})"
|
||||||
|
@ -198,18 +209,20 @@ create)
|
||||||
echo ==================================================================
|
echo ==================================================================
|
||||||
echo
|
echo
|
||||||
gcloud_CreateInstances "$prefix-leader" 1 "$zone" \
|
gcloud_CreateInstances "$prefix-leader" 1 "$zone" \
|
||||||
"$imageName" "$leaderMachineType" "$leaderAccelerator" \
|
"$imageName" "$leaderMachineType" "$leaderBootDiskSize" "$leaderAccelerator" \
|
||||||
"$here/remote/remote-startup.sh" "$leaderAddress" \
|
"$here/remote/remote-startup.sh" "$leaderAddress" \
|
||||||
|
|
||||||
gcloud_CreateInstances "$prefix-validator" "$validatorNodeCount" "$zone" \
|
gcloud_CreateInstances "$prefix-validator" "$validatorNodeCount" "$zone" \
|
||||||
"$imageName" "$validatorMachineType" "$validatorAccelerator" \
|
"$imageName" "$validatorMachineType" "$validatorBootDiskSize" "$validatorAccelerator" \
|
||||||
"$here/remote/remote-startup.sh" ""
|
"$here/remote/remote-startup.sh" ""
|
||||||
if [[ -n $clientNodeCount ]]; then
|
if [[ -n $clientNodeCount ]]; then
|
||||||
gcloud_CreateInstances "$prefix-client" "$clientNodeCount" "$zone" \
|
gcloud_CreateInstances "$prefix-client" "$clientNodeCount" "$zone" \
|
||||||
"$imageName" "$clientMachineType" "$clientAccelerator" \
|
"$imageName" "$clientMachineType" "$clientBootDiskSize" "$clientAccelerator" \
|
||||||
"$here/remote/remote-startup.sh" ""
|
"$here/remote/remote-startup.sh" ""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
$metricsWriteDatapoint "testnet-deploy net-create-complete=1"
|
||||||
|
|
||||||
prepareInstancesAndWriteConfigFile
|
prepareInstancesAndWriteConfigFile
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,8 @@ gcloud_ForEachInstance() {
|
||||||
|
|
||||||
#
|
#
|
||||||
# gcloud_CreateInstances [namePrefix] [numNodes] [zone] [imageName]
|
# gcloud_CreateInstances [namePrefix] [numNodes] [zone] [imageName]
|
||||||
# [machineType] [accelerator] [startupScript] [address]
|
# [machineType] [bootDiskSize] [accelerator]
|
||||||
|
# [startupScript] [address]
|
||||||
#
|
#
|
||||||
# Creates one more identical instances.
|
# Creates one more identical instances.
|
||||||
#
|
#
|
||||||
|
@ -85,6 +86,7 @@ gcloud_ForEachInstance() {
|
||||||
# zone - zone to create the instances in
|
# zone - zone to create the instances in
|
||||||
# imageName - Disk image for the instances
|
# imageName - Disk image for the instances
|
||||||
# machineType - GCE machine type
|
# machineType - GCE machine type
|
||||||
|
# bootDiskSize - Optional disk of the boot disk
|
||||||
# accelerator - Optional accelerator to attach to the instance(s), see
|
# accelerator - Optional accelerator to attach to the instance(s), see
|
||||||
# eg, request 4 K80 GPUs with "count=4,type=nvidia-tesla-k80"
|
# eg, request 4 K80 GPUs with "count=4,type=nvidia-tesla-k80"
|
||||||
# startupScript - Optional startup script to execute when the instance boots
|
# startupScript - Optional startup script to execute when the instance boots
|
||||||
|
@ -100,9 +102,10 @@ gcloud_CreateInstances() {
|
||||||
declare zone="$3"
|
declare zone="$3"
|
||||||
declare imageName="$4"
|
declare imageName="$4"
|
||||||
declare machineType="$5"
|
declare machineType="$5"
|
||||||
declare optionalAccelerator="$6"
|
declare optionalBootDiskSize="$6"
|
||||||
declare optionalStartupScript="$7"
|
declare optionalAccelerator="$7"
|
||||||
declare optionalAddress="$8"
|
declare optionalStartupScript="$8"
|
||||||
|
declare optionalAddress="$9"
|
||||||
|
|
||||||
declare nodes
|
declare nodes
|
||||||
if [[ $numNodes = 1 ]]; then
|
if [[ $numNodes = 1 ]]; then
|
||||||
|
@ -118,6 +121,11 @@ gcloud_CreateInstances() {
|
||||||
"--image=$imageName"
|
"--image=$imageName"
|
||||||
"--machine-type=$machineType"
|
"--machine-type=$machineType"
|
||||||
)
|
)
|
||||||
|
if [[ -n $optionalBootDiskSize ]]; then
|
||||||
|
args+=(
|
||||||
|
"--boot-disk-size=$optionalBootDiskSize"
|
||||||
|
)
|
||||||
|
fi
|
||||||
if [[ -n $optionalAccelerator ]]; then
|
if [[ -n $optionalAccelerator ]]; then
|
||||||
args+=(
|
args+=(
|
||||||
"--accelerator=$optionalAccelerator"
|
"--accelerator=$optionalAccelerator"
|
||||||
|
@ -125,7 +133,6 @@ gcloud_CreateInstances() {
|
||||||
--restart-on-failure
|
--restart-on-failure
|
||||||
)
|
)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n $optionalStartupScript ]]; then
|
if [[ -n $optionalStartupScript ]]; then
|
||||||
args+=(
|
args+=(
|
||||||
--metadata-from-file "startup-script=$optionalStartupScript"
|
--metadata-from-file "startup-script=$optionalStartupScript"
|
||||||
|
|
Loading…
Reference in New Issue