Are you looking for an expeditious way to add RHEL 8 qcow2 VM Image to OpenStack Glance store?. The OpenStack Image service (Glance) acts as a registry for virtual disk images. As a user, you can add new images or take a snapshot (copy) of an existing server for immediate storage on Glance.
For CentOS 8: How to run CentOS 8 on OpenStack
Glance has support for the following image formats:
- raw (unstructured format)
- qcow2 (Qemu/KVM, supports Copy on Write)
- iso (archive format for optical discs; for example, CD)
- vhd (Hyper-V, common for virtual machine monitors from VMware, Xen, Microsoft, VirtualBox, and others)
- vdi (Qemu/VirtualBox)
- vmdk (VMware)
- bare (no metadata is included)
- aki/ami/ari (Amazon kernel, ramdisk, or machine image)
- e.t.c.
I have a single server OpenStack Stein deployed – powered by CentOS 7 and KVM Virtualization. Since I use KVM, the image that I’ll add will be qcow2. There are two ways of getting a qcow2 VM image.
- Manually create a RHEL 8 VM and export – virt-install, virt-builder.
- Download RHEL 8 qcow2 image from Red Hat customer portal.
Step 1: Download RHEL 8 qcow2 image
The facile and convenient method is pulling a Red Hat distributed qcow2 image for RHEL 8.
Visit Red Hat Product Downloads page. Under Red Hat Enterprise Linux 8, click on the drop-down menu.
Select “Download Latest“
Check and pick the latest KVM Guest Image from the list of available images.
Use the “Download Now” link to get the latest qcow2 image of RHEL 8.
The file should be saved locally in your 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 further customize qcow2 image using our guide as reference:
How To Customize Qcow2/Raw Linux OS disk image with virt-customize
Step 2: Configure OpenStack Client / CLI
We’ll use the openstack command line client tool to upload 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 RHEL 8 image to Openstack Glance storage
With openstack client configured, upload RHEL 8 qcow2 image to Glance using the commands.
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 image has been added to 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 the command.
$ openstack image show rhel-8
Step 4: Create OpenStack Server from RHEL 8 qcow2 image
We should be able to create a new instance on OpenStack from the added Glance image of RHEL 8.
openstack server create \
--image rhel-8 \
--key-name jmutai \
--flavor m1.medium \
--security-group 7fffea2a-b756-473a-a13a-219dd0f1913a \
--network private \
rhel8
Creation 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 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 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 Red Hat server and start installing software 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 OpenStack cloud platform. For more reading, check other articles related to OpenStack and Virtualization.