How to add RHEL 8 qcow2 image to OpenStack Glance

Are you looking for a quick way to add RHEL 8 qcow2 VM images to OpenStack Glance storage? OpenStack Image Service (Glance) Acts as the registry for the virtual disk image. As a user, you can add new images or create a snapshot (copy) of an existing server for immediate storage on Glance.

Glance supports the following image formats:

  • raw (Unstructured format)
  • qcow2 (Qemu / KVM, support copy-on-write)
  • iso (Archive format for discs; for example, CD)
  • VCR (Hyper-V, common in virtual machine monitors of companies such as VMware, Xen, Microsoft, VirtualBox)
  • vdi (Qemu / VirtualBox)
  • vmdk (VMware)
  • bare (Not including metadata)
  • Autumn / Amy / Ali (Amazon kernel, ramdisk or machine image)
  • and many more.

I deployed a server OpenStack Stein, supported by CentOS 7 and KVM virtualization. Since I’m using KVM, the image I’m adding will be qcow2. There are two ways to get a qcow2 VM image.

  • Create RHEL 8 VM manually and export – virt-install, virt-builder.
  • Download the RHEL 8 qcow2 image from the Red Hat Customer Portal.

Step 1: Download the RHEL 8 qcow2 image

The convenient way is to pull the Red Hat distributed qcow2 image for RHEL 8.

Visit the Red Hat product download page. Under Red Hat Enterprise Linux 8, click the drop-down menu.

Choose “Download the latest

How to add RHEL 8 qcow2 image to OpenStack Glance

Check and select the latest KVM Guest Image from the list of available images.

Rael 8 qcow2

Use “Download now“Link for the latest qcow2 image for RHEL 8.

Rael 8 qcow2

The file should be saved on a local disk.

$ file ~/Downloads/rhel-8.0-update-1-x86_64-kvm.qcow2
/home/jmutai/Downloads/rhel-8.0-update-1-x86_64-kvm.qcow2: QEMU QCOW2 Image (v2), 10737418240 bytes

You can use our guide as a reference to further customize the qcow2 image:

How to customize Qcow2 / Raw Linux OS disk image with virt-customize

Step 2: Configure OpenStack Client / CLI

We will use the openstack command line client tool to upload the downloaded RHEL 8 qcow2 image to Glance. Install and configure it using the guide:

How to install and configure OpenStack Client on Linux

Step 3: Upload the RHEL 8 image to Openstack Glance storage

After configuring the openstack client, use the following command to upload the RHEL 8 qcow2 image to Glance.

QCOW2_IMAGE_FILE="./rhel-8.0-update-1-x86_64-kvm.qcow2"
GLANCE_IMAGE_NAME="rhel-8"

openstack image create  
 --container-format bare 
 --disk-format qcow2     
 --file $QCOW2_IMAGE_FILE 
 $GLANCE_IMAGE_NAME

Check if RHEL 8 images have been added to the list of available Glance images.

$ openstack image list
+--------------------------------------+-----------+--------+
| ID                                   | Name      | Status |
+--------------------------------------+-----------+--------+
| b8d75f31-fb6b-428b-8b83-f3904b0bd114 | CentOS-7  | active |
| fbcf16a0-c7cc-42c1-b836-a39bc34c9666 | Cirros    | active |
| d900bcad-047a-4d01-bcbc-42426bb4315d | CoreOS    | active |
| f0ac705b-ee73-4de8-95f7-4e06569f0f5c | Debian-10 | active |
| 01e6f07b-ca99-439d-9cd0-ab28c2573abf | Fedora-30 | active |
| 7bd462ad-cc11-4d89-8b85-9aab0cfe114b | Ubuntu-18 | active |
| 6b3dc49b-a53f-4cfc-98e0-9eb6925219de | rhel-7    | active |
| 965cb833-b97e-4488-9bc6-84495b9a9b7b | rhel-8    | active |
+--------------------------------------+-----------+--------+

To display image details, use commands.

$ openstack image show rhel-8

Step 4: Create OpenStack server from RHEL 8 qcow2 image

We should be able to create new instances on OpenStack with the added RHEL 8 Glance image.

openstack server create 
 --image rhel-8 
 --key-name jmutai 
 --flavor m1.medium 
 --security-group  7fffea2a-b756-473a-a13a-219dd0f1913a  
 --network private  
 rhel8

Create output.

+-------------------------------------+-----------------------------------------------+
| Field                               | Value                                         |
+-------------------------------------+-----------------------------------------------+
| OS-DCF:diskConfig                   | MANUAL                                        |
| OS-EXT-AZ:availability_zone         |                                               |
| OS-EXT-SRV-ATTR:host                | None                                          |
| OS-EXT-SRV-ATTR:hypervisor_hostname | None                                          |
| OS-EXT-SRV-ATTR:instance_name       |                                               |
| OS-EXT-STS:power_state              | NOSTATE                                       |
| OS-EXT-STS:task_state               | scheduling                                    |
| OS-EXT-STS:vm_state                 | building                                      |
| OS-SRV-USG:launched_at              | None                                          |
| OS-SRV-USG:terminated_at            | None                                          |
| accessIPv4                          |                                               |
| accessIPv6                          |                                               |
| addresses                           |                                               |
| adminPass                           | tm49aPXdRhd3                                  |
| config_drive                        |                                               |
| created                             | 2019-09-07T08:56:44Z                          |
| flavor                              | m1.medium (2)                                 |
| hostId                              |                                               |
| id                                  | 047cf8a9-764c-478c-ab18-f90c51f4cab3          |
| image                               | rhel-8 (965cb833-b97e-4488-9bc6-84495b9a9b7b) |
| key_name                            | jmutai                                        |
| name                                | rhel8                                         |
| progress                            | 0                                             |
| project_id                          | 06bcc3c56ab1489282b65681e782d7f6              |
| properties                          |                                               |
| security_groups                     | name='7fffea2a-b756-473a-a13a-219dd0f1913a'   |
| status                              | BUILD                                         |
| updated                             | 2019-09-07T08:56:44Z                          |
| user_id                             | 336acbb7421f47f8be4891eabf0c9cc8              |
| volumes_attached                    |                                               |
+-------------------------------------+-----------------------------------------------+

List the servers available on OpenStack.

$ openstack server list
+--------------------------------------+-------------------+--------+-----------------------------------+----------+-----------+
| ID                                   | Name              | Status | Networks                          | Image    | Flavor    |
+--------------------------------------+-------------------+--------+-----------------------------------+----------+-----------+
| 047cf8a9-764c-478c-ab18-f90c51f4cab3 | rhel8             | ACTIVE | private=10.10.1.143               | rhel-8   | m1.medium |
+--------------------------------------+-------------------+--------+-----------------------------------+----------+-----------+

The default ssh user for the RHEL 8 qcow2 image is Cloud user.

$ ssh [email protected]
The authenticity of host '10.10.1.143 (10.10.1.143)' can't be established.
ECDSA key fingerprint is SHA256:ZE/ajeFNUZpV3/AXp2taXanHT9mRa6FbWNd7ai3gsK0.
ECDSA key fingerprint is MD5:98:bd:4b:2d:61:12:54:4d:75:cd:20:8a:db:3f:11:59.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.10.1.143' (ECDSA) to the list of known hosts.
Activate the web console with: systemctl enable --now cockpit.socket
[[email protected] ~]$ 

You can then register your Red Hat server and start installing packages.

$ sudo subscription-manager register --auto-attach
Registering to: subscription.rhsm.redhat.com:443/subscription
Username: 
Password: 
The system has been registered with ID: 704cda51-0de8-4ee2-ad37-50b7ec70b8f2
The registered system name is: rhel8.novalocal
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux for x86_64
Status:       Subscribed

Enjoy running RHEL 8 workloads on the OpenStack cloud platform. For more reading, check out other articles related to OpenStack and virtualization.

Best book for learning OpenStack Cloud Platform 2019

How to resize an OpenStack instance / virtual machine

OpenStack deployment on CentOS 7 with Packstack

How to create a CentOS / Fedora / RHEL VM template on KVM

How to expand / increase KVM virtual machine (VM) disk size

How to configure a VM on KVM using Terraform

How to use Libguestfs tool to mount VM virtual disk on KVM hypervisor

How to add flavor to OpenStack using the CLI

Sidebar