diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2019-12-18 09:08:37 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2019-12-18 09:11:16 +0100 |
| commit | 8ab1308e06b817c567df018bbee4c162dd3774d8 (patch) | |
| tree | 6ff51e055346a3930eb9f785772c011549f33d17 /pkg/gce | |
| parent | f2fe0772a950d90c97c9f756cd6c07325344ac9a (diff) | |
pkg/gce: fix creation of non-preemptible E2 instances
Diffstat (limited to 'pkg/gce')
| -rw-r--r-- | pkg/gce/gce.go | 5 |
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() |
