Uploading VMs to vCloud with OVFtool

VMware’s OVFtool is a command line tool that allows you to convert VMware Virtual Machines to Open Virtualization Format, or OVF. In the latest version, it can also upload VMs to vCloud Director for you as well!

To do this, OVFtool simply requires a source (VMX or OVF), and a destination (a vCloud Locator).

The vCloud locator looks something like this:

vcloud://username:password@host:port?org=name_of_org&vapp=name_of_deployed_vapp&catalog=name_of_catalog&vappTemplate=name_of_vapp_template_in_catalog&vdc=name_of_vdc

As you can see, the vCloud Locator is a URL with all of the information needed to upload your OVF.

Because OVFtool is run from the command line, the simple choice when using Windows is to use the command prompt. Using the Windows command prompt, however, results in errors when uploading to vCloud Director:

ovftool error

ovftool error

This is most likely because of the special characters ovftool uses in the URL (&, :, ?, @). If I had to guess, I’d say it’s the ampersand.

I tried quoting out the vCloud Locator several different ways to get it to understand, but resorted to Powershell to save the day once again.


$vCloudLocator = "vcloud://jake:password@vcloud.example.com:443?org=jake&vappTemplate=MyTemplate&catalog=private"

$sourceFile = "C:\jake\MyVM.vmx"

$ovftool = "C:\Program Files\VMware\VMware OVF Tool\ovftool.exe"

& $ovftool $sourceFile $vCloudLocator

Powershell treats the characters are part of the string, so we just simply pass the string as a parameter to OVFtool.

Hope this saves someone a headache! :D

For more OVFtool fun, check out my post on using OVF tool with PowerCLI with your vSphere session!

About these ads

6 Responses to “Uploading VMs to vCloud with OVFtool”

  • Michael Yakobi

    Following my tweets regarding setting VMX options such as pciHole.start as an org-admin, I was wondering if I upload a VMX with these ExtraConfig will this get through?
    Thanks again,
    Michael

    • Jake

      Unfortunately you can only upload a VM in OVF, not VMX. The only way to accomplish this in the public cloud is for a provider to make the changes.

      • Michael Yakobi

        Gotcha… Thanks.
        One of the provider suggested I’ll use “vCloud Connector” – will give it a try though its far too complex for what I wanted to do…

      • Jake

        Don’t waste your time. It’s not going to work. :) vCloud connector converts to OVF during the transfer process.

      • Michael Yakobi

        Glad I asked before I spent so much time setting up the vCloud Connector…
        Thank you very much.

  • Gavin

    In Windows, & is used for additional commands. You must use ^ to escape the &.

    vcloud://username:password@host:port?org=name_of_org^&vapp=name_of_deployed_vapp^&catalog=name_of_catalog^&vappTemplate=name_of_vapp_template_in_catalog^&vdc=name_of_vdc

    But then I kept running into this.

    Error: cURL error: Couldn’t connect to server
    Completed with errors

    I’ll stick with powershell too :-)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 957 other followers

%d bloggers like this: