convert VMX to OVF using OVFtool

2019-04-28 08:49发布

I am trying to convert VMX to OVF format using OVFTool as below, however it gives error:

C:\Program Files\VMware\VMware OVF Tool>ovftool.exe
vi://vcenter.com:port/folder/myfolder/abc.vmx abc.ovf
Error: Failed to open file: https://vcenter.com:port/folder/myfolder/abc.vmx
Completed with errors

Please let me know if you have any solution.

8条回答
老娘就宠你
2楼-- · 2019-04-28 09:14

Maybe ovftool is unable to recognize the path you are giving.

Try with following command:

ovftool --eula@=[path to eula] --X:logToConsole --targetType=OVA --compress=9 vi://[username]:[ESX address] [target address]

Once you provide the ESX address, it will list down the folders you have created in your ESX box. Then you can trigger the command above mentioned again with appending folder name.

If no folder hierarchy present in your box, then it will simply list down vm names.

Retry the same command appending [foldername]/[vmname no vmx file name required]

ovftool --eula@=[path to eula] --X:logToConsole --targetType=OVA --compress=9 vi://[username]:[ESX address]/[foldername if exist]/[vmname no vmx file name required] [target address]
查看更多
Deceive 欺骗
3楼-- · 2019-04-28 09:14

For me opening the .vmx and deleting the following line worked:

sata0:1.deviceType = "cdrom-image"
查看更多
Juvenile、少年°
4楼-- · 2019-04-28 09:15

I had a similar problem with OVFTool trying to export to OVF format.

Export failed: Failed to open file: C:\Virtual\test\test.vmx.

First, I opened .VMX file in editor (it's a text file) and made sure that settings like

scsi0:0.fileName = "test.vmdk"
nvram = "test.nvram"
extendedConfigFile = "test.vmxf"

mention proper file names. Then I noticed this line:

.encoding = "windows-1251"

This is Cyrillic code page, so I modified it to use Western code page

.encoding = "windows-1252"

Then, running OVFTool gave a different error

Export failed: Failed to open disk: test.vmdk.

To fix it I had to open .VMDK file in HEX editor (because it's usually a big binary file), found there the string

encoding = "windows-1251"

(it's somewhere in the beginning of the file), and replaced "1251" with "1252".

And it did the trick!

查看更多
可以哭但决不认输i
5楼-- · 2019-04-28 09:18

In my case, this works:

ide1:0.present = "TRUE"

ide1:0.deviceType = "cdrom-image"

I did change true to false and works fine, as cdrom-image not exist, this change permit the format conversion.

查看更多
叼着烟拽天下
6楼-- · 2019-04-28 09:21

I had this same exact issue. In my case I opened up the VMX file and dropped the IDE and sound controllers from the file and saved. I was then able to convert everything to an OVA using the tool with the standard syntax.

e.g. I dropped:

ide1:0.present = "TRUE"
ide1:0.deviceType = "cdrom-image"

and:

sound.present = "TRUE"
sound.fileName = "-1"
sound.autodetect = "TRUE"

This allowed me to convert the file like normal.

查看更多
霸刀☆藐视天下
7楼-- · 2019-04-28 09:27

I had a similar situation in vmware fusion trying to use a .vmx that was probably created on windows. I could boot the VM, but any attempt to export the machine with ovftool or use vmware-vdiskmanager bombed out with:

Error: Failed to open disk: source.vmdk
Completed with errors

the diskname was totally valid, path was valid, permissions were valid, and the only clue was running ovftool with:

ovftool --X:logToConsole --X:logLevel=verbose source.vmx dest.ova

Opening VMX source: source.vmx
verbose -[10C2513C0] Opening source
verbose -[10C2513C0] Failed to open disk: ./source.vmdk
verbose -[10C2513C0] Exception: Failed to open disk: source.vmdk. Reason: Disk encoding error
Error: Failed to open disk: source.vmdk

as others suggested, i took a peek in the .vmdk. therein i found 3 other clues:

encoding="windows-1252"
createType="monolithicSparse"
# Extent description
RW 16777216 SPARSE "source.vmdk"

so first i converted the monolithicSparse vmdk to "preallocated virtual disk split in 2GB files":

vmware-vdiskmanager -r source.vmdk -t3 foo.vmdk

then i could edit the "foo.vmdk" to change the encoding, which now looks like:

encoding="utf-8"
createType="twoGbMaxExtentFlat"
# Extent description
RW 8323072 FLAT "foo-f001.vmdk" 0
RW 8323072 FLAT "foo-f002.vmdk" 0
RW 131072 FLAT "foo-f003.vmdk" 0

and finally, after fixing up the source.vmx:

scsi0:0.fileName = "foo.vmdk"

profit:

ovftool source.vmx dest.ova
...
Opening VMX source: source.vmx
Opening OVA target: dest.ova
Writing OVA package: dest.ova
Transfer Completed
Completed successfully
查看更多
登录 后发表回答