You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// We default to allowing migration, as it gives higher uptime.
276
+
// However, if we figure out that the instance does not support migration, we will set this to TERMINATE (so we can create the instance at all).
272
277
scheduling=&compute.Scheduling{
273
-
AutomaticRestart: fi.PtrTo(true),
274
-
// TODO: Migrate or terminate?
278
+
AutomaticRestart: fi.PtrTo(true),
275
279
OnHostMaintenance: "MIGRATE",
276
280
ProvisioningModel: "STANDARD",
277
281
Preemptible: false,
278
282
}
279
283
}
280
284
281
-
iflen(e.GuestAccelerators) >0 {
285
+
iflen(guestAccelerators) >0 {
282
286
// Instances with accelerators cannot be migrated.
283
287
scheduling.OnHostMaintenance="TERMINATE"
284
288
}
285
289
290
+
ifmachineTypeInfo!=nil {
291
+
if!machineTypeInfo.SupportsMigration {
292
+
scheduling.OnHostMaintenance="TERMINATE"
293
+
}
294
+
}
295
+
returnscheduling
296
+
}
297
+
298
+
// guessMachineTypeInfo returns information about the machine type, such as whether it supports live migration.
299
+
// We use this to determine the correct scheduling options for non-preemptible VMs.
300
+
// If the machine type is not found, we return placeholder information, as we want to be tolerant of missing machine types, and just default to the safest scheduling options.
0 commit comments