-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlaunch.sh
executable file
·127 lines (115 loc) · 4.24 KB
/
launch.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#!/bin/bash
#
# Launch VMs in Azure
#
print_usage() {
echo "Usage: $0 -b <benchmark> -s <system> -n <numVMs>"
echo " -b: Benchmark name, one of {fio, filebench, postgres, hdfs, nimble_hdfs}"
echo " -s: System name, one of {UNREPLICATED, DM, REPLICATED, ROLLBACCINE}"
echo " -n: Number of VMs to launch"
}
while getopts 'b:s:n:' flag; do
case ${flag} in
b) BENCHMARK=${OPTARG} ;;
s) SYSTEM=${OPTARG} ;;
n) NUM_VMS=${OPTARG} ;;
*) print_usage
exit 1;;
esac
done
NAME=$BENCHMARK-$SYSTEM
# Replace the subscription ID with your own; you can find it by going to the Azure Portal and clicking "Subscriptions"
SUBSCRIPTION_ID=ab9141a2-bb86-4f08-bd87-49b164a2ac4b
# The location is in North Europe, zone 3, because David's initial testing in [tee-benchmark](https://github.com/davidchuyaya/tee-benchmark) in 2023 revealed that it had the lowest network latency between nodes.
LOCATION=northeurope
# LOCATION=westus2
ZONE=3
# We must specify the sizes of the VMs that we intend to launch under `intent-vm-sizes`. We use the [DCadsv5](https://learn.microsoft.com/en-us/azure/virtual-machines/dcasv5-dcadsv5-series) series, which are general purpose, AMD SEV-SNP machines with temp disk.
VM_SIZE=Standard_DC16as_v5
VM_SIZE_TEMP_DISK=Standard_DC16ads_v5
# VM_SIZE=Standard_D16as_v5
# VM_SIZE_TEMP_DISK=Standard_D16ads_v5
# Set managed disk size (GB) to same size as temp disk
MANAGED_DISK_SIZE=600
USERNAME=$(whoami)
STORAGE_FILE=$BENCHMARK-$SYSTEM-storage.json
VM1_FILE=$BENCHMARK-$SYSTEM-vm1.json
VM2_FILE=$BENCHMARK-$SYSTEM-vm2.json
echo "Creating resource group: "$NAME"-group"
az group create \
--subscription $SUBSCRIPTION_ID \
--name $NAME-group \
--location $LOCATION
echo "Creating PPG: $NAME-ppg"
az ppg create \
--resource-group $NAME-group \
--name $NAME-ppg \
--location $LOCATION \
--zone $ZONE \
--intent-vm-sizes $VM_SIZE $VM_SIZE_TEMP_DISK
if [ $BENCHMARK = "nimble_hdfs" ]; then
echo "Creating storage account: rollbaccinenimble"
az storage account create -n rollbaccinenimble -g $NAME-group -l $LOCATION --sku Standard_LRS
az storage account keys list -n rollbaccinenimble -g $NAME-group > $STORAGE_FILE
fi
# Parameters: $1 = count, $2 = vm_size, $3 = output name, $4 = additional params
launch_vm () {
if [ $1 -gt 1 ]; then
COUNT='--count '$1
else # Reset COUNT in case some other invocation set it
COUNT=''
fi
echo "Launching $1 $2 VMs"
# az vm create \
# --resource-group $NAME-group \
# --name $NAME \
# --admin-username $USERNAME \
# --generate-ssh-keys \
# --public-ip-sku Standard \
# --nic-delete-option Delete \
# --os-disk-delete-option Delete \
# --data-disk-delete-option Delete \
# --accelerated-networking false \
# --ppg $NAME-ppg \
# --location $LOCATION \
# --zone $ZONE \
# --size $2 \
# --enable-secure-boot false \
# --image Canonical:ubuntu-24_04-lts:server:latest $COUNT $4 > $3
az vm create \
--resource-group $NAME-group \
--name $NAME-$(uuidgen) \
--admin-username $USERNAME \
--generate-ssh-keys \
--public-ip-sku Standard \
--nic-delete-option Delete \
--os-disk-delete-option Delete \
--data-disk-delete-option Delete \
--accelerated-networking false \
--ppg $NAME-ppg \
--location $LOCATION \
--zone $ZONE \
--size $2 \
--image Canonical:ubuntu-24_04-lts:cvm:latest \
--security-type ConfidentialVM \
--os-disk-security-encryption-type VMGuestStateOnly \
--enable-secure-boot false \
--enable-vtpm $COUNT $4 > $3
}
# Launch the right number of VMs with temp/managed disk
if [ $SYSTEM = "ROLLBACCINE" ]; then
launch_vm 2 $VM_SIZE_TEMP_DISK $VM1_FILE
REMAINING_VMS=$(($NUM_VMS - 2))
elif [ $SYSTEM = "REPLICATED" ]; then
launch_vm 1 $VM_SIZE $VM1_FILE "--data-disk-sizes-gb $MANAGED_DISK_SIZE --data-disk-caching None"
REMAINING_VMS=$(($NUM_VMS - 1))
else
launch_vm 1 $VM_SIZE_TEMP_DISK $VM1_FILE
REMAINING_VMS=$(($NUM_VMS - 1))
fi
# Launch remaining VMs without any disk
if [ $REMAINING_VMS -gt 0 ]; then
launch_vm $REMAINING_VMS $VM_SIZE $VM2_FILE
fi
echo "Sleeping for 10 seconds to make sure the VMs are ready by the time this script finishes"
sleep 10