Migrate a VMware Fusion VM to vCloud Hybrid Service

Hiyas!

I thought I’d get creative with my blog here and try and combine 2 worlds that I live in…

By day I am a Technical Marketing Manager for VMware Cloud Services, and by night I’m a VMware Fusion aficionado, among other things.  It just seems natural that I try and bring those two worlds together from time to time.

So, you may have heard that my team at VMware launched this “cloud thing” that we lovingly call ‘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 VM’s 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, what I’ll do is describe 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.

I’ll probably follow up with how to do this using VMware Workstation, but the process is so simple there it is almost trivial for anyone using Workstation who is familiar with vSphere. (i.e. export as OVF… upload to cloud… and done!)

So, cool… but… Why do this?

There’s several use-cases here.  The first that comes to my mind is to develop an app locally on a VM, 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.  There’s many reasons,  but for me it’s good enough to say ‘Because I Can’ =)

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 also installed WordPress using apt-get, just for kicks). 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.

FUUUUUUUUUUsionSo, here’s my VM, with Tools installed, running in Fusion… Fancy…

  First thing we do is power the VM off, naturally. Once the VM is powered off, we need to adjust some of it’s settings while it’s still in Fusion to remove the components which won’t work in The Cloud.

56Firstly, let’s turn off the CD drive

53Second, 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.

 

58Turn off 3D Graphics… cuz, well, clouds don’t have that… (whether they should is a different matter!)

59Shared 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)  

54Of course you want to remove the sound card!

49For the love of Pete get that printer away!

48Make 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.

Console Warriors Unite!

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 fancy 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 tho 😉 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)

ofvtool output

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.

72From the Portal there’s a handy button to get right to vCD… There’s got to be a ‘now you’re thinking in portals’ joke here somewhere…

76

The Java-based upload tool is what we’ll use to actually upload our .ovf

When we use this tool, it asks us permission to run the Java applet… so we say ‘Yes’ and then choose our .ovf file

Pick the .ovf file… magic ensues…

Give it a description so you know what this is… I mean, or don’t, it’s your life!

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” (your my? oh my…)

No, NAT… No…

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 int his environment.

In this case I’m picking my default routed network.

Step through the confirmation screen and click ‘Finish’ to kick it off.

Deploying a Fusion VM in the Cloud… SOOOO Meta!!

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)

My password ink was wet and it smeared all over the place…

So, once logged in, I like to make sure networking works before calling it a day…

To Ping or not to Ping…

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?  Right.  That, my friends, is how we Cloud =)

Getting Started with VMware Fusion: Get your copy today!

I’m proud to say that my first book has finally been published!

In it, I pulled from the experiences I had  during my days leading the Fusion support team, taking years of experience and bringing to readers some of the best tips and tricks I learned along the way.

This short eBook, Getting Started with VMware Fusion,  helps users get the most out of their VMware Fusion investment.  We get started by learning how to install Windows 8 from scratch without needing any physical media.

We then talk a bit about how to import a physical PC, and also importantly, how to take care of a new Virtual Machine to keep it safe.

I even do a fun bit about snapshots, explaining their great uses and how they work under the hood so users know how handle them properly, and also some tricks for using Linked Clones in VMware Fusion Professional.

Getting Started with VMware Fusion will help readers to get started running Windows on their Mac the right way by providing practical examples of how to keep a Virtual Machine secure, backed up, and running smoothly.

I’m fortunate to have had the help of a great support and release team at Packt Publishing, putting up with my busy schedule!

Download your copy today using the link below!

 

http://www.packtpub.com/getting-started-with-vmware-fusion/book

Getting Started with VMware Fusion
Getting Started with VMware Fusion