Preparing VMs for Conversion to Google Cloud Platform

Before you perform a backup operation for virtual machines that you plan to convert, make changes to the source VMs to ensure that they can be converted successfully.

Before You Begin

Download required driver files for the operating systems of guest VMs:

  • Windows: vioscsi.inf, netkvm.inf

  • Linux: virtio drivers (preloaded with Linux)

Procedure

Make the following changes to source VMs:

  1. For Windows VMs that are running in VMware, download and install GooGet PowerShell as follows:

    1. Download and install GooGet by running the following commands in an elevated PowerShell version 3.0 or higher prompt:

      [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
      Invoke-WebRequest https://github.com/google/googet/releases/download/v2.13.0/googet.exe -OutFile $env:temp\googet.exe;
      & "$env:temp\googet.exe" -root C:\ProgramData\GooGet -noconfirm install -sources 
      https://packages.cloud.google.com/yuck/repos/google-compute-engine-stable googet;
      Remove-Item "$env:temp\googet.exe"

      During installation, GooGet adds content to the system environment. After installation completes, launch a new PowerShell console or provide the full path to the googet.exe file (C:\ProgramData\GooGet\googet.exe).

    2. Open a new console and then add the google-compute-engine-stable repository by running the following command:

      .\googet.exe -root C:\ProgramData\GooGet addrepo google-compute-engine-stable https://packages.cloud.google.com/yuck/repos/google-compute-engine-stable
    3. Run the following commands to download VioSCSI and NetKVM drivers:

      .\googet.exe -root C:\ProgramData\GooGet download google-compute-engine-driver-netkvm
      .\googet.exe -root C:\ProgramData\GooGet download google-compute-engine-driver-vioscsi
    4. Extract the downloaded files using 7Zip, and then install the drivers as described in Step 2a through Step 2d, below.

  2. For Windows VMs that are running in VMware, inject drivers for the SCSI controller (vioscsi) and network adapter (netkvm) to ensure that the Google Cloud Platform instance can start after conversion. The vioscsi driver is required for the Windows boot process.

    1. Add a VirtIO SCSI controller device as a placeholder.

    2. Perform the following steps for both of the driver files (vioscsi.inf and netkvm.inf):

      1. Go to Run and execute hdwwiz.exe to open the Add New Hardware wizard.

      2. Select the Install the hardware that I manually select from a list option.

      3. As the hardware type, select Show All Devices.

      4. Click Have Disk.

        The Install from Disk dialog box appears.

      5. Browse and select the driver file, and then click OK.

      6. Click Next to continue, click Next again to start installing the driver, and then click Finish when the installation completes.

    3. From Windows Explorer, right-click the vioscsi.inf file, and then click Install.

    4. From Windows Explorer, right-click the netkvm.inf file, and then click Install.

    5. To add the VirtIO SCSI controller to the CriticalDeviceDatabase folder, add the following registry key to the Windows registry hive:

      [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\PCI#VEN_1AF4&DEV_1004&SUBSYS_00081AF4&REV_00] "ClassGUID"="{4D36E97B-E325-11CE-BFC1-08002BE10318}" "Service"="vioscsi"

      Note

      "ClassGUID" and "Service" are string values.

      Note that, if the CriticalDeviceDatabase folder does not already exist, create one as follows:

      • Open the Windows Registry Editor, and then go to the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet directory.

      • Right-click Control, and then click New > Key.

      • Name the new key CriticalDeviceDatabase.

      • Close the Registry Editor.

  3. For Linux VMs, verify that required drivers are included in the initramfs RAM disk image.

    Although virtio drivers are preloaded with Linux, the drivers might not be included in the initramfs RAM disk image from which drivers are loaded.

    1. To check whether the drivers are included in the initramfs disk image run the following command:

      lsinitrd | grep -i virtio

      If virtio drivers are already included, you do not need to make any further changes to the Linux VMs.

      If the command does not list virtio drivers, then perform the following steps.

    2. Run the following command to identify the initramfs file version:

      uname -r
    3. Create a backup of the current initramfs image.

      cp /boot/<Current_Image_Name> /boot/<Current_Image_Name>.backup

      where <Current_Image_Name> is the initramfs file version.

    4. Run the followng command to edit the dracut.conf file:

      vi /etc/dracut.conf
    5. Add the following line to the dracut.conf file. If the line already exists as a commented line, uncomment the line and then add the drivers to the line, with spaces separating each driver:

      add_drivers+=" virtio virtio_ring virtio_pci virtio_scsi virtio_net "

      Note

      • Note the whitespaces before and after the drivers.

      • Add only the required drivers.

      • If the VM kernel version is later than 3.6, do not include virtio_ring.

    6. Go to the boot folder:

      cd /boot
    7. Recut the initramfs image:

      dracut -f -v
    8. List the RAM disk image contents and verify that the virtio drivers were added:

      lsinitrd | grep -i virtio

Perform a backup operation for the modified source VMs.

Loading...