Ovirt : Convert physical/virtual systems to virtual using virt-p2v && virt-v2v then use it in ovirt DC

Here is the detailed process about virt-v2v and virt-p2v which can be used in an ovirt setup to migrate your physical and virtual systems to ovirt data center.!!!

Below strings concludes about what is virt-v2v and virt-p2v, how it work, how it can be used for the conversion. It also includes how you can debug issues in this area. !!!

I am sure there are many sysadmins who have large collections of virtual machines running either on proprietary hypervisor or physcial machines in their deta centers and are wondering how they are going to virtualize  them on truely open source virtualization platform oVirt (ovirt.org)

Well answer is virt-v2v utility. This tool is absolutely killer, It allows you to convert physical server/desktop to virtual server/desktop, It also allows you to convert virtual server/desktop of another format, example vmware, kvm, maybe xen into a flavor of kvm/ovirt .

At some point virt-v2v will be able to be used as v2c which means virtual to cloud, using it you would be able to move virtual machines/physical machines into cloud.

Before learning this tool I always had question, Do we really need special utility for migrating a virtual machine from one platfrom to another or Physical to virtual server migration? Can’t we just copy the bits residing on a physical disk to a virtual disk, e.g dd + nc )? I even tried that with partial success and realized that such tool is really required because v2v or p2v is not just copying bits from one disk to another, along with copying bits from disk it’s very important to inject paravirtualizaed drivers, and modify some other bits to support those drivers which is hard when manually performed. it can be achieved perfectly only when a special conversion utility like virt-v2v is used.

virt-v2v can currently convert RHEL4, RHEL 5, RHEL 6, Windows XP, Windows Vista, Windows 7, Windows Server 2003 and Windows Server 2k8 virtual machines running on Xen, KVM and VMware ESX or physical system

The following source hypervisors are currently supported by virt-v2v:

Xen
KVM
VMware ESX

In future version, It may also support.

HyperV
Citrix Xen Server

picture1


How to get the virt-v2v utility ? 

The package name is virt-v2v. It is available in Fedora Base channel. No need
to subscribe any special channel to get the tool.

The system on which virt-v2v package installed is referred as virt-v2v conversion Server. It can be installed on virtual or physical system.

[root@eprasad]# rpm -ql virt-v2v | head -3
/etc/virt-v2v.conf
/usr/bin/virt-p2v-server
/usr/bin/virt-v2v

This package install list of files on the system, Above 3 are important among
Them .

/etc/virt-v2v.conf : Main configuration file of virt-v2v, You can define specific
profiles for a conversion method, storage location, output format and
allocation policy

/usr/bin/virt-p2v-server : A p2v server that receives data from
p2v client.

/usr/bin/virt-v2v : The Script which actuallly performs a conversion.
Now we have conversion sever ready, Lets see how to migrate virtual machine to ovirt from foreign hypervisors,

Virtual to Virtual Migration :

Before converting a virtual machines to run on ovirt, you must attach an export storage domain to the ovirt data center being used.

All Converted Virtual Machines image are saved on ‘Export Storage domain’ first and later you can import them on desired data storage domain.

picture2

Diagram explaining typical virtual to virtual migration procedure

Following are the prerequisites of virtual to virtual migration using virt-v2v utility.

A ) Operating system specific

Linux : 

– Recommended to register the intended virtual machine with RHN or have access to local yum repo because as part of conversion process, virt-v2v may install new kernel and drivers in the system.

Windows :

– Install the libguestfs-winsupport package on the host running virt-v2v. This package provides support for NTFS, which is used by many Windows systems.

– Install the virtio-win package on the host running virt-v2v. This package provides para-virtualized block and network drivers for Windows guests.

# yum install libguestfs-winsupport virtio-win on virt- v2v conversion server.

B ) Foreign hypervisors specific

KVM : Ensure that ssh is enabled and listening on the default port.

VMWARE :

1) Remove vmware-tools installed on the system. ssh access is enabled.
2) Authentication : Connecting to the ESX / ESX(i) server requires authentication. virt-v2v supports password authentication when connecting to ESX / ESX(i). It reads passwords from $HOME/.netrc. An example entry is:

machine esx.example.com login root password s3cr3t

XEN : System must have acccess to rpm package repository as new kernel and drivers need to be downloaded and ssh should be enabled.

Actual Procedure : virt-v2v command to migrate virtual machines.

VMware to OVirt migration :
1) Create an NFS export domain. Attach that to the ovirt data center. Make sure host acting as virt-v2v conversion sever have access it.

2) Shutdown the virtual machine and uninstall VMware Tools on the guest operating system .

3) Make sure ssh is enabled on ESX/ESXi host and the authentication details are enterd in $HOME/.netrc

4) Now Convert the virtual machines using below commands.

#virt-v2v -ic esx://esx.example.com/ -o rhev -os 
storage.example.com:/exportdomain --network ovirt guest_name

Here :

-Ic =   URI of your esx host 
-o  =   output methed.  No explicit method available for ovirt however rhev methed  works out of box. 
-os = Output storage, NFS export storage domain path where you wish to save converted virtual machin image. The domain must be in the format :, for example, rhev-storage.example.com:/rhev/export. 
-network = Network to which virtual machine will be mapped.

Optionally you can create virt-v2v profile. very useful when large number of virtual machines migration is planned.

5) Import the virtual machine from Export Storage domain into Ovirt.

KVM to OVirt migration :

1) Create an NFS export domain. Attach that to the ovirt data center. Make sure host acting as virt-v2v conversion sever have access it.

2) Shutdown the virtual machine. Make sure ssh is enabled on the host.

3) Convert the virtual machine using below command :

#virt-v2v -ic qemu+ssh://root@kvmhost.example.com/system -o rhev -os storage.example.com:/exportdomain --network ovirt guest_name

qemu+ssh://root@kvmhost.example.com/system = KVM host from which virtual machine need to be migrated

4) Import the virtual machine from Export Storage domain into Ovirt.

Xen to Ovirt Migration : 

1) Don’t confuse with Citrix XenServer or XenDesktop, Here xen is referred kernel-xen .

2) Make sure that virtual machine which need to be migrated to ovirt has access to yum repository to downloade non-xen kernel and some other stuff.

3) Make sure ssh connection is enabled on Xen Dom0.

4) convert the virtual machine using below command :

virt-v2v -ic xen+ssh://root@vmhost.example.com -o rhev -os storage.example.com:/exportdomain --network ovirt guest_name

5) Import the virtual machine from Export Storage domain into Ovirt.

What to do when things go wrong? How to troubleshoot virt-v2v related issues :

1) Ensure that required v2v packages are installed on the virt-v2v conversion server. e.g libguestfs-winsupport and virtio-win installed when a windows guest migration is planned.

2) Ensure that ssh is enabled on source host machine.

3) Make sure that Export Storage domain has enough space to accommodate new virtual machines.

4) Verify virt-v2v command syntax being used is correct. Virt-v2v man page has detail explanation of each parameter and examples also included.

Everything fine but still migration is failing?

In such situation enabling virt-v2v debug logs will be helpful. Virt-v2v debug logs can be enabled by prefix the virt-v2v command with the following environment variables

LIBGUESTFS_TRACE=1 
LIBGUESTFS_DEBUG=1,  

#LIBGUESTFS_TRACE=1 LIBGUESTFS_DEBUG=1 virt-v2v -ic xen+ssh://root@vmhost.example.com -o rhev -os storage.example.com:/exportdomain --network ovirt guest_name   2>&1 | tee virt-v2v.log

Physical to Virtual Migration 

Virt P2V is comprised of both virt-p2v-server, included in the virt-v2v package, and the P2V client. Fedora virt-p2v image is unfortunately not available on any official fedora site for download. You will need build it your own . To know how to build a virt-p2v iso refer this post : website-humblec.rhcloud.com/how-to-build-a-virt-p2v-iso-in-fedora-f18f17/

I have built one and uploaded here :
docs.google.com/file/d/0B9WWLq_PzVsZWDlETzlPeDJIX3M/edit
its version 0.9.0. Feel free to download and use it.

p2v.iso is a bootable disk image based on a customized fedora image. Booting a physical machine from p2v.iso and connecting to a V2V conversion server that has virt-v2v installed allows data from the physical machine to be uploaded to the conversion server and converted for use ovirt virtualization.

Is it possible to convert any physical computers to virtual using virt-v2v ?

Depends on physical system configuration. I have tested converting many physical computers and it worked absolutely fine. However, There are some restrictions apply to P2V. To perform a P2V conversion, your source computer:

1. Must have at least 512 MB of RAM.
2. Cannot have any volumes larger than 2040 GB.
3. Virt-v2v support P2V conversion for computers based on x86 or x86_64 architecture. You wont able able convert computers with Itanium architecture–based operating systems.
4. Computers with their root filesystem root on a software RAID md device cannot be converted to virtual machines.
5. Operating system installed on computer must sbe upported to run as guest on ovirt.
6. Must have at least one ethernet connection.

If your physical computer meets above basic hardware requirements, It will successfully boot the P2V client:

picture3

Diagram explaining typical physical to virtual migration.

Actual Procedure :

Before you use P2V, you must first prepare your conversion server and download and prepare the p2v.iso boot media.

Boot the intended physical system with virt-p2v iso > connect to virt-v2v conversion server > select the virt-v2v profile > start the conversion

How to prepare virt-v2v conversion server ?

1) Install virt-v2v and related packages on any physical system or virtual machine. You may also use ovirt engine node to act as virt-v2v conversion server.

2) Enable root login over ssh:
Change ‘PermitRootLogin’ directive to yes in /etc/ssh/sshd_config and restart sshd service.

   #service sshd restart

3) Define a Target Profile in virt-v2v.conf : In virtual to virtual migration defining virt-v2v profile is optional but for physical to virtual it is mandatory to define Target Profile in virt-v2v.conf

As root, edit /etc/virt-v2v.conf on virt-v2v conversion server

Scroll to the end of the file. Before the final , add the following:

rhev

nfs.share.com:/export1

Where:
Profile Name is an arbitrary, descriptive target profile name.
Method is the destination hypervisor type (rhev for ovirt ).
Storage Format is the output storage format, either raw or qcow2.
Allocation is the output allocation policy, either preallocated or sparse.
Network type specifies the network to which a network interface should be

4) Once your virt-v2v conversion server is ready. Boot the intended physical machine from virt-p2v iso. Because P2V client is built upon a Red Hat Enterprise Linux 6 live image, the Red Hat Enterprise Linux 6 splash image is displayed while the tool is booting.

Configure networking. Generally the P2V client configures networking automatically using DHCP. If it is unable to configure networking automatically, you will need to configure it manually. IP Address, Gateway, and Prefix are required fields. Enter values that are appropriate for your network, and click Use these network settings.

picture4

5) Once the network is configured. Virt-p2v will present loging screen asking for virt-v2v conversion server hostname and password.

picture5

6) After connecting to your conversion server, configure the virtual hardware that will be attached to the converted physical machine, and select which physical hardware should be converted. At least one Fixed Storage device must be converted, including the device containing the operating system installation.

picture6

7 ) Select a Destination Profile from the drop down menu. These reflect the target profiles included in the /etc/virt-v2v.conf file on the conversion server.

8) Enter a Name for the Virtual Machine that will result from the conversion.
The Number of CPUs and Memory(MB) are automatically detected and completed. Change them if more CPUs and/or Memory are desired on the outputted virtual machine.

9) When Target Properties, Fixed Storage, Removable Media, and Network Interfaces have all been configured as desired, click Convert.

That’s all. Conversion may take some time and once completed you will be able to see virtual machine name in export storage domain. Import it !

Troubleshooting physical to virtual conversion failure .

Debug logs can be collected by following below steps:

1.In virt-p2v client:ctrl+alt+F2 to console:dmesg
2.Modifiy /usr/bin/virt-p2v-server to set the debug level:

1. Initialize logging

       #logmsg_init('syslog');
      #logmsg_level(DEBUG);

Uncomment these 2 lines to capture debug information from the conversion

2. process

      $ENV{'LIBGUESTFS_DEBUG'} = 1;
      #$ENV{'LIBGUESTFS_TRACE'} = 1;

The logs are now captured in conversion server .

  1 comment for “Ovirt : Convert physical/virtual systems to virtual using virt-p2v && virt-v2v then use it in ovirt DC

  1. Yaniv
    2016년 7월 9일 at 6:58 오전

    virt-v2v functionality from VMware has been integrated into oVirt 3.6. 4.0.x will introduce additional resources – Xen (EL 5) and libvirt VMs.

댓글 남기기

Videos, Slideshows and Podcasts by Cincopa Wordpress Plugin