WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud
  • Tanzu
    • Application Modernization
    • Tanzu services
    • Tanzu Community Edition
    • Tanzu Kubernetes Grid
    • vSphere with Tanzu
  • Home Lab
  • Nested Virtualization
  • Apple
You are here: Home / Automation / How to Deploy an OVF Located On ESXi Datastore Using ovftool

How to Deploy an OVF Located On ESXi Datastore Using ovftool

03.11.2012 by William Lam // 43 Comments

I have written several articles in the past about the awesome ovftool which is a versatile remote command-line utility for importing/exporting virtual machines in the OVF format across various VMware products. I mainly run ovftool in either the vMA or on my OSX desktop. When performing an import, the OVF files are local on the same system that has the ovftool installed.

I recently came across an interesting question about using the ovftool to deploy OVF files that are located on an ESXi datastore. My initial thought was that you would not be able to deploy the OVF files since the ovftool would not have access to the files locally. After finishing a recent article about ESXi datastore management using the vCLI's vifs utility, I then realized there might actually be a way to deploy OVF files that are stored on an ESXi datastore.

If you take a look on page 17 of the ovftool user guide, there is a table describing the various source locators that are supported. You can see that the source of an OVF file can be accessed by ovftool in 4 different methods including HTTP/HTTPs which is a key for this specific request.

Source Type Default File Extension Protocol
OVF .ovf File, HTTP, HTTPS, FTP
OVA .ova File, HTTP, HTTPS, FTP
VMX .vmx File
vvApprun N/A File
vCloud Director N/A HTTPS
vSphere N/A vSphere

Files and folders management for a datastore is exposed through the fileManager in the vSphere API and datastores are referenced as a URL or remote path.

A URL has the form

scheme://authority/folder/path?dcPath=dcPath&dsName=dsName

where

  • scheme is http or https.
  • authority specifies the hostname or IP address of the Center or ESX(i) server and optionally the port.
  • dcPath is the inventory path to the Datacenter containing the Datastore.
  • dsName is the name of the Datastore.
  • path is a slash-delimited path from the root of the datastore.

Putting all this together, you can use the ovftool remotely to deploy an OVF file that is stored on an ESX(i) datastore. Below is an example walk through of this process.

Here is an OVF that is stored on a datastore located on an ESXi host:

To identify the URL path to your OVF, you can use a web browser to assist. Point your browser to the following address: https://[ESXI_HOST]/folder

When you first login, you will be brought to the root datacenter, in the case of directly connecting to an ESX(i) host, you will only see "ha-datacenter". Go ahead and select it and then you will be brought to a list of datastores the host has access to.

Select the datastore which contains the OVF file you wish to deploy from and then browse to the specific file.

Make a note of the URL path used to get to the OVF file and the OVF filename itself. Taking the example above, we end up with the following URL path:

https://vesxi50-4.primp-industries.com/folder/MyVM/MyVM.ovf?dcPath=ha-datacenter&dsName=iSCSI-1

To confirm the URL path, we can use ovftool to perform a simple "probe" on our OVF, this will provide you with a quick summary of the OVF.

Next we are ready to import the OVF file to our ESXi host. In this example, we will deploy the OVF to another datastore the ESXi host has access to and configure a specific portgroup to connect to the VM to after deployment. There are various options that can be passed to ovftool, please refer to the ovftool user guide for more details.

One the import has completed, you should now see the VM automatically registered in your ESXi host inventory.

You can see that this method allows you to import an OVF file stored on a datastore locally to the ESXi host as well as an OVF file stored on a remote datastore of another ESXi host. To help manage and deploy your OVF files, you should consider storing them on a centralized "media" datastore or even a WEB/FTP server that can be accessed by the ovftool.

More from my site

  • Quick Tip - Import OVF/OVA as VM Template using OVFTool 4.3 Update 1
  • Default hashing algorithm changed in OVFTool 4.2 preventing OVF/OVA import using vSphere C# Client
  • Heads Up: OVF/OVA always deployed as Thick on VSAN when using vSphere Web Client
  • Caveat when deploying Photon Controller Installer (v0.8) OVA to vCenter Server
  • How to deploy and run the VSAN 6.1 Witness Virtual Appliance on VMware Fusion & Workstation?

Categories // Automation, OVFTool Tags // ova, ovf, ovftool

Comments

  1. Unknown says

    03/30/2012 at 5:15 am

    This is great. I don't know if you tried, but I took the VIC client directly to the ESXi host and attempted to deploy ovf/ova and inserted the https url indicated above. I got an error message but assumed it was my ova, because I also got an error message with ovftool 2.1 (win32) and the same ova/ovf.
    oh well thanks!
    v pham

    Reply
  2. Anonymous says

    11/02/2012 at 1:36 pm

    Actually, just found that if you paste the URL into the 'deploy ovf/ova' window of the vSphere client, it works as well, so no need for installing additional tools. 🙂

    Reply
    • William says

      11/05/2012 at 10:00 pm

      Yes, you can use the vSphere Client but the article was specific to using ovftool via the CLI 🙂

      Reply
      • Sachin says

        11/21/2014 at 1:09 pm

        Hi William,

        I am looking for command-line for exporting a VM on ESXI.
        I do not have vcenter server installed.
        Thanks in advance,
        Sachin

        Reply
    • Anonymous says

      11/22/2012 at 11:59 am

      I am using this method, but speed is too low. I am connected to ESX via remote vsphere-client. I guess, using this way, first .ova file is coming to my client and then getting deployed back into esx. Speed is equivalent to the method when I deploy the ova from my local system.

      Could it be not possible to deploy the ova file there itself.

      Reply
  3. Anonymous says

    11/03/2012 at 4:45 pm

    I was not able to do this...I was prompted for a username and password after entering the URL. The root user and password that I use for my ESX host was not accepted though.

    Reply
    • Anonymous says

      02/20/2013 at 11:49 am

      Disable lockdown mode on your ESXi host.

      Reply
  4. laura says

    11/27/2012 at 6:38 pm

    I am getting the error "Error: Curl error: URL using bad/illegal format or missing URL"

    [email protected]:~> ovftool "https://192.168.1.205/folder/MyVM.ovf?dcPath=ha-datacenter&dsName=local-datastore" "vi://[email protected]:443/"
    Please enter login information for source https://192.168.1.205/folder/
    Username: root
    Password: **********
    Opening OVF source: https://192.168.1.205/folder/MyVM.ovf
    The manifest validates
    Please enter login information for target vi://192.168.1.205/
    Username: root
    Password: **********
    Error: Curl error: URL using bad/illegal format or missing URL
    Completed with errors

    Any ideas? Thanks!

    Reply
    • laura says

      11/27/2012 at 6:50 pm

      Figured it out, it was because my ESXi password had special characters. Changed the ESXi password and it works fine. What a crappy error message 🙂

      Reply
    • Anonymous says

      05/29/2013 at 8:04 am

      Laura,

      You can convert any special characters in the username and password to "URL-Safe" characters,
      for example:

      ' ' should be written as '%20' (blank)
      '!' should be written as '%21'
      '\' should be written as '%5C'

      You can actually convert ALL characters in the username and/or password to "URL-Safe" characters,
      just to make sure you have a valid identifier for the ovftool.

      Reply
  5. TheBashar99 says

    12/24/2012 at 11:33 pm

    When I try to use an OVA in this method, I get "Error: Failed to open OVF descriptor". If I use the OVA in the viclient it works fine. If I use the https address in the vSphere Web Client, I get the descriptor error. If I use a local browse file path in the web client, it works fine.

    Am I missing something? I'd like to use the ovftool since it allows me to specify the new seSparse disk format.

    Reply
    • Homeless says

      07/02/2013 at 10:40 am

      same proble, did'u find solutions?

      Reply
  6. Anonymous says

    06/10/2013 at 11:26 pm

    I had troubles with --net: syntax, it just kept complaining about

    --net:Centos-6.3-amd64%20%28aa22b2ce-1e1e-4888-8b26-27a9396a1519%29=VM%20Network
    Error: Invalid OVF name (Centos-6.3-amd64%20%28aa22b2ce-1e1e-4888-8b26-27a9396a1
    519%29) specified in net mapping. OVF networks: . Target networks: 10.4.2.x Ne
    twork 10.4.3.x Network 10.4.7.x Network VM Network
    Completed with errors

    I tried "." for OVF name, tried the full text, tried "VM%20Network" as the target, as well as " " in there - none of them worked.

    I tried without the --net, which also completed with errors, yet did not create the target object VM.

    Reply
  7. Jerome Ortega says

    07/29/2013 at 2:19 am

    You could enclose everything after net: with double quotes. for example:

    -net:"Internal=VM Network 2" --net:"External=VM Network 3" --net:"Management Network=VM Network"

    I have also encountered "Error: SHA1 digest of file .* does not match manifest". A workaround is to enable --skipManifestCheck switch.

    Reply
    • Anon says

      03/05/2015 at 9:05 am

      Regarding the problems with "--net", I had the same. For me it worked out to switch the order of your assignment like:

      -net:"VM Network 2=Internal"

      Reply
  8. Patrik Nordlund says

    12/11/2013 at 9:52 am

    Hi,
    I get to the login section, when I press after username:root,
    I just get stars (******************************************) filling the terminal window. Anyone seen this?

    Reply
    • Patrik Nordlund says

      12/11/2013 at 10:12 am

      Actually, now I see that it seems like I keep holding a key and flooding the password entry like this:
      Username: root
      Password: ****************************** etc until I press

      Reply
      • Christophe says

        06/18/2015 at 1:24 pm

        I have the same result (Password:**************** etc until I press CRTL+C
        Somebody have a solution ?

        Reply
        • Vishal says

          09/16/2019 at 11:30 pm

          you have to verfiy password and username as in powershell scripting some character have special meaning for example ! = %21 and Please verify you credential.

          Reply
  9. Peter Milanese says

    01/06/2014 at 3:05 pm

    I'm finding that the login window keeps popping up as if the credentials are not good, even though I am able to login and browse the datastore via a browser. Lockdown is disabled, obv. Any idea?

    Reply
  10. Filip says

    05/19/2014 at 7:12 pm

    OMG finally I found what I was looking for! Thank you for this article

    Reply
  11. brink668 says

    06/13/2014 at 3:19 pm

    Can you do this on a free ESXi Host? I keep trying this from putty and it says the OVFtool is not found although I installed the msi for 64bit based machines.

    Reply
    • William Lam says

      06/13/2014 at 4:12 pm

      Not sure, you'll have to try. ovftool should not be running inside ESXi, it's supposed to be installed from a remote system either Windows/Mac/Linux. Please refer to the ovftool documentation for more details on installation

      Reply
  12. peter says

    11/30/2014 at 4:30 pm

    This is for importing. Can you give the syntax for exporting to a local datastore?

    Reply
  13. saurabh says

    03/07/2015 at 6:49 pm

    HI,
    This article is really awesome.
    I need help on similar stuff.I am trying a little different usage of OVF toll.I successfully deployed PSC thon ESX e using ovf build deploy on a linux VM. Now I am trying to run UPGRADE that.

    I tried below command line but no luck

    ovftool –ds=datastoreName –acceptAllEulas "source url of ovf of higher version i.e. http://...abc.ovf" "target ie.vi://user:[email protected] of machine/"

    If you can provide some input that will be of great help.

    Thanks in advance

    Reply
  14. Anonymous says

    07/29/2015 at 6:55 pm

    Has anybody tried accessing VM inside Esxi5.5 host.
    I am always getting Error while probing OVA inside datastore.

    ovftool.exe "https://myVMhost.com/folder/VM/myVM.ova?dcPath=ha-datacenter&dsName=datastore1"
    Username: root
    Password: *******
    Error: Failed to open OVF descriptor

    Reply
    • Anonymous says

      07/29/2015 at 10:31 pm

      worked with following option:
      ovftool.exe -st=ova “https://myVMhost.com/folder/VM/myVM.ova?dcPath=ha-datacenter&dsName=datastore1″

      Reply
      • Simon Tremblay says

        08/20/2015 at 1:40 pm

        Thank you for that answer it fixes same problem here with vSphere 6.0.

        Reply
  15. Kris says

    10/30/2015 at 6:48 am

    This is great! I've spend the best part of the day looking for this information. Thanks so much for sharing this!

    Reply
  16. bhawani says

    07/14/2016 at 1:41 am

    Hi,

    I am getting error o vSphere client after deploy the OVF file from ESXi datastore.

    The remote server returned an error 503 server unavailable vmware .

    Reply
  17. Sasikumar says

    10/21/2016 at 12:02 am

    Directly using the URL is also able to deploy, but i was trying URL wrongly. after seeing this areticle realized that we need to get the OVA url exactly (just rick-click on the ova copy link adress and re-use in Vsphere client) 🙂

    Reply
  18. ajju says

    03/06/2017 at 8:47 pm

    When I try deploying to a free host like so:

    ovftool --sourceType=ova --datastore="myds1" --name="vm-base" vm.ova "vi://root:@hostname"

    it fails with the same cURL error like above:
    Error: cURL error: SSL connect error

    However when I try doing the exact same thing on a different host it works without any issues
    ovftool --sourceType=ova --datastore="myds1" --name="vm-base" vm.ova "vi://root:@hostname1"

    What could be the error?

    Reply
    • ajju says

      03/06/2017 at 8:53 pm

      For the record, just in case you miss it, my ESXi host has no password whatsoever, in case that is not explicit from the string above so the question of 'special characters' in the password shouldn't arise.

      Reply
  19. Cameron Lopez says

    01/10/2018 at 1:30 pm

    If a url is provided does the traffic for the ova upload remain between the esxi host and the file server?

    Reply
  20. Cantique says

    01/18/2019 at 2:02 pm

    In this case, what's the data path? For example I have source and destination esxi:datastore far away from my ovftools workstation, will the data travel from source esxi to ovftools and then destination esxi?

    Reply
  21. Arik says

    05/18/2019 at 12:10 pm

    The interesting part is that the files is actually downloaded to your PC and than uploaded back.
    Which makes this a bit obsolete...

    Reply
    • Peshou says

      03/25/2020 at 2:18 am

      Thanks for sharing ! quite important to know that

      Reply
  22. Techno-Phobe says

    08/11/2020 at 4:08 am

    I know it's an old but great article but thought I'd leave a comment in case anyone else cannot get the OVFTool to work on ESXi 6.5.

    I couldn't get the latest OVFTool version (4.4.0 P1) working on ESXi 6.5 build 16207673 initially but got round it by installing the 32-bit Linux version 4.1.0 package on to a CentOS 7 VM.

    I then followed the article steps and now I deploy OVFs to my ESXi hosts in my home lab using Puppet Bolt !

    Reply
    • Jose says

      10/22/2020 at 1:36 pm

      How do you find the url path in ESXi 6.5? Or how do you point to local datastore?
      Thanks.

      Reply

Trackbacks

  1. Quick Tip – Useful ovftool debugging options | virtuallyGhetto says:
    03/16/2014 at 6:11 pm

    […] morning I needed perform several OVF uploads using ovftool and provide that information to engineering to investigate some performance issues. I tend to error […]

    Reply
  2. [VMware] 從 datastore 上匯入 OVA 檔案 – EPHRAIN 亂打一通的心情日記 says:
    05/10/2017 at 1:01 pm

    […] 研究了一下,在 virtuallyGhetto 上找到了一個解決方式~ […]

    Reply
  3. [VMware] 從 datastore 上匯入 OVA 檔案 | EPHRAIN 亂打一通的心情日記 says:
    08/31/2017 at 12:42 pm

    […] 研究了一下,在 virtuallyGhetto 上找到了一個解決方式~ […]

    Reply
  4. Automating My Home Lab Part 1 | Lost-it.org says:
    08/11/2020 at 5:01 am

    […] stumbled across the article How to Deploy an OVF Located On ESXi Datastore Using ovftool on virtuallyghetto.com and after a bit of fiddling, I got it working so enter the OVFTool. Below […]

    Reply

Thanks for the comment! Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Search

Author

William Lam is a Senior Staff Solution Architect working in the VMware Cloud team within the Cloud Infrastructure Business Group (CIBG) at VMware. He focuses on Cloud Native technologies, Automation, Integration and Operation for the VMware Cloud based Software Defined Datacenters (SDDC)

Connect

  • Email
  • GitHub
  • LinkedIn
  • RSS
  • Twitter
  • Vimeo

Recent

  • How to enable passthrough for USB Network Adapters claimed by ESXi CDCE Driver? 03/30/2023
  • Self-Contained & Automated VMware Cloud Foundation (VCF) deployment using new VLC Holodeck Toolkit 03/29/2023
  • ESXi configstorecli enhancement in vSphere 8.0 Update 1 03/28/2023
  • ESXi on Intel NUC 13 Pro (Arena Canyon) 03/27/2023
  • Quick Tip - Enabling ESXi Coredumps to be stored on USB 03/26/2023

Advertisment

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Copyright WilliamLam.com © 2023