AHV TO HYPER-V/VMWARE/KVM MIGRATION

AHV to hyper-v/VMware/KVM migration

Advertisements

AHV TO HYPER-V/VMWare/KVM MIGRATION

In order to migrate a guest VM from an AHV cluster, download the entire vDisk or vDisks associated with that VM. Use qemu-img utility for Windows to create a virtual disk in vmdk or vhd/vhdx/qcow2 format.

QEMU utility for Windows. It is used for converting, creating and consistency checking of various virtual disk formats. It’s compatible with Windows Hyper-V, Open Source Linux based KVM, VMware, Oracle VirtualBox and Citrix Xen virtualization solutions.

By default, qemu-img utility is already installed in Nutanix AHV hypervisor. In production, it is not recommended running qemu-img utility directly on CVM to change disk format as it is a very CPU intensive operation that can affect services running on CVM itself.

qemu-img always converts the disk from thick to thin provisioned

The following steps can be used to migrate VM from AHV to Windows Hyper-V hypervisor:

First We have to shut down the Guest Virtual Machines

Required tools for performing the activity

  1. Download free FTP WINSCP tool from https://winscp.net
  2. Download free SSH Putty tool from https://www.putty.org
  3. Download free Converter tool Qemu from Qemu for windows

Verify the disks in virtual machine from prism element. There are two disk in test1 VM

Nutanix VM Virtual disk

Take the putty of any controller Virtual Machine(CVM)

nutanix@ProdACVM$:- acli
<acropolis> vm.list     --------- To list the all VMS so we can copy the name for the next command
VM name                            VM UUID
test1                              121213-32323984982-39283920-329203
test2                              212i-21221-3ssdsd-ffsff-sdsds-3223
<acropolis> vm.get test1

Output of the above comand

test1 {
config {
agent_vm: False
allow_live_migrate: True
annotation: "MDF Server”
disk_list {
addr {
bus: "ide"
index: 0
}
cdrom: True
device_uuid: "72a6e0d8-dc2e-4bab-909a-27b72a500b26"
empty: True
naa_id: "naa. 6506b8d2£4a9754448c9ca7cé4bc7dbi”
}
disk_list {
addr {
bus: "scsi"
index: 0
}
container_id: 20059
container_uuid: "852a6e1f£-2025-4f£84-acbi-f£3e5d3470£72"
device_uuid: "3a81b47a-2eeb-4b9a-ba5c-d9448934bdab”
naa_id: "naa. 6506b8dfba2a4b846048a8104c007e70"
vmdisk_size: 107374182400
vmdisk_uuid: "36a6c285-d3dc-4e19-8ac3-fa9acbib3fba”
}
disk_list {
addr {
bus: "scsi"
index: 1
}
container_id: 20059
container_uuid: "852a6e1f£-2025-4f£84-acbi-f£3e5d3470£72"
device_uuid: "04f£6f6b5-857£-4218-8a05-6e70110ca26e"
naa_id: "naa. 6506b8dc5912f88feal38c785d45927d"
vmdisk_size: 536870912000
vmdisk_uuid: "6b8393ea-c59d-4e90-be31-df0eb7eaf0le”
}

Note down the vmdisk_UUID

SCSI.0 :-

36a6c285-d3dc-4e19-8ac3-fa9acbib3fba

SCSI.1 :-

6b8393ea-c59d-4e90-be31-df0eb7eaf0le

Using WinSCP software, connect to a CVM using SFTP protocol and port 2222 using Prism element admin or local user credentials.

Nutanix WinSCP

We will get the authentication banner for the controller virtual machine

Authentication Banner CVM

Enable the option to show hidden files in Winscp for Storage Containers

Options > Preferences > Panels and then selecting the “Show hidden files”  option under the common settings.

Show hidden file

You will see the storage container created on Prism Element for storage guest Virtual machine data

Winscp directory

Go to the VMDISK directory and copy the vm disks files and save this to local Windows machine

Disk path for vmdisk

Once the disks are copied we can convert them into vmdk for VMware or vhd/vhdx/ for Hyper-V qcow2 for Linux KVM format.

Now we will use qemu-img for Windows to convert disk:Once you download the file in qemu-img-win-x64.Zip format extract it.

AHV TO HYPER-V/VMWARE/KVM MIGRATION

the syntax for the command :-

C:\Users\Pavan>qemu-img.exe convert -O <convert to format> <vdisk_path> <converted_path>

Replace <convert to format> with the format of output you want.
Replace <vdisk_path> with the path of the source virtual disk.
Replace <converted_path> with the path of the converted virtual disk.

For Hyper-V

C:\Users\Pavan>qemu-img.exe convert -O vhdx E:\36a6c285-d3dc-4e19-8ac3-fa9acbib3fba E:\test1\test1_Cdrive.vhdx
C:\Users\Pavan>qemu-img.exe convert -O vhdx E:\6b8393ea-c59d-4e90-be31-df0eb7eaf0le E:\test1\test1_Ddrive.vhdx

For VMware

C:\Users\Pavan>qemu-img.exe convert -O vmdk E:\36a6c285-d3dc-4e19-8ac3-fa9acbib3fba E:\test1\test1_Cdrive.vmdk
C:\Users\Pavan>qemu-img.exe convert -O vmdk E:\6b8393ea-c59d-4e90-be31-df0eb7eaf0le E:\test1\test1_Ddrive.vmdk

For Linux KVM

C:\Users\Pavan>qemu-img.exe convert -O qcow2 E:\36a6c285-d3dc-4e19-8ac3-fa9acbib3fba E:\test1\test1_Cdrive.qcow2
C:\Users\Pavan>qemu-img.exe convert -O qcow2 E:\6b8393ea-c59d-4e90-be31-df0eb7eaf0le E:\test1\test1_Ddrive.qcow2

Upload converted disk to destination host and follow steps to create virtual machine on Hyper-V and attach the existing disks.

In Hyper-V create Virtual machine with attach disk later and follow the below steps

  1. Create VM as per compute resource.
  2. Select the created Virtual Machine
  3. Right click on the VM to edit settings and add a new hard drive.
  4. Select the SCSI Controller option
  5. Choose the type of HDD as per your requirement
  6. Add both disk with SCSI controller 0 and location 0,1

In VMware create Virtual machine with attach disk later and follow the below steps

  1. Create VM as per compute resource.
  2. Select the created Virtual Machine
  3. Right click on the VM to edit settings and add a new hard drive.
  4. On the Virtual Hardware tab, select Existing Hard Disk from the New device drop-down menu and click Add.
  5. Choose the Data stores column, expand a data store, select a virtual machine folder, and select the disk to add.
  6. Click Ok to exit.

In Linux KVM create Virtual machine with attach disk later and follow the below steps.

root@localhost# virsh attach-disk {vm-name} /var/lib/libvirt/images/{img-name-here} vdb --cache none
OR
virsh attach-disk {vm-name} \
--source /var/lib/libvirt/images/{img-name-here} \
--target vdb \
--persistent
or
virt-install \
--name test1 \
--memory 2048 \
--vcpus 2 \
--disk /path/to/imported/test1.qcow2 \
--import \
--os-variant test1

Leave a Reply