将ovf格式转为ova格式

网上有许多资料介绍ovf格式和ova格式是什么,这里不在重复,简单来说,ovf 是一个文件夹下有多个文件(包括描述文件.ovf和镜像文件),ova是将ovf文件夹下的文件打为tar包,只不过扩展名为ova.

进入ovf文件夹,这样打包可以吗?

tar cf  V.ova   *

不行,导入vmware时会报错:第一文件不是ovf文件。实际上,ova格式对tar包内文件的顺序是有要求的。具体见Open Virtualization Format Specification. 后面贴出来相关部分供参考。
我是这样打包的:

tar  ovf文件  镜像文件

如果有多个文件,则文件顺序按照ovf文件中References 节列出文件的顺序


参考:
http://www.dmtf.org/sites/default/files/standards/documents/DSP0243_2.1.1.pdf

In addition, the entries shall be in one of the following orders inside the OVF package:

  1. OVF descriptor
  2. The remaining files shall be in the same order as listed in the References section (see7.1). Note that any external string resource bundle files for internationalization shall be
    first in the References section (see clause 10).

or

  1. OVF descriptor
  2. OVF manifest
  3. OVF certificate
  4. The remaining files shall be in the same order as listed in the References section (see 7.1). Note that any external string resource bundle files for internationalization shall be
    first in the References section (see clause 10).

or

  1. OVF descriptor
  2. The intermediate files shall be in the same order as listed in the References section (see 7.1). Note that any external string resource bundle files for internationalization shall be
    first in the References section (see clause 10).
  3. OVF manifest
  4. OVF certificate

The ordering restriction ensures that it is possible to extract the OVF descriptor from a compressed OVF package without scanning the entire archive. The ordering restriction enables the efficient generation of a compressed OVF package-

A compressed OVF package shall be created by using the TAR format that complies with the USTAR (Uniform Standard Tape Archive) format as defined by the ISO/IEC/IEEE 9945:2009

你可能感兴趣的:(虚拟化)