Scheduling

Sets the scheduling options for an Instance.

JSON representation
{
  "onHostMaintenance": enum (OnHostMaintenance),
  "automaticRestart": boolean,
  "preemptible": boolean,
  "nodeAffinities": [
    {
      object (NodeAffinity)
    }
  ],
  "minNodeCpus": integer,
  "locationHint": string,
  "availabilityDomain": integer,
  "provisioningModel": enum (ProvisioningModel),
  "instanceTerminationAction": enum (InstanceTerminationAction),
  "localSsdRecoveryTimeout": {
    object (Duration)
  },

  // Union field run_duration can be only one of the following:
  "maxRunDuration": {
    object (Duration)
  },
  "terminationTime": string
  // End of list of possible types for union field run_duration.

  // Union field on_instance_termination_action can be only one of the following:
  "onInstanceStopAction": {
    object (OnInstanceStopAction)
  }
  // End of list of possible types for union field
  // on_instance_termination_action.
}
Fields
onHostMaintenance

enum (OnHostMaintenance)

Defines the maintenance behavior for this instance. For standard instances, the default behavior is

MIGRATE

. For preemptible instances, the default and only possible behavior is

TERMINATE

. For more information, see Set VM host maintenance policy.

automaticRestart

boolean

Specifies whether the instance should be automatically restarted if it is terminated by Compute Engine (not terminated by a user). You can only set the automatic restart option for standard instances. Preemptible instances cannot be automatically restarted.

By default, this is set to

true

so an instance is automatically restarted if it is terminated by Compute Engine.

preemptible

boolean

Defines whether the instance is preemptible. This can only be set during instance creation or while the instance is stopped and therefore, in a TERMINATED state. See Instance Life Cycle for more information on the possible instance states.

nodeAffinities[]

object (NodeAffinity)

A set of node affinity and anti-affinity configurations. Refer to Configuring node affinity for more information. Overrides reservationAffinity.

minNodeCpus

integer

The minimum number of virtual CPUs this instance will consume when running on a sole-tenant node.

locationHint

string

An opaque location hint used to place the instance close to other resources. This field is for use by internal tools that use the public API.

availabilityDomain

integer

Specifies the availability domain to place the instance in. The value must be a number between 1 and the number of availability domains specified in the spread placement policy attached to the instance.

provisioningModel

enum (ProvisioningModel)

Specifies the provisioning model of the instance.

instanceTerminationAction

enum (InstanceTerminationAction)

Specifies the termination action for the instance.

localSsdRecoveryTimeout

object (Duration)

Specifies the maximum amount of time a Local Ssd Vm should wait while recovery of the Local Ssd state is attempted. Its value should be in between 0 and 168 hours with hour granularity and the default value being 1 hour.

Union field run_duration.

run_duration can be only one of the following:

maxRunDuration

object (Duration)

Specifies the max run duration for the given instance. If specified, the instance termination action will be performed at the end of the run duration.

terminationTime

string

Specifies the timestamp, when the instance will be terminated, in RFC3339 text format. If specified, the instance termination action will be performed at the termination time.

Union field on_instance_termination_action. Defines the behaviour for instances with the instance_termination_actions. At the end of the run duration or termination time, the instance will be terminated according to the properties defined in the action. There can be only one termination action specified for an instance. on_instance_termination_action can be only one of the following:
onInstanceStopAction

object (OnInstanceStopAction)

OnInstanceStopAction

Defines the behaviour for instances with the instanceTerminationAction

STOP

.

JSON representation
{
  "discardLocalSsd": boolean
}
Fields
discardLocalSsd

boolean

If true, the contents of any attached Local SSD disks will be discarded else, the Local SSD data will be preserved when the instance is stopped at the end of the run duration/termination time.

OnHostMaintenance

Defines the maintenance behavior for this instance, either

TERMINATE

or

MIGRATE

. For standard instances, the default behavior is

MIGRATE

. For preemptible instances, the default, and only possible behavior, is

TERMINATE

. For more information, see Set VM host maintenance policy.

Enums
TERMINATE

Tells Compute Engine to terminate and (optionally) restart the instance away from the maintenance activity. If you would like your instance to be restarted, set the

automaticRestart

flag to true. Your instance may be restarted more than once, and it may be restarted outside the window of maintenance events.

MIGRATE [Default] Allows Compute Engine to automatically migrate instances out of the way of maintenance events.

NodeAffinity

Node Affinity: the configuration of desired nodes onto which this Instance could be scheduled.

JSON representation
{
  "key": string,
  "operator": enum (Operator),
  "values": [
    string
  ]
}
Fields
key

string

Corresponds to the label key of Node resource.

operator

enum (Operator)

Defines the operation of node selection. Valid operators are

IN

for affinity and

NOT_IN

for anti-affinity.

values[]

string

Corresponds to the label values of Node resource.

Operator

Defines the type of node selections.

Enums
OPERATOR_UNSPECIFIED
IN Requires Compute Engine to seek for matched nodes.
NOT_IN Requires Compute Engine to avoid certain nodes.

ProvisioningModel

Defines the provisioning model for an instance.

Enums
STANDARD Standard provisioning with user controlled runtime, no discounts.
SPOT Heavily discounted, no guaranteed runtime.

InstanceTerminationAction

Defines the supported termination actions for an instance.

Enums
INSTANCE_TERMINATION_ACTION_UNSPECIFIED Default value. This value is unused.
DELETE Delete the VM.
STOP Stop the VM without storing in-memory content. default action.