By: Mike Roy, Technical Marketing Manager at VMware
So, you may have heard that my team at VMware launched the ‘vCloud Hybrid Service.’ It’s pretty exciting, and the way we built it gives instant value to existing VMware customers by allowing them to easily migrate their VMs to the cloud without having to completely rebuild them, or learn a whole new paradigm of how to do IT and deliver infrastructure.
In that vein, the service supports any workload that runs on VMware hypervisor technology, from ESXi/vSphere, all the way up to Fusion and Workstation, making it pretty easy to build a VM locally and then ‘push’ that to the Cloud with minimal tweaking.
In this post, I’ll show the process to migrate a VMware Fusion based Virtual Machine to vCloud Hybrid Service (‘vCHS’ for short). There are some subtle differences between how a Fusion VM works and how a VM that’s living in vCHS needs to behave.
So, cool, but, why do this?
There are several use-cases here. Develop an app locally, and then push to the cloud to make it public. Maybe you want a cloud-backup of an important VM. Maybe you create a standard template and then just clone it in the Cloud. As you can see, there are many reasons why you would want to migrate a Fusion VM to the cloud.
So with that said, let’s get started!
To start off I created a VM using Fusion. In this case it was a simple Ubuntu 12.04 LTS VM after a fresh install.
I was sure to install VMware Tools while it’s still in Fusion, as Tools is the same regardless of what the host is, just some features are enabled or disabled depending on that host.
So, here’s my VM, with Tools installed, running in Fusion.
First thing we do is power the VM off. Once the VM is powered off, we need to adjust some of its settings while it’s still in Fusion to remove the components, which won’t work in the cloud.
Firstly, let’s turn off the CD drive.
Second, we’ll disable any encryption. It’s best if the VM was never encrypted in the first place, but if it is encrypted, it will work if you decrypt it.
Turn off 3D Graphics.
Shared Folders should be disabled as well. If you used this, be sure to disable it while the VM is running, so it removes the mount points (or network drives for Windows).
Of course you want to remove the sound card!
And the printer as well.
Make sure to keep the VM at Hardware Version 9. It will also support older versions but I wouldn’t go back beyond version 7.
So with all that done, now we need to convert the VM to the Open Virtualzation Format or OVF ,so it’s fully compatible with the vCloud environment. To do this, we use the ‘ovftool’ which comes bundled with VMware Fusion. The command-line only app lives within the VMware Fusion application itself, so you have to know how to reference it properly and how to tell it what to do.
Thankfully, ovftool only does 1 thing by default… Export as OVF.
So, the command I had to run is the following (on one line):
/Applications/VMware\ Fusion.app/Contents/Library/VMware\ OVF\ Tool/ovftool /Users/mike/Documents/Virtual\ Machines.localized/Ubuntu-Fusion.vmwarevm/Ubuntu-WP1.vmx /Users/mike/Documents/Virtual\ Machines.localized/Ubuntu-Fusion-OVF.ovf
To break that down…
<path to ovftool> <path to .vmx> <path to .ovf output>
First part is the path to the tool itself.
/Applications/VMware\ Fusion.app/Contents/Library/VMware\ OVF\ Tool/ovftool
On a Mac, / denotes a file structure, whereas \ is an escape character needed in front of spaces in a file path (since Unix command line interfaces don’t handle spaces the same way that the UI of Mac OS X does…). So, it’s actually:
Applications > VMware Fusion.app > Contents > Library > VMware OVF Tool > ovftool
Second part is the path to the .vmx file. Terminal supports this really neat feature where you can drag a file onto it and it will spit out that file’s path. So, I typed in the path to the ovftool, then just dragged my .vmx from Finder into Terminal.
I got to the VMX by right-clicking the VM in Fusion and clicking ‘Show in Finder’. Then I right-clicked the VM in Finder and clicked ‘Show Package Contents’. From there I just dragged the .vmx file into Terminal and it spit out the path. Make sure you have a space after the ofvtool string though.
Then it’s just a matter of spitting out the location where you want the ovf and other files to end up. I made a folder and used that.
If the VM is on an SSD, this goes pretty quick.
Once the conversion is done, you’re left with a few files… The OVF file, the .vmdk (virtual disk) and a .mf file (which is just checksum data to ensure the integrity of the files).
Screenshot of the ofvtool output is above.
Now we should have our OVF package ready to upload to vCHS. To do this, we need to get to the vCloud Director interface of vCHS, and specifically the Catalog Management area. From the Portal, there’s a handy button to get right to vCD.
The Java-based upload tool is what we’ll use to actually upload our .ovf.
When we use this tool, it asks us for permission to run the Java apple – so we say ‘Yes’ and then choose our .ovf file.
Give it a description so you know what this is.
Progress indicators, indicating progress!
After upload, Importing to the Catalog.
Once complete, the VM should now live as a ‘Template’ in our ‘Catalog.’ From here, standard vCD operations begin. We want to ‘Add’ the VM to ‘My Cloud’ to deploy it.
Time to Cloud!
This process starts a workflow/dialog that we need to step through so the VM lands safely in your “My Cloud.”
Do not choose NAT!
We can step through the first screen, or change the resources. On Networking, however, we have to change the NIC to Network mapping. Since ‘Cloud’ doesn’t have the VMware Fusion ‘NAT’ network, we have to pick one that exists in this environment. In this case I’m picking my default routed network.
Step through the confirmation screen and click ‘Finish’ to kick it off.
When the Deployment / Creation finishes you are in business!
One thing to note is that thanks to VMware Tools being installed, the new cloud environment forces a password change, so make sure you know where to get that so you can log into the VM! (Hint: It’s in the VM Properties > Guest OS Customization screen, and also in the vCHS Portal itself on the VM’s Settings page).
So, once logged in, I like to make sure networking works before calling it a day…
And there you have it!
In a few steps we took a VM in Fusion, exported it using OVFTool, uploaded it using the Java Upload tool directly into our vCD Catalog in vCHS, and deployed it.
Cool stuff, right?
Michael Roy is the Technical Marketing Manager for vCloud Hybrid Services at VMware. He guides product roadmap and messaging, produces and presents technical collateral, and works across teams to refine product integration strategy. Michael has been with VMware since 2009, and recently relocated to the Palo Alto headquarters.
For more information about the VMware vCloud Hybrid Service, visit vCloud.VMware.com.