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 and its operating system (OS) 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 as needed. 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 OS 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 for booting in Google Cloud using an automatically installed package. Changes are activated only when detecting a run-in-cloud operation, and the package can remain installed after the VM has been migrated. If the package is uninstalled, all changes are reverted.

The set of changes made to the system 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.

Modifications for run-in-cloud on Windows VMs

Before moving the Windows VM to Google Cloud, 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.

  • Install the NETKVM driver for Migrate for Compute Engine.
  • Change network configuration.
  • System tuning for iSCSI and MPIO access.
  • Change license/edition.
  • 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.

Modifications for detaching a Windows VM

In addition to changes made during the run-in-cloud operation, during a detach of a Windows VM, Migrate for Compute Engine installs the Google Cloud cloud agent.

Modifications for run-in-cloud on Linux VMs

The Migrate for Compute Engine package is required before migrating.

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.

Next steps