Handle GPU host events

VMs that have attached GPUs cannot be live migrated. You must set these VMs to stop for host events. If needed, you can set your stopped VMs to automatically restart after the maintenance event completes. Host maintenance events, on Compute Engine, have a frequency of once every two weeks but might occasionally run more frequently.

To minimize disruptions to your workloads during a maintenance event, you can monitor the maintenance schedule for your virtual machine (VM) instance, and prepare your workloads to transition through the system restart.

To receive advanced notice of host events, monitor the /computeMetadata/v1/instance/maintenance-event metadata value. If the request to the metadata server returns NONE, then the VM isn't scheduled to stop. For example, run the following command from within a VM:

curl http://metadata.google.internal/computeMetadata/v1/instance/maintenance-event -H "Metadata-Flavor: Google"


If the metadata server returns TERMINATE_ON_HOST_MAINTENANCE, then your VM is scheduled for stopping. Compute Engine gives GPU VMs a 1-hour stopping notice, while normal VMs receive only a 60-second notice. Configure your application to transition through the maintenance event. For example, you might use one of the following techniques:

  • Configure your application to temporarily move work in progress to a Cloud Storage bucket, then retrieve that data after the VM restarts.

  • Write data to a secondary persistent disk. When the VM automatically restarts, the persistent disk can be reattached and your application can resume work.

What's next?