Migration from VMware: Difference between revisions

From Xen
Jump to navigationJump to search
No edit summary
 
(46 intermediate revisions by the same user not shown)
Line 1: Line 1:
As time passes, we are finding more and more people interested in migrating to Xen Project from VMware. The reasons for this migration include cost reduction and increased flexibility in cloud orchestration.
As time passes, we are finding more and more people interested in migrating to Xen Project from VMware. The reasons for this migration include cost reduction and increased flexibility in cloud orchestration.


Introduced in the 4.5 release, Xen Project now includes the ability to use VMware VMDK files natively to ease migration. For maximum performance, it is advisable to actually translate the VM files into a raw format. But this step can be delayed, if needed, to facilitate migration.
Scheduled for inclusion in a future release, Xen Project will include the ability to use VMware VMDK files natively to ease migration. But people who need to transition now should find this guide useful.

= Conversion Scenario =
<I>In early versions of VMware, they used a simpler file format. If you are running an older version of VMware, conversion is pretty simple; just jump to the '''[[#Disk Conversion|Disk Conversion]]''' section. Newer versions can take more work (e.g., multipart files, VM datastores, etc.). If you are running a newer version and you find that these instructions come up short, please let us know. We don't have access to the VMware software, so we rely heavily on the community to give us the information we need. If you discover a new or better way to convert VMware images, please edit this page so we can share this with others.</I>

* First Step: Stop the VM you want to convert. You need it in a static state so it can be successfully converted.

== Extract the VM from the VMware Datastore ==

<i>If the VM in question is located within a VMware datastore, [http://community.spiceworks.com/topic/344901-convert-vmware-to-xen this post] suggests a method for making a local copy of the VM to convert:</i>
<pre>
I would navigate to the datastore where the VM is located.

In the vSphere Client, the datastore is listed under the "Resources" section.

Right-Click the Datastore and choose "Browse Datastore" which should be at the
top of the menu.

Once the Datastore Browser is up, find the VM's folder.

Highlight the folder... Right-Click and choose "Download..."
</pre>
* Reference: http://community.spiceworks.com/topic/344901-convert-vmware-to-xen

== Flattening the VMDK File ==

<i>VMware sometimes uses multipart VMDKs which can grow in size. If yours is set up that way, you'll need to consolidate the multipart file into one file. One approach to this is to use the VMware utility 'vdiskmanager':</i>
<pre>
vmware-vdiskmanager -r original.vmdk -t 0 flattened.vmdk
</pre>

<i>[http://www.linalis.com/en/blog/convert-a-vmware-image-a-xen-image Another article] suggests a Linux-based technique for combining a multipart VMDK file:</i>
<pre>
# for i in `ls *[0-9].vmdk`; do qemu-img convert -f vmdk $i -O raw ${i/vmdk/raw} ; done
# cat *.raw >> flattened.img
</pre>


== Disk Conversion ==
== Disk Conversion ==


1) Halt the VMware VM. Examine the type of file used by the VM:
* Examine the type of file used by the VM:
<pre>
<pre>
# qemu-img info VMware-image.vmdk
# qemu-img info vm1.vmdk
image: VMware-image.vmdk
image: vm1.vmdk
file format: raw
file format: raw
virtual size: 23G
virtual size: 23G
Line 14: Line 49:
</pre>
</pre>


2) If the file format is “raw”, we need not convert the image file using qemu-img convert, just rename to .img file. If it is not “raw”, use “qemu-img” to convert the image to raw format.
* In the case above, the file format is <b>raw</b>, so it needs no conversion. Just rename the file to ".raw". However, most of the time, that will not be the case. You will need to use <b>qemu-img</b> to do the conversion.
<pre>
# qemu-img convert vm1.vmdk -O raw /vms/vm1/vm1.img
</pre>

== Create a new Xen Project configuration file ==

* Create an appropriate Xen Project VM configuration file in /etc/xen/vm1/, with a line specifying the converted file as disk:
<pre>
disk = [ ‘file:/vms/vm1/vm1.img,hda,w’ ]
</pre>

* Now boot up the converted VM and go!

== More Detailed Information ==

* [http://openwetware.openwetware.org/Software/Server/Virtual_Machines/Xen/Converting_VMWare_Image_to_Xen.html Converting VMware Image to Xen] includes some specific considerations for converting Windows VMs
* [https://www.funkypenguin.co.nz/tutorial/how-to-convert-a-centos-5-vmware-image-to-xen/ Convert a CentOS 5 VMware image to Xen] includes information on modifying the resulting image before booting; while no longer needed for the purpose specified (no longer need a Xen Project-specific kernel for most distributions), it is useful to know if you want to modifying the image without booting
* It is possible [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/V2V_Guide/chap-V2V_Guide-Converting_VMs_KVM.html virt-v2v] <i>might</i> be able to help convert images to Xen Project servers running the [[libvirt]] toolstack. <i>Can anyone verify this?</i>

== Using the OVF Format ==

<i>The folks over at [http://xenserver.org XenServer] have documented a way to convert VMware images to XenServer using the OVF format and the XenConvert utility:</i>


* [http://support.citrix.com/article/CTX133505 How to Export VMware Virtual Machine to OVF Package]
3) How to convert using qemu-img.
* [http://support.citrix.com/article/CTX116603 How to Convert VMware Virtual Machines to XenServer Virtual Machines]


== Commercial Options ==
[root@vm_s7 guest22]# qemu-img convert guest22-flat.vmdk -O raw /volumes/guest22/guest22.img


<i>A number of commercial offerings exist that simplify the task of moving VMs to the Xen Project hypervisor. If you are planning to move large quantities of VMs, these may make life easier:</i>
4) Create xen config file in /etc/xen/guest22 , with the renamed/converted image file as disk.


* [http://www.racemi.com/bi-directional-vxv-migration/ Racemi]
disk = [ ‘file:/volumes/guest22/guest22.img,hda,w’ ]
* [https://www.netiq.com/products/migrate/ NetIQ's Platespin]
* [https://www.vembu.com/vm-migration-lp1/ Vembu]


[[Category:Beginners]]
5) Boot up the xen domU guest. It should boot up fine.
[[Category:HowTo]]
[[Category:Tutorial]]
[[Category:VMware]]

Latest revision as of 18:41, 14 January 2015

As time passes, we are finding more and more people interested in migrating to Xen Project from VMware. The reasons for this migration include cost reduction and increased flexibility in cloud orchestration.

Scheduled for inclusion in a future release, Xen Project will include the ability to use VMware VMDK files natively to ease migration. But people who need to transition now should find this guide useful.

Conversion Scenario

In early versions of VMware, they used a simpler file format. If you are running an older version of VMware, conversion is pretty simple; just jump to the Disk Conversion section. Newer versions can take more work (e.g., multipart files, VM datastores, etc.). If you are running a newer version and you find that these instructions come up short, please let us know. We don't have access to the VMware software, so we rely heavily on the community to give us the information we need. If you discover a new or better way to convert VMware images, please edit this page so we can share this with others.

  • First Step: Stop the VM you want to convert. You need it in a static state so it can be successfully converted.

Extract the VM from the VMware Datastore

If the VM in question is located within a VMware datastore, this post suggests a method for making a local copy of the VM to convert:

I would navigate to the datastore where the VM is located.

In the vSphere Client, the datastore is listed under the "Resources" section.

Right-Click the Datastore and choose "Browse Datastore" which should be at the
top of the menu.

Once the Datastore Browser is up, find the VM's folder.

Highlight the folder... Right-Click and choose "Download..."

Flattening the VMDK File

VMware sometimes uses multipart VMDKs which can grow in size. If yours is set up that way, you'll need to consolidate the multipart file into one file. One approach to this is to use the VMware utility 'vdiskmanager':

vmware-vdiskmanager -r original.vmdk -t 0 flattened.vmdk

Another article suggests a Linux-based technique for combining a multipart VMDK file:

# for i in `ls *[0-9].vmdk`; do qemu-img convert -f vmdk $i -O raw ${i/vmdk/raw} ; done
# cat *.raw >> flattened.img

Disk Conversion

  • Examine the type of file used by the VM:
# qemu-img info vm1.vmdk
image: vm1.vmdk
file format: raw
virtual size: 23G
disk size: 23G
  • In the case above, the file format is raw, so it needs no conversion. Just rename the file to ".raw". However, most of the time, that will not be the case. You will need to use qemu-img to do the conversion.
# qemu-img convert vm1.vmdk -O raw /vms/vm1/vm1.img

Create a new Xen Project configuration file

  • Create an appropriate Xen Project VM configuration file in /etc/xen/vm1/, with a line specifying the converted file as disk:
disk = [ ‘file:/vms/vm1/vm1.img,hda,w’ ]
  • Now boot up the converted VM and go!

More Detailed Information

  • Converting VMware Image to Xen includes some specific considerations for converting Windows VMs
  • Convert a CentOS 5 VMware image to Xen includes information on modifying the resulting image before booting; while no longer needed for the purpose specified (no longer need a Xen Project-specific kernel for most distributions), it is useful to know if you want to modifying the image without booting
  • It is possible virt-v2v might be able to help convert images to Xen Project servers running the libvirt toolstack. Can anyone verify this?

Using the OVF Format

The folks over at XenServer have documented a way to convert VMware images to XenServer using the OVF format and the XenConvert utility:

Commercial Options

A number of commercial offerings exist that simplify the task of moving VMs to the Xen Project hypervisor. If you are planning to move large quantities of VMs, these may make life easier: