Skip to content

Commit

Permalink
Update test VM creation with variable disk size
Browse files Browse the repository at this point in the history
This will ensure the image can start with variable-sized disks.
  • Loading branch information
alexmwu committed Feb 15, 2024
1 parent 10795bb commit c30235d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions launcher/image/test/create_vm.sh
Expand Up @@ -34,9 +34,16 @@ create_vm() {
# check the active account
gcloud auth list

# Max disk for n2d-standard-2 (8GB memory) at 1% memory overhead.
MIN_DISK_SIZE=11
MAX_DISK_SIZE_GB=80
ADDTL_DISK_RANGE=$(($MAX_DISK_SIZE_GB - $MIN_DISK_SIZE + 1))
DISK_SIZE_GB=$(($MIN_DISK_SIZE + ($RANDOM % $ADDTL_DISK_RANGE)))

gcloud compute instances create $VM_NAME --confidential-compute --maintenance-policy=TERMINATE \
--scopes=cloud-platform --zone $ZONE --image=$IMAGE_NAME --image-project=$PROJECT_NAME \
--shielded-secure-boot $APPEND_METADATA $APPEND_METADATA_FILE
--machine-type=n2d-standard-2 --boot-disk-size=$DISK_SIZE_GB --scopes=cloud-platform --zone $ZONE \
--image=$IMAGE_NAME --image-project=$PROJECT_NAME --shielded-secure-boot $APPEND_METADATA \
$APPEND_METADATA_FILE
}

IMAGE_NAME=''
Expand Down

0 comments on commit c30235d

Please sign in to comment.