aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/gce
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/gce')
-rw-r--r--pkg/gce/gce.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/pkg/gce/gce.go b/pkg/gce/gce.go
index 0ba0c50c0..59731a858 100644
--- a/pkg/gce/gce.go
+++ b/pkg/gce/gce.go
@@ -138,6 +138,11 @@ func (ctx *Context) CreateInstance(name, machineType, image, sshkey string, pree
}
retry:
+ if !instance.Scheduling.Preemptible && strings.HasPrefix(machineType, "e2-") {
+ // Otherwise we get "Error 400: Efficient instances do not support
+ // onHostMaintenance=TERMINATE unless they are preemptible".
+ instance.Scheduling.OnHostMaintenance = "MIGRATE"
+ }
var op *compute.Operation
err := ctx.apiCall(func() (err error) {
op, err = ctx.computeService.Instances.Insert(ctx.ProjectID, ctx.ZoneID, instance).Do()