VMware Cloud Community
BhushanP
Contributor
Contributor

Create OVF/OVA via ovftool

Hi,

I have a ESXi 5.0 server running which has a Guest VM running CentOS 5.6.

The ESXi server is a standalone server, not included in a datacenter, not managed by vCenter.

The server has a HDD of 80G which has both the ESXi host & the Guest OS running on top of it.

I installed ovftools on my Windows laptop & tried to create a ovf from the VM but am unsuccessful. I constantly get the following error -

c:\>ovftool vi://root:<rootpassword>@<ESXi Host IP>/datastore1/CentOS c:\testVM.ovf

Error: Cannot parse locater: vi://root:<rootpassword>@<ESXi Host IP>/datastore1/CentOS

Completed with errors

The local datastore name is "datastore1"

Can someone help me out here with forming the correct the ovftool command to create an ovf & possibly an OVA out of the running VM?

Thanks

Bhushan Pathak

Thanks Bhushan Pathak
32 Replies
BhushanP
Contributor
Contributor

Missed one point earlier - the name of the Guest VM is CentOS

Thanks Bhushan Pathak
Reply
0 Kudos
kjb007
Immortal
Immortal

Get rid of the datastore, and enter only the name of the VM:

ovftool vi://root:<rootpassword>@<ESXi Host IP>/CentOS c:\testVM.ovf

-KjB

vExpert/VCP/VCAP vmwise.com / @vmwise -KjB
BhushanP
Contributor
Contributor

Hi KjB,

Thanks for your reply.

I tried the command you suggested -

ovftool vi://root:<root password>@<ESXi Host IP>/CentOS c:\testVM.ovf

Unfortunately, I still get the same error -

Error: Cannot parse locator: vi://root:<root password>@<ESXi Host IP>/CentOS

Completed with errors

Are there some debug options that I can try & post the debug output here, if I  don't get it with the output?

Thanks

Bhushan Pathak

Thanks Bhushan Pathak
Reply
0 Kudos
kjb007
Immortal
Immortal

Maybe something with your passwrod, try and let it prompt for username and password.

ovftool vi://<ESXi Host IP>/CentOS c:\testVM.ovf

-KjB

vExpert/VCP/VCAP vmwise.com / @vmwise -KjB
Reply
0 Kudos
BhushanP
Contributor
Contributor

I tried as you suggested -

ovftool vi://<IP address>/CentOS c:\test.ovf

The tool prompted me for username & password, which I entered correctly. This time, I got a different error -

Error: Curl error: URL using bad/illegal format or missing URL

Completed with errors

How does the tool create the Curl URL from inputs? Any chance the error is related to the password that messes up the URL? I have set the passwor to something complex [includes upper & lower case characters, numbers & hash characters - # ]

Thanks

Bhushan Pathak

Thanks Bhushan Pathak
Reply
0 Kudos
kjb007
Immortal
Immortal

That should not make a difference, ESX should accept those characters.  You could set your pw temporarily to something else to be sure.

Put your source locator in quotes to be sure.

-KjB

vExpert/VCP/VCAP vmwise.com / @vmwise -KjB
Reply
0 Kudos
pranav0386
Contributor
Contributor

you can try this

ovftool vi://username@<IP address>/ c:\test.ovf

first OVFtool will you prompt you fot password

then  when it connects to the server ovftool will show you possible  completions. That is what all it sees under the sepcified ESX host.

The path is usually of the form

host/<resource pool path>/<vm or vApp name>

hope this helps

Pranav

Reply
0 Kudos
BhushanP
Contributor
Contributor

KjB,

I will try again after changing the password. This will take some time, will post my findings tomorrow.

Thanks for your help, appreciate it.

Bhushan

Thanks Bhushan Pathak
Reply
0 Kudos
BhushanP
Contributor
Contributor

Pranav,

I tried you suggestion, still get the same error -

Error: Curl error: URL usig bad/illegal format or missing URL

Completed with errors

Any other ideas? Thanks for you help

Bhushan Pathak

Thanks Bhushan Pathak
Reply
0 Kudos
kjb007
Immortal
Immortal

Ok, so # is allowed, I just confirmed, so when you type it interactively, you sould not have an issue.

Make sure the vm name is correct in case, or you will get an error as well, although I received an error stating the object does not exist.

-KjB

vExpert/VCP/VCAP vmwise.com / @vmwise -KjB
Reply
0 Kudos
kjb007
Immortal
Immortal

Maybe it's the destination locator then, try ending with just "test.ovf"

-KjB

vExpert/VCP/VCAP vmwise.com / @vmwise -KjB
Reply
0 Kudos
BhushanP
Contributor
Contributor

Hi KjB -

I tried providing just the target locator as test.ovf, still the same results -

ovftool "vi://root:<password>@<IP>/CentOS" test.ovf

Error: Cannot parse locator: vi://root:<password>@<IP>/CentOS

Completed with errors

ovftool "vi://root@<IP>/CentOS" test.ovf

I enter the password when prompted for it, & get the following error -

Error: Curl error: URL using bad/illegal format or missing URL

Completed with errors

I verified that my VM name is correct.

Thanks

Bhushan Pathak

Thanks Bhushan Pathak
Reply
0 Kudos
kjb007
Immortal
Immortal

What version of ovftool.exe are you using?

ovftool.exe -v

-KjB

vExpert/VCP/VCAP vmwise.com / @vmwise -KjB
Reply
0 Kudos
BhushanP
Contributor
Contributor

VMware ovftool 2.1.0 (build-467744)

Thanks

Bhushan Pathak

Thanks Bhushan Pathak
Reply
0 Kudos
kjb007
Immortal
Immortal

That's the same version I have as well.  Let's see if incorrect information gives a different error.

Try:

ovftool "vi://1.1.1.1/centos" test.ovf

ovftool "vi://<esxIP>/cen" test.ovf

-KjB

vExpert/VCP/VCAP vmwise.com / @vmwise -KjB
Reply
0 Kudos
BhushanP
Contributor
Contributor

Attempt 1 with incorrect IP -

ovftool "vi://1.1.1.1/CentOS" test.ovf

Error: Curl error: Couldn't connect to server

Completed with errors

Attempt 2 with correct IP but wrong VM name -

ovftool "vi://<correctIP>/myVM" test.ovf

I was prompted for username & password for the host, which I provided correctly.

Error: Curl error: URL usinng bad/illegal format or missing URL

Completed with errors

Thanks

Bhushan Pathak

Thanks Bhushan Pathak
Reply
0 Kudos
kjb007
Immortal
Immortal

So the vm name is not properly recognized.

Did you try:

ovftool "vi://<esxIP>" test.ovf

-KjB

Message was edited by: kjb007 : Changed to reflect host IP, not incorrect IP

vExpert/VCP/VCAP vmwise.com / @vmwise -KjB
Reply
0 Kudos
BhushanP
Contributor
Contributor

I tried with only IP in the commnad -

ovftool "vi://<ESXi Host IP>" test.ovf

ovftool "vi://<ESXi Host IP>/" test.ovf

For both attempts, I provided username & password as inputs & got the same Curl error -

Error: Curl error: URL using bad/illegal format or missing URL

Completed with errors

Should I try the Linux version of ovftool & check if that works?

Thanks

Bhushan Pathak

Thanks Bhushan Pathak
Reply
0 Kudos
kjb007
Immortal
Immortal

I am not able to replicate your condition.  Maybe something specific on that client.

How about forcing it to recognize a vi url,

ovftool -st=VI "vi://<ESXi Host IP>" test.ovf

That should give you an error stating wrong object and supply you with names.

-KjB

vExpert/VCP/VCAP vmwise.com / @vmwise -KjB
Reply
0 Kudos