buildlet: remove support for preemptible VMs we haven't used in a long time
Change-Id: I867c4b491327962410768291f8656665c2399e7b
Reviewed-on: https://go-review.googlesource.com/111641
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/buildlet/gce.go b/buildlet/gce.go
index 051a780..0d8edf0 100644
--- a/buildlet/gce.go
+++ b/buildlet/gce.go
@@ -74,12 +74,6 @@
// after StartNewVM tries to hit the buildlet's URL to see if it's up.
// The hook parameters are the return values from http.Get.
OnEndBuildletProbe func(*http.Response, error)
-
- // FallbackToFullPrice optionally specifies a hook to return a new
- // GCE instance name if the first one failed to launch
- // as preemptible. (If you use the same name, GCE complains about
- // resources already existing, even if it failed to be created)
- FallbackToFullPrice func() (newInstname string)
}
// StartNewVM boots a new VM on GCE and returns a buildlet client
@@ -106,8 +100,6 @@
return nil, errors.New("buildlet: missing required ProjectID option")
}
- usePreempt := false
-Try:
prefix := "https://www.googleapis.com/compute/v1/projects/" + projectID
machType := prefix + "/zones/" + zone + "/machineTypes/" + hconf.MachineType()
diskType := "https://www.googleapis.com/compute/v1/projects/" + projectID + "/zones/" + zone + "/diskTypes/pd-ssd"
@@ -158,9 +150,15 @@
Network: prefix + "/global/networks/default",
},
},
- Scheduling: &compute.Scheduling{
- Preemptible: usePreempt,
- },
+
+ // Prior to git rev 1b1e086fd, we used preemptible
+ // instances, as we were helping test the feature. It was
+ // removed after git rev a23395d because we hadn't been
+ // using it for some time. Our VMs are so short-lived that
+ // the feature doesn't really help anyway. But if we ever
+ // find we want it again, this comment is here to point to
+ // code that might be useful to partially resurrect.
+ Scheduling: &compute.Scheduling{Preemptible: false},
}
addMeta := func(key, value string) {
instance.Metadata.Items = append(instance.Metadata.Items, &compute.MetadataItems{
@@ -218,13 +216,6 @@
if op.Error != nil {
for _, operr := range op.Error.Errors {
log.Printf("failed to create instance %s in zone %s: %v", instName, zone, operr.Code)
- if operr.Code == "ZONE_RESOURCE_POOL_EXHAUSTED" && usePreempt && opts.FallbackToFullPrice != nil {
- oldName := instName
- usePreempt = false
- instName = opts.FallbackToFullPrice()
- log.Printf("buildlet/gce: retrying without preempt with name %q (previously: %q)", instName, oldName)
- goto Try
- }
// TODO: catch Code=="QUOTA_EXCEEDED" and "Message" and return
// a known error value/type.
return nil, fmt.Errorf("Error creating instance: %+v", operr)
diff --git a/cmd/coordinator/gce.go b/cmd/coordinator/gce.go
index e03b6b8..c31767c 100644
--- a/cmd/coordinator/gce.go
+++ b/cmd/coordinator/gce.go
@@ -318,15 +318,6 @@
OnInstanceRequested: func() {
log.Printf("GCE VM %q now booting", instName)
},
- FallbackToFullPrice: func() string {
- lg.LogEventTime("gce_fallback_to_full_price", "for "+instName)
- p.setInstanceUsed(instName, false)
- newName := instName + "-f"
- log.Printf("Gave up on preemptible %q; now booting %q", instName, newName)
- instName = newName
- p.setInstanceUsed(instName, true)
- return newName
- },
OnInstanceCreated: func() {
needDelete = true