You can import images in unsupported image formats such as RAW, QCOW2, VDI, or VHD using the glance-import tool in the CLI. This tool automatically converts the source image to the VMDK format.

About this task

You can also use the glance-import tool to import images in the supported OVA and VMDK formats.

Prerequisites

  • Verify that the image is packaged in the RAW, QCOW2, VDI, or VHD format.

  • To allow plain HTTP requests, verify that the image is hosted on a server without credentials.

  • Verify that the VMware Integrated OpenStack controller can access the hosted server where the image is stored.

Procedure

  1. Using SSH, log in to the VMware Integrated OpenStack manager.
  2. From the VMware Integrated OpenStack manager, use SSH to log in to the controller01 node.
  3. Switch to root user.
    sudo su -
  4. Execute the cloudadmin.rc file.
    source cloudadmin.rc
  5. Configure the controller01 node to use the internal VIP.
    export OS_AUTH_URL=http://INTERNAL_VIP:35357/v2.0
  6. To import the image, run the glance-import command.
    glance-import import --name image_name --url image_http_url --image-format supported_image_format

    Parameter

    Description

    image-name

    Specify the name for the image as it will appear in the Image Service.

    image_format

    Specify the format of the source image file. Non-VMDK images are converted automatically to the VMDK format.

    The following formats are supported:

    • VMDK

    • OVA

    • RAW

    • QCOW2

    • VDI

    • VHD

    image_http-url

    Provide the HTTP location of the source image file.

    For example:

    glance-import cirros-img qcow2 https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img

    The CLI displays the task information and status, including the task ID and image ID.

    Created import task with id 5cdc4a04-5c68-4b91-ac44-37da07ec82ec
    Waiting for Task 5cdc4a04-5c68-4b91-ac44-37da07ec82ec to finish.
    Current Status.. SUCCESS
    Image cirros-img created with ID: 2120de75-0717-4d61-b5d9-2e3f16e79edc
    
  7. (Optional) Confirm the import task completed successfully.

    If the image is large and requires a lot of time, you can exit the utility safely without affecting the operation and check the task status later.

    Note:

    You must know the task ID to be able to check the status.

    glance --os-image-api-version 2 task-show <task_id> 

    For example:

    glance --os-image-api-version 2 task-show 5cdc4a04-5c68-4b91-ac44-37da07ec82ec
    +------------+---------------------------------------------------------------------------+
    | Property   | Value                                                                     |
    +------------+---------------------------------------------------------------------------+
    | created_at | 2015-10-15T21:20:59Z                                                      |
    | expires_at | 2015-10-17T21:21:14Z                                                      |
    | id         | 5cdc4a04-5c68-4b91-ac44-37da07ec82ec                                      |
    | input      | {"image_properties": {"container_format": "bare", "name": "cirros-img"},  |
    |            | "import_from_format": "qcow2", "import_from": "https://launchpad.net/     |
    |            | cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img"}               |
    | message    |                                                                           |
    | owner      | def459fd05d7490e9fda07dbe6ee2d76                                          |
    | result     | {"image_id": "2120de75-0717-4d61-b5d9-2e3f16e79edc"}                      |
    | status     | success                                                                   |
    | type       | import                                                                    |
    | updated_at | 2015-10-15T21:21:14Z                                                      |
    +------------+---------------------------------------------------------------------------+
    
  8. (Optional) Confirm that the import process was successful.

    You must know the image ID created by the glance-import command to confirm the import.

    glance image-show <image_id>

    The command returns details about the specified image.

  9. (Optional) Confirm the image is included in the Image Service.
    glance image-list

    The command returns a list of all images that are available in the Image Service.