您可以使用 OpenStack 管理服务器 上的命令行界面导入映像。

支持下列映像格式:

  • VMDK

  • ISO

  • OVA

要上载其他格式的映像,请参见导入格式不受支持的映像

注:

ISO 映像不能用于创建卷。

过程

  1. viouser 用户身份登录到 OpenStack 管理服务器
  2. 加载您的用户帐户的凭据文件。
    source user-credentials.rc
  3. 在 Glance 中创建映像。
    glance image-create --name image-name --file image-path --disk-format {vmdk | iso} --container_format bare [--property vmware_adaptertype="adapter-type"] [--property vmware_disktype="disk-type"] [--property vmware_ostype="operating-system"]

    选项

    说明

    --name

    输入映像服务中映像文件的名称。

    --file

    输入所需映像文件的路径。

    --disk_format

    输入源映像的磁盘格式。您可以指定 isovmdk

    对于 OVA 格式的映像,使用 vmdk 作为磁盘格式。

    --container_format

    输入 bare。Glance 当前未使用该容器格式参数。

    --property vmware_adaptertype

    指定 VMDK 磁盘的适配器类型。

    如果不包括此参数,将通过自检确定适配器类型。

    注:
    • 对于使用准虚拟适配器的磁盘,请包含此参数并将其设置为 paraVirtual

    • 对于使用 LSI Logic SAS 适配器的磁盘,请包含此参数并将其设置为 lsiLogicsas

    --property vmware_disktype

    指定 sparsepreallocatedstreamOptimized

    如果不包括此参数,将通过自检确定磁盘类型。

    --property vmware_ostype

    指定映像上的操作系统。

下一步做什么

可以使用导入的映像启动 OpenStack 实例。请参见从映像启动 OpenStack 实例。还可以运行 openstack image list 命令,查看项目中的所有映像。