5.6. Validate the Image Service Installation

This section outlines the steps required to upload a disk image to the Image service. This image can be used as a basis for launching virtual machines in your OpenStack environment.

5.6.1. Obtain a Test Disk Image

Download from Red Hat a disk image that can be used to test the import of images into the Image service. A new image is provided with each minor Red Hat Enterprise Linux 7 release, and is available on the Product Downloads page for Red Hat Enterprise Linux.

Procedure 5.13. Downloading a Test Disk Image

  1. Go to https://access.redhat.com, and log in to the Red Hat Customer Portal using your customer account details.
  2. Click Downloads in the menu bar.
  3. Click A-Z to sort the product downloads alphabetically.
  4. Click Red Hat Enterprise Linux to access the Product Downloads page.
  5. Click the KVM Guest Image download link.

5.6.2. Upload a Disk Image

To launch instances based on images stored in the Image service, you must first upload one or more images into the Image service. You must have access to images suitable for use in the OpenStack environment.

Important

It is recommended that you run the virt-sysprep command on all Linux-based virtual machine images prior to uploading them to the Image service. The virt-sysprep command reinitializes a disk image in preparation for use in a virtual environment. Default operations include the removal of SSH keys, removal of persistent MAC addresses, and removal of user accounts.
The virt-sysprep command is provided by the Red Hat Enterprise Linux libguestfs-tools package. Install the package, and reinitialize the disk image:
# yum install -y libguestfs-tools
# virt-sysprep --add FILE
For information on enabling and disabling specific operations, see the virt-sysprep manual page.

Procedure 5.14. Uploading a Disk Image to the Image Service

  1. Set up the shell to access keystone as a configured user (an administrative account is not required):
    # source ~/keystonerc_userName
  2. Import the disk image:
    [(keystone_userName)]# glance image-create --name "NAME" \
            --is-public IS_PUBLIC \
            --disk-format DISK_FORMAT \
            --container-format CONTAINER_FORMAT \
            --file IMAGE
    Replace the following values:
    • Replace NAME with a name by which users will refer to the disk image.
    • Replace IS_PUBLIC with either true or false:
      • true - All users are able to view and use the image.
      • false - Only administrators are able to view and use the image.
    • Replace DISK_FORMAT with the disk image's format. Valid values include: aki, ami, ari, iso, qcow2, raw, vdi, vhd, and vmdk. If the format of the virtual machine disk image is unknown, use the qemu-img info command to try and identify it.
    • Replace CONTAINER_FORMAT with the container format of the image. The container format is bare unless the image is packaged in a file format, such as ovf or ami, that includes additional metadata related to the image.
    • Replace IMAGE with the local path to the image file (for uploading). If the image being uploaded is not locally accessible but is available using a remote URL, provide the URL using the --location parameter instead of the --file parameter. Note that you must also specify the --copy-from argument to copy the image into the object store, otherwise the image will be accessed remotely each time it is required.
    For more information about the glance image-create syntax, see the help page:
    [(keystone_userName)]# glance help image-create
    Note the unique identifier for the image in the output of the command above.
  3. Verify that your image was successfully uploaded:
     [(keystone_userName)]# glance image-show IMAGE_ID
    +------------------+--------------------------------------+
    | Property         | Value                                |
    +------------------+--------------------------------------+
    | checksum         | 2f81976cae15c16ef0010c51e3a6c163     |
    | container_format | bare                                 |
    | created_at       | 2013-01-25T14:45:48                  |
    | deleted          | False                                |
    | disk_format      | qcow2                                |
    | id               | 0ce782c6-0d3e-41df-8fd5-39cd80b31cd9 |
    | is_public        | True                                 |
    | min_disk         | 0                                    |
    | min_ram          | 0                                    |
    | name             | RHEL 6.6                             |
    | owner            | b1414433c021436f97e9e1e4c214a710     |
    | protected        | False                                |
    | size             | 25165824                             |
    | status           | active                               |
    | updated_at       | 2013-01-25T14:45:50                  |
    +------------------+--------------------------------------+
    Replace IMAGE_ID with the unique identifier for the image.
The disk image can now be used as the basis for launching virtual machine instances in your OpenStack environment.