You can make images available for use in instances by importing images to the Image Service datastore .
About this task
To import an image in a non-supported format such as RAW, QCOW2, VDI, or VHD, see Import Images in Unsupported Formats by Using the CLI.
Prerequisites
Verify that you configured one or more Image Service datastores.
Obtain the image, for example, ubuntuLTS-sparse.vmdk.
Verify that the images are packaged in the ISO, VMDK, or OVA format.
Procedure
- Log in to the OpenStack management cluster as a user with administrative privileges to upload the image to the Image Service component.
- Run the glance image-create command to obtain, define, and import the image.
glance --os-auth-token $token --os-image-url http://123.456.7.8:9292 \ image-create name="ubuntu-sparse" \ disk_format=vmdk \ container_format=bare \ --visibility="public" \ --property vmware_adaptertype="lsiLogicsas" \ --property vmware_disktype="sparse" \ --property vmware_ostype="ubuntu64Guest" < ubuntuLTS-sparse.vmdk
This example uses the following parameters and settings.
Parameter or Setting
Description
--os-image-url http://123.456.7.8:9292
The URL of the source image.
name="ubuntu-sparse"
The name of the source image, in this case, ubuntu-sparse.
disk_format=vmdk
The disk format of the source image. You can specify ISO, VMDK, or OVA.
container_format=bare
The container format indicates if the image is in a format that contains metadata about the actual virtual machine. Because the container format string is not currently used by Glance, it is recommended to specify bare for this parameter.
--visibility="public"
The privacy setting for the image in OpenStack. When set to public, the image is available to all users. When set to private, the image is available only to the current user.
--property vmware_adaptertype="lsiLogicsas"
During import, the VMDK disk is introspected to capture its adapter type property.
You also have the option of using the vmware_adaptertype to specify adapter type.
Note:If you are using a disk with the paraVirtual or LSI Logic SAS adapter type, it is recommend that you use this parameter. For example,
vmware_adaptertype= lsiLogicsas
orvmware_adaptertype= paraVirtual
.--property vmware_disktype="sparse"
During import, the VMDK disk type is introspected to capture its disk type property.
You also have the option of specifying disk type using the vmware_disktype property.
--property vmware_ostype="ubuntu64Guest"
The name of the image file after it is imported to the Image Service. In the example above, the resulting name will be
ubuntuLTS-sparse.vmdk
. - (Optional) In the Compute component, confirm that the image was successfully imported.
$ glance image-list
The command returns a list of all images that are available in the Image Service.