Saturday, July 2, 2011

Setup and Test VirtualBox Teleportation in Normal PC- Live Migration of Virtual Machines


Recently I had time to check VirtualBox teleportation in my local PC. This is a cool feature started coming from 3.1 and later versions. In this post I demonstrate how to setup and test VirtualBox teleportation which means live migration of working virtual machines between different hosts over network.

What is the use of VirtualBox teleportation?

This mainly helps to move most critical virtual machines to other different hosts without shutting down and any down time which called live migration in VirtualBox. This is mostly suitable for production environment servers and desktops. Without any down time you can move VMs to other hosts and shutdown existing host.
VB teleportation works regardless of host OS, means you can move one VM from Windows host toLinux host or Mac Host. It’s better to run same version of VirtualBox in both hosts.
The original VM will be called as ‘source VM’ and other host, where you are going to teleport will be called as ‘target VM’.

What I’m going to do here?

Test VirtualBox Teleportation Normal PC
My Source Computer is
1) A desktop computer
2) Windows 7 Host OS ( Intel Core2Duo 2.66GHz, 3GB Ram)
3) VirtualBox 3.1.6
4) The Guest VM is Windows 7 32Bit
My Target Computer is
1) A Laptop Computer
2) Windows 7 Host OS ( Intel Pentium Dual Core 1.46GHz, 2GB Ram)
3) VirtualBox 3.1.6
TCP/IP network configured between these two computers and I switched all Windows firewall  settings completely. Now what I’m going to do is, while Windows 7 guest VM is working in my desktop host, I will migrate it to laptop computer without any downtime by VirtualBox teleporting.

Basic Requirements for VirtualBox Teleportation

1) Both hosts should run VB 3.1 or later versions.
2) Both virtual machines in target and source must share same storage disk.
3) Target and source virtual machines should be configured with very similar configuration, such as processor settings, memory, display memory, storage type..etc.
4) VMs with snapshots will fail. So delete any snapshots. Both host computers must have very similar type of processors. Intel to AMD processor live migration may fail.

Simple Steps to Setup VirtualBox Teleportation in Normal PC

1) Before start setting up source or target machines, we need to setup common storage where both hosts can access over network. I installed FreeNAS as one VM in desktop and setup iSCSI disk storage. Read more here to install and setup FreeNAS iSCSI disks in VirtualBox.
2) Add iSCSI disk to VirtualBox media manager. We have to select this disk to install Windows 7 guest VM ( Source VM)
Read more here to add iSCSI disks to VM media manager.
3) Create a new VM Windows 7, select ‘existing disk’ option and select iSCSI disk from media manager which we added in previous installation.
in this example win7_1 is VM name ( Source)
iSCSI FreeNAS Storage IP is 10.10.11.250
Desktop Host IP is 10.10.11.11
Test VirtualBox Teleportation Normal PC
Continue and complete the installation.
4) Start the VM, install some programs and open them. So once this virtual machine migrated to laptop computer, we can cross check.
5) Now go to target machine (which is my laptop). Here also we have to create a virtual machine, but installation is not required. Make sure this host can communicate to FreeNAS iSCSI server. Add iSCSI disk to VB media manager as you did earlier. Create a new VM Windows 7, select existing disk option and select same iSCSI disk.
in this example win7_2 is VM name ( Target)
Laptop Host IP is 10.10.11.10
6) Make sure settings of this win7_2 (Target) exactly matching win7_1 (source).
7) Do not start this target virtual machine. We will execute a command to wait for teleport.
Type following command in target (Laptop) computer.
VBoxManage modifyvm < targetvmname> –teleporter on –teleporterport
My command is
VBoxManage modifyvm win7_2 --teleporter on –teleporterport 1234
Win7_2 – Target VM which will be waiting for teleport to arrive
1234 – Port is listening on host computer for teleport arrivals.
8) Now start target VM. One small progress box will pop and wait for teleportation, as shown below.
Test VirtualBox Teleportation Normal PC
9) Go to source computer (desktop), let’s send win7_1 source virtual machine to laptop by live migration. Issue the following command while VM is working.
VBoxManage controlvm teleport –host –port
My command is,
VBoxManage controlvm win7_1 teleport --host 10.10.11.10 --port 1234
win7_1 – source VM, migrating to laptop (target) computer
10.10.11.10 – Target host (Laptop) computer IP address
1234 – The port number waiting for teleportation arrival.
10) Teleporting screen changed as shown below in target laptop.
Test VirtualBox Teleportation Normal PC
11) Successful teleporting command will return 100% completion in source machine command prompt.
Test VirtualBox Teleportation Normal PC
Also, source machine VM state changed to ‘teleported’.
Test VirtualBox Teleportation Normal PC

VirtualBox Teleportation Failed for me

Because of previous successful screenshots, don’t think I succeeded in first try of live migration in VirtualBox, it failed for me several times.
1) Teleportation failed in VirtualBox 3.2 with some errors. I didn’t waste my time to fix it or find out the reasons. Directly I installed VB 3.1.6 on both hosts. This solved my issue.
2) I missed to remove floppy drive controller in target VM.
3) Network connection type was different in both VMs. NAT and Bridged, I changed both types identical.
4) Removed the CD Rom controller. Either makes it empty or you must share common CD between both hosts.
5) Source VM storage type was SATA and target was IDE. It failed for me.
6) My Laptop host processor is not having VT. So, when source VM is enabled with VT and Nested paging live migration failed because of VMs processor mismatch. I disabled VT and Nested paging in source VM
After fixed above issues in VirtualBox, teleportation worked fine and quickly. My working Windows 7 VM migrated to different host within 5 seconds. It’s really cool.
It’s amazing, a 80MB piece of software does the live migration between different hosts very nicely without any down time.
Have you tried this in production environment? Or after this post at home? Share with us the problems you faced and how fixed them. Also, don’t miss to drop a comment if this post useful for you in VirtualBox teleportation.