aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/gce/gce.go
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2025-08-08 11:30:11 +0200
committerAleksandr Nogikh <nogikh@google.com>2025-08-08 11:16:27 +0000
commit009315f7208df39036fe2bac7c9b2ec910e6a5c6 (patch)
tree57bb2a8e0ff31182d5334b13e5198b19ece43dda /pkg/gce/gce.go
parent265b79936233a0431f3f1032aa207af7f4a6f3c8 (diff)
pkg/gce: set minimum disk size for C4A instances
It must be more than 10GB.
Diffstat (limited to 'pkg/gce/gce.go')
-rw-r--r--pkg/gce/gce.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/pkg/gce/gce.go b/pkg/gce/gce.go
index c89c474a7..20aee4c7c 100644
--- a/pkg/gce/gce.go
+++ b/pkg/gce/gce.go
@@ -131,6 +131,7 @@ func (ctx *Context) CreateInstance(name, machineType, image, sshkey string,
AutoDelete: true,
Boot: true,
Type: "PERSISTENT",
+ DiskSizeGb: int64(diskSizeGB(machineType)),
InitializeParams: &compute.AttachedDiskInitializeParams{
DiskName: name,
SourceImage: prefix + "/global/images/" + image,
@@ -210,6 +211,16 @@ retry:
return ip, nil
}
+func diskSizeGB(machineType string) int {
+ if strings.HasPrefix(machineType, "c4a-") {
+ // For C4A machines, the only available disk type is "Hyperdisk Balanced",
+ // which must be >= 10GB.
+ return 10
+ }
+ // Use the default value.
+ return 0
+}
+
func (ctx *Context) DeleteInstance(name string, wait bool) error {
var op *compute.Operation
err := ctx.apiCall(func() (err error) {