VMware's VMotion is one of the best-known features of vSphere 4. VMotion allows you to move a running virtual machine
(VM) from one ESX or ESXi server to another without having to power off a VM. This capability translates into no application downtime when circumstances necessitate a VM migration. VMotion also allows you to balance the load across ESX servers when you enable Distributed Resource Scheduler (DRS). Without VMotion, you wouldn't be able to use Update Manager to perform maintenance or patch ESX servers without incurring virtual machine downtime.
First, let's go over how to download and configure VMotion, then we'll review how to perform a VMotion in vSphere 4 in step-by-step detail.
How do I download VMotion?
With vSphere 4, you obtain VMotion by purchasing the Advanced, Enterprise or Enterprise Plus version of the vSphere suite. You must also have vCenter 4, which is purchased separately. You cannot add VMotion as a standalone add-on as you could with VMware Infrastructure 3. The big plus is that VMotion is not a separate license key that you have to enter or combine with other license keys; your license for VMotion is included in the version of vSphere you select.
But if I were you, instead of making a purchase off the bat, I would first evaluate vSphere 4, vCenter and the VMotion feature set. You can get a 60-day evaluation of vSphere 4 Enterprise Plus and vCenter, which includes VMotion and other advanced features. A quick word of caution, however; ensure that your servers are compatible with vSphere by checking the VMware Hardware Compatibility Guide.
How does VMotion work?
No matter how many times I use VMotion, I still find it completely amazing. Think about it: The computer you use to view this Web page could be moving from one physical server to another, without your knowledge, and you may never know.
The process of migrating a powered-on virtual machine from one host server to another host without having to power off a VM is known as a "hot" or "live" migration.
We can break the actual process of a VMotion down into a series of steps:
- A request has been made that VM A should be migrated (or "VMotioned") from ESX A to ESX B.
- VM-A's memory is pre-copied from ESX A to ESX B while ongoing changes are written to a memory bitmap on ESX A.
- VM-A is quiesced on ESX A and VM A's memory bitmap is copied to ESX B.
- VM A is started on ESX B and all access to VM A is now directed to the copy running on ESX B.
- The rest of VM A's memory is copied from ESX A all the while memory is being read and written from VM A on ESX A when applications attempt to access that memory on VM A on ESX B.
- If the migration is successful, VM A is unregistered on ESX A.
What are the requirements to perform a VMotion?
Before you use VMotion in your infrastructure, you need to make sure you meet the requirements. Although the list looks long, the actual process is pretty simple, so don't be alarmed.
- The VM cannot be connected to a CD-ROM or floppy drive that is using an ISO or floppy image stored on a drive that is local to the host server.
- The VM's affinity must not be set (aka, bound to physical CPUs).
- The VM must not be clustered with another VM (using a cluster service like the Microsoft Cluster Service (MSCS)).
- The two ESX servers involved must use (the same) shared storage.
- The two ESX servers involved must be connected via Gigabit Ethernet (or better).
- The two ESX servers involved must have access to the same physical networks.
- The two ESX servers involved must have compatible CPUs. (See support on Intel and AMD).
- Note that these are most -- but not all -- of the requirements. For the complete set of requirements see the vSphere 4 Basic System Administration Guide, specifically Virtual Machine Management -- Migrating Virtual Machines (chapter 16) -- Migrating with VMotion (page 188).
If any of the above conditions are not met VMotion will not work. Luckily, the Migration Wizard tests for most of these before attempting a VMotion so that there is no possibility of downtime.
How do I configure VMotion in vSphere 4?
Let's assume that you meet all the requirements above, which is a fairly safe assumption because you could meet those requirements simply by creating a new vSphere infrastructure with shared storage and connecting your ESX hosts to that shared storage.
At this point, the only configuration that you need to use VMotion is to add a VMotion-enabled VMkernel adapter. If you use Network File System (NFS) or software iSCSI for your storage area network (SAN) shared storage then you already have a VMkernel adapter. If your shared storage is Fibre Channel (FC), you will have to add a VMkernel adapter.
To do that, follow these steps on each ESX server:
1. Go into the Configuration tab, click on Networking, and click Add Networking.
2. Opt to add a new VMkernel Port.
3. Add the new VMkernel port to an existing switch or create a new switch.
4. On the Port Group Properties, it is critical that you check the checkbox that is next to "Use this Port Group for VMotion."
5. You will have to use Dynamic Host Configuration Protocol (DHCP) or enter a static IP address for the VMkernel adapter (static is highly recommended).
6. Finally, click Finish on the Ready to Complete window.
How do I perform a VMotion in vSphere 4?
Now that you have met the requirements and configured VMotion, you are ready to perform the VMotion in vSphere 4. This is the easiest part.
1. Find the virtual machine that you want to migrate with VMotion in the inventory of the vSphere client.
2. Right-click on the virtual machine and click Migrate or click on the Summary tab and click Migrate.
3. Select that you want to change the host that the virtual machine runs on. (If you select that, you want to change the data store then you are performing a Storage VMotion.)
4. Select the destination host or cluster that you want to migrate the VM to. When you make that selection the compatibility check is performed. This is very important because this is where the vSphere client will analyze the destination host to see whether it meets the requirements. What you are looking for is "Validation Succeeded," as you see in the image below.
If the validation was not successful, the vSphere client will tell you which issue you need to resolve.
5. Next, you can either take the default of Reserve CPU for optimal VMotion Performance (recommended) or opt to Perform with available CPU resources.
6. Review the confirmation page and click Finish.
Watch the Recent Tasks window to check the progress of your VMotion migration. You should see a task called Migrate Virtual Machine, and you can watch the progress as it says it is "Migrating the Active State of Virtual Machine," as you see below.
What you want to see is the word Completed under the Task status, as you see below.
Your VMotion has now completed. You can verify this by checking to see which host your virtual machine is now running on. As you can see in the next picture, the VM that we migrated is now running on the new ESX server.
Special thanks to SearchVMware.com post How to obtain, configure, and use VMotion and how VMotion works in VI3 by Andrew Kutz for some portions of this article.
David Davis is the director of infrastructure at TrainSignal.com. He has a number of certifications including vExpert, VCP, CCIE #9369 and CISSP. Davis has also authored hundreds of articles and six different video training courses at Train Signal with his most popular course being VMware ESX Server. His personal website is VMwareVideos.com. You can follow Davis on Twitter or connect with Davis on LinkedIn.