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. If you encounter errors while executing the required scripts, refer to the KB article "Access denied error during script Execution when Converting Windows VM to GCP for ContentStore Upload article 80244".

Note

Before You Begin

  • For the Windows operating systems of guest Amazon, Azure Resource Manager, and VMware VMs, download the vioscsi.inf, netkvm.inf Windows driver files.

  • For the Linux operating systems of guest Azure Resource Manager and VMware VMs, download the virtio drivers (preloaded with Linux).

Procedure

Make the following changes to source VMs:

  1. For Windows VMs that are running in Amazon, Azure Resource Manager, and 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 Amazon, Azure Resource Manager, and 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. 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.

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

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

    4. To add the VirtIO SCSI controller to the CriticalDeviceDatabase, 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.o

  3. For Linux VMs, ensure that the following modules are configured to be available during the boot process: virtio, virtio_ring, virtio_pci, virtio_net, virtio_scsi. Although commonly used Linux distributions (CentOS, RHEL, OpenSUSE, Ubuntu) will have these virtio driver modules packaged, you should still ensure that they are configured to be available.

    1. To check whether the required modules are built into the kernel itself, run the following command:

      grep -i virtio /boot/config-$(uname -r)

      Look for values of CONFIG_VIRTIO, CONFIG_VIRTIO_PCI, CONFIG_VIRTIO_NET, and CONFIG_SCSI_VIRTIO.

      If a virtio driver’s line says y, the driver is built into the kernel and it will be available by default during the boot process.

      If a virtio driver’s line says m, the driver needs to be part of the initial RAM disk.

    2. Check if the drivers are part of the initial ramdisk, as follows:

      1. For CentOS, RHEL, or OpenSUSE, run the following command:

        lsinitrd | grep -i virtio

      2. For Ubuntu, run the following command:

        lsinitramfs /boot/initrd.img-$(uname -r) | grep -i virtio

    3. If any driver is missing from both the kernel and the initial ramdisk, rebuild the initial ramdisk to include the missing modules, as follows:

      1. For CentOS, RHEL, or OpenSUSE, create a backup of the current initial ramdisk image by running the following command:

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

        Where:

        - (For CentOS and RHEL): <Current_Image_Name> = initramfs-$(uname -r).img

        - (For OpenSUSE): <Current_Image_Name> = initrd-$(uname -r)

      2. Edit the dracut.conf file by running the following command:

        vi /etc/dracut.conf

      3. 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.

      4. Go to the boot folder by running the following command:

        cd /boot

      5. Recut the initial ramdisk image by running the following command:

        dracut -f -v

      6. List the initial ramdisk image contents and verify that the virtio drivers were added, by running the following command:

        lsinitrd | grep -i virtio

  4. Since the network interface names on VMware and GCP are different, this might cause an issue after the restore. Therefore, it is recommended to run the following command on the source VM:

    execute 'nmcli device connect <network interface name>'

  5. Perform a backup operation for the modified source VMs.

Loading...