Adapting VMs to run on Google Cloud

To function properly on Google Cloud, migrated VMs may need changes to their configuration. Migrate for Compute Engine handles some configuration changes automatically, but you can also script custom configuration for Windows and Linux.

Custom configurations allow a VM, its operating system (OS), and your applications to run in Google Cloud. These custom configurations are known as adaptations. The following sections describe how to customize VM and OS adaptations.

Customizing VM adaptations

Migrate for Compute Engine handles many VM adaptations automatically, but you can write custom configurations for Linux or Windows. For example, you can install drivers to boot your VM.

Migrate for Compute Engine can execute scripts during migration to enable these adaptations. Scripts can be developed by customers or provided by Migrate for Compute Engine under a support package.

Scripts may run in three machine states (for Windows VMs) or phases (for Linux VMs):

MachineState (Windows VM) Phase (Linux VM) Description
Origin origin On-premises
Migrate for Compute Engine velos Run when the VM is running in cached mode
Detach detach Run after the detach operation

For More information about adaptations, see Linux Adaptations or Windows Adaptation .

Operating system adaptations

This section describes default adaptations performed by Migrate for Compute Engine, as well as modifications made to Windows and Linux VMs for the run-in-cloud and detach operations.

VM changes performed automatically

Migrate for Compute Engine prepares Linux VMs to boot in Google Cloud using an automatically installed package. These changes are active only when Migrate for Compute Engine detects that your VM is running on Google Cloud. The package can remain installed after the VM has been migrated. If the package is uninstalled, all changes are reverted and your VM may not boot.

The set of changes made to both Linux and Windows are:

  • Enable booting on Google Cloud.
  • Enable the serial console.
  • Cloud-specific changes for the Migrate for Compute Engine storage channel.
  • Hardware-specific adaptations for cloud migration.

Additional changes specific to Linux and Windows adaptations are described in the following sections.

Default Windows modifications

These sections describe the default modifications made by Migrate for Compute Engine to Windows VMs during a migration.

Modifications for run-in-cloud on Windows VMs

When you start a run-in-cloud operation on a Windows VM, Migrate for Compute Engine shuts down the VM and takes a snapshot. Migrate for Compute Engine then modifies the networking and storage drivers to allow the VM to boot in the cloud.

This might include:

  • Install the NETKVM driver for Migrate for Compute Engine.
  • Change network configuration.
  • System tuning for iSCSI and MPIO access.
  • Change license/edition to a cloud-compatible one.
  • Disable VMware tools.
  • Change page file location.
  • Ensure hibernation is disabled.
  • Change recovery options.
  • Enable RDP.
  • Deploy the Migrate for Compute Engine framework that allows you to run custom actions.
  • Install the Compute Engine OS patch management agent. To use OS patch management features, or to uninstall or disable the agent:

    Go to the OS Patch Management page

Modifications for detaching a Windows VM

During a detach of a Windows VM, Migrate for Compute Engine installs the Google Cloud cloud agent. The Google Cloud agent installation requires for either an external IP address or Private Google Access to be enabled. These are in addition to the changes made during run-in-cloud.

Default Linux modifications

These sections describe the default modifications made by Migrate for Compute Engine to Linux VMs during a migration.

Modifications for run-in-cloud on Linux VMs

When you migrate a VM that has VMware tools installed, Migrate for Compute Engine shuts down the VM gracefully and takes a snapshot of the VM. Migrate for Compute Engine then modifies the networking and storage drivers to allow the VM to boot on Google Cloud. These modifications include:

  • Changing to the boot sequence (initrd).
  • Enabling the serial console.
  • Dynamically applying the following modifications in the cloud:
    • Moving mount points with the _netdev option to shut down correctly.
    • Remapping swap files.
    • Starting the Migrate for Compute Engine keep-alive service.
    • Performing disk optimizations.
    • Install Compute Engine Linux Guest Environment packages.
    • Remove unmigrated disks from /etc/fstab.
    • Changing network configurations, including:
      • Enable sshd with key-based authentication.
      • Remove static IPs and routes: The Migrate for Compute Engine package removes all static configuration.
      • Reconfigure the default network interface (eth0) to use DHCP.
      • Update the primary IP address of hostname in /etc/hosts: Some applications rely on /etc/hosts to extract the local IP address. The package updates /etc/hosts with the new IP address to preserve compatibility.
      • Update NTP configuration to metadata.google.internal.
      • Reset MTU to 1460, if necessary.
      • Remove persistent MAC address configurations, for example: rm -f /etc/udev/rules.d/70-persistent-net.rules
  • Making changes specific to Google Cloud, as needed.

Changes made on every boot while streaming on Compute Engine

  • Remount volumes with _netdev enabled.
  • Move swap files to ephemeral volumes.
  • Start Migrate for Compute Engine keep-alive service.
  • Trim (unmap) unused disk space.
  • Remove static IPs and routes.
  • Update Primary IP of hostname in /etc/hosts.

Modifications for detaching a Linux VM

In addition to modifications made for the run-in-cloud operation, the package tunes the network configuration after detaching.

  • Remove static ips, netmasks and routes.
  • Remove inactive NICS.
  • Remove NIC hardware attachments.
  • Enforce DHCP on eth0.
  • Enforce default GW.
  • Configure custom DNS server.
  • Configure alias IP ranges.
  • Remove VMware, Azure, or AWS guest agent.
  • Install the Google Cloud cloud agent (requires either an external IP address or Private Google Access to be enabled).
  • Install the Compute Engine OS patch management agent. To use OS patch management features, or to uninstall or disable the agent:

    Go to the OS Patch Management page

Next steps