Index: compute_engine_scripts/perf/vm_create_instance.sh |
diff --git a/compute_engine_scripts/perf/vm_create_instance.sh b/compute_engine_scripts/perf/vm_create_instance.sh |
index 4e1a7ccc1fd9e9da4912355acd82ef04a7ce6073..9d1d0da145fd312d7a0a776632b5d6a2683ceb04 100755 |
--- a/compute_engine_scripts/perf/vm_create_instance.sh |
+++ b/compute_engine_scripts/perf/vm_create_instance.sh |
@@ -1,33 +1,54 @@ |
#!/bin/bash |
# |
-# Creates the compute instance for skia-perf. |
tfarina
2015/11/26 21:01:17
why remove the end period from the sentence?
|
+# Creates the compute instance for skia-perf |
# |
set -x |
source vm_config.sh |
+MACHINE_TYPE=n1-highmem-8 |
+SOURCE_SNAPSHOT=skia-systemd-pushable-base |
+SCOPES='https://www.googleapis.com/auth/devstorage.full_control' |
+IP_ADDRESS=104.154.112.108 |
+ |
# Create a boot disk from the pushable base snapshot. |
gcloud compute --project $PROJECT_ID disks create $INSTANCE_NAME \ |
--zone $ZONE \ |
- --source-snapshot $PERF_SOURCE_SNAPSHOT \ |
+ --source-snapshot $SOURCE_SNAPSHOT \ |
--type "pd-standard" |
# Create a large data disk. |
gcloud compute --project $PROJECT_ID disks create $INSTANCE_NAME"-data" \ |
- --size "1000" \ |
+ --size "20" \ |
--zone $ZONE \ |
--type "pd-standard" |
-# Create the instance with the two disks attahed. |
+# Create the instance with the two disks attached. |
gcloud compute --project $PROJECT_ID instances create $INSTANCE_NAME \ |
--zone $ZONE \ |
- --machine-type $PERF_MACHINE_TYPE \ |
+ --machine-type $MACHINE_TYPE \ |
--network "default" \ |
--maintenance-policy "MIGRATE" \ |
- --scopes $PERF_SCOPES \ |
+ --scopes $SCOPES \ |
--tags "http-server" "https-server" \ |
--metadata-from-file "startup-script=startup-script.sh" \ |
--disk name=${INSTANCE_NAME} device-name=${INSTANCE_NAME} "mode=rw" "boot=yes" "auto-delete=yes" \ |
--disk name=${INSTANCE_NAME}-data device-name=${INSTANCE_NAME}-data "mode=rw" "boot=no" \ |
- --address=$PERF_IP_ADDRESS |
+ --address=$IP_ADDRESS |
+ |
+WAIT_TIME_AFTER_CREATION_SECS=600 |
+echo |
+echo "===== Wait $WAIT_TIME_AFTER_CREATION_SECS secs for instance to" \ |
+ "complete startup script. =====" |
+echo |
+sleep $WAIT_TIME_AFTER_CREATION_SECS |
+# The instance believes it is skia-systemd-snapshot-maker until it is rebooted. |
+echo |
+echo "===== Rebooting the instance ======" |
+# Using "shutdown -r +1" rather than "reboot" so that the connection isn't |
+# terminated immediately, which causes a non-zero exit code. |
+gcloud compute --project $PROJECT_ID ssh $PROJECT_USER@$INSTANCE_NAME \ |
+ --zone $ZONE \ |
+ --command "sudo shutdown -r +1" \ |
+ || echo "Reboot failed; please reboot the instance manually." |