×


Add Glance Cloud images to OpenStack

Are you trying to add Glance Cloud images to OpenStack?

This guide will help you.


Since cloud operators assign roles to users, only cloud administrators or operators can upload and manage the images. Even though the procedure is quite simple, not everyone is familiar with it.

Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform OpenStack related queries.

In this context, we shall look into how to add VM images to the OpenStack Glance image service.


More information about OpenStack image service?

A free open standard cloud computing platform, OpenStack is deployed as infrastructure-as-a-service in both public and private clouds where virtual servers and other resources are made available to users.

OpenStack glance enables users to discover, register, and retrieve virtual machine images. Its default location is /var/lib/glance/images/ with its backend being a file.

To query virtual machine image metadata and to retrieve an actual image, the OpenStack image service offers a REST API. The location of virtual machine images can be a variety, from simple file systems to object-storage systems like OpenStack Object Storage.

Furthermore, our Support Experts suggest us to have a running OpenStack setup and glance service runs on the controller node.


How to Add Glance Cloud images to OpenStack ?

The easy way to obtain a virtual machine image that works with OpenStack is to download an already existing image.

It is also possible to create our own images. However, it is faster to obtain ready-made images.

Generally, most of the images contain the cloud-init package to support the SSH key pair and user data injection.

Meanwhile, let us see an effective way our Support Techs employ to add VM images to the OpenStack Glance image service.


i. Add CentOS Cloud Image to OpenStack

The CentOS project maintains official images for direct download.


CentOS 8:

$ wget https://cloud.centos.org/centos/8/x86_64/images/CentOS-8-GenericCloud-8.3.2011-20201204.2.x86_64.qcow2
$ openstack image create \
–container-format bare \
–disk-format qcow2 \
–file CentOS-8-GenericCloud-8.3.2011-20201204.2.x86_64.qcow2 \
CentOS-8

CentOS 7:

$ wget http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2
$ openstack image create \
–container-format bare \
–disk-format qcow2 \
–file CentOS-7-x86_64-GenericCloud.qcow2 \
CentOS-7

The default login username for instances from this image: centos


ii. Add Ubuntu Cloud Image to OpenStack

Furthermore, let us see how to perform it in Ubuntu.


Ubuntu 20.04:

$ wget http://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img
$ openstack image create \
–container-format bare \
–disk-format qcow2 \
–file focal-server-cloudimg-amd64.img \
Ubuntu-20.04

Ubuntu 18.04:

$ wget http://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img
$ openstack image create \
–container-format bare \
–disk-format qcow2 \
–file bionic-server-cloudimg-amd64.img \
Ubuntu-18.04

Default login username for instances created from this image: ubuntu


iii. Add Debian Cloud Image to OpenStack

Similarly, to perform it in Debian 10, run:

$ wget http://cdimage.debian.org/cdimage/openstack/current-10/debian-10-openstack-amd64.qcow2
$ openstack image create \
–container-format bare \
–disk-format qcow2 \
–file debian-10-openstack-amd64.qcow2 \
Debian-10

Then in Debian 9:

$ wget http://cdimage.debian.org/cdimage/openstack/current-9/debian-9-openstack-amd64.qcow2
$ openstack image create \
–container-format bare \
–disk-format qcow2 \
–file debian-9-openstack-amd64.qcow2 \
Debian-9

Default login username for instances created from this image: debian


iv. Add Cirros Cloud image to Glance

Next, we will see how to add Cirros Cloud image to Glance.

$ wget http://download.cirros-cloud.net/0.5.1/cirros-0.5.1-x86_64-disk.img
$ openstack image create \
–container-format bare \
–disk-format qcow2 \
–file cirros-0.5.1-x86_64-disk.img \
Cirros-0.5.1

Default login username for instances created from this image: cirros

Password: cubswin:)


v. Add Fedora Cloud Image to OpenStack

Subsequently, we will look at adding Fedora Cloud Image to OpenStack.

$ wget http://fedora.mirror.liquidtelecom.com/fedora/linux/releases/32/Cloud/x86_64/images/Fedora-Cloud-Base-32-1.6.x86_64.qcow2
$ openstack image create \
–container-format bare \
–disk-format qcow2 \
–file Fedora-Cloud-Base-32-1.6.x86_64.qcow2 \
Fedora-32

Default login username for instances created from this image: fedora


vi. Add CoreOS Cloud Image to OpenStack

Then, let us see how to add CoreOS Cloud Image to OpenStack

$ wget https://stable.release.core-os.net/amd64-usr/current/coreos_production_openstack_image.img.bz2
$ bunzip2 coreos_production_openstack_image.img.bz2
$ openstack image create \
–container-format bare \
–disk-format qcow2 \
–file coreos_production_openstack_image.img \
CoreOS

Default login username for instances created from this image: core


viii. Add Arch Linux Cloud Image to OpenStack

Later, let us see how to add Linux Cloud Image to OpenStack.

$ wget https://linuximages.de/openstack/arch/arch-openstack-LATEST-image-bootstrap.qcow2
$ openstack image create \
–container-format bare \
–disk-format qcow2 \
–file arch-openstack-LATEST-image-bootstrap.qcow2 \
Arch-Linux

Default login username for instances created from this image: arch


ix. Add Gentoo Cloud Image to OpenStack

$ wget https://linuximages.de/openstack/gentoo/gentoo-openstack-LATEST-image-bootstrap.qcow2
$ openstack image create \
–container-format bare \
–disk-format qcow2 \
–file gentoo-openstack-LATEST-image-bootstrap.qcow2 \
Gentoo-Linux

Default login username for instances created from this image: gentoo


x. Add Fedora CoreOS Image to OpenStack

Initially, we download the image:

$ wget https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/33.20201201.3.0/x86_64/fedora-coreos-33.20201201.3.0-openstack.x86_64.qcow2.xz -O fedora-coreos-qemu.qcow2.xz

Then, we extract it:

$ unxz fedora-coreos-qemu.qcow2.xz

Finally, we upload the extracted image:

openstack image create \
–container-format bare \
–disk-format qcow2 \
–file fedora-coreos-qemu.qcow2 \
fcos

The default login username for instances created from this image: core.


xi. Add Windows Server 2012 image

Subsequently, let us focus on adding Windows Server 2012 image.

We download image from https://cloudbase.it/windows-cloud-images/#download

$ gunzip -cd windows_server_2012_r2_standard_eval_kvm_20170321.qcow2.gz
$ openstack image create \
–container-format bare \
–disk-format qcow2 \
–file windows_server_2012_r2_standard_eval_kvm_20170321.qcow2 \
Windows-Server-2012-R2-Std

Checklist of images available in Glance.

$ openstack image list
+————————————–+———————+——–+
| ID | Name | Status |
+————————————–+———————+——–+
| 0850ee38-1bdf-4379-9c69-0cf73e8b7c65 | Arch-Linux-x86_64 | active |
| e98445b6-f14f-488c-a18a-1f66c6de15c7 | CentOS-7-x86_64 | active |
| 7b4b616e-71f3-4419-9777-7aee66fad62c | Cirros-0.4.0-x86_64 | active |
| 98bbd9e6-abbc-45fa-ac95-b91b7b18ba0a | Debian-9-amd64 | active |
| 113b90b6-4e1e-4715-b9ab-456c191a82b3 | Fedora-30-x86_64 | active |
| 06c17e8a-0d4c-428a-89b5-b0eb2489f403 | Ubuntu-16.04-x86_64 | active |
+————————————–+———————+——–+

xii. Setting image options

It is a good practice to protect the images from accidental deletion. If an image is specified as Public, anyone else on the cluster can see it.

In order to set all images publicly visible and protect them from accidental deletion, we run:

IMAGE_IDS=`openstack image list | egrep ‘[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}’ -o`
for i in ${IMAGE_IDS[@]}; do
openstack image set –public $i
openstack image set –protected $i
done

Finally, we confirm from Horizon Dashboard by going to "Project >> Compute >> Images".

We should notice Protected flag is set to yes for all images and Visibility set to Public as well.


[Need urgent help with adding Glance Cloud images to OpenStack? We can help you. ]


Conclusion

This article will guide you on steps to add #Glance #Cloud images to #OpenStack with different #Linux distributions which enables users to discover, register, and retrieve virtual machine images. 

After images are created they should be registered in Openstack Glance - #image operation service.

Upload Image Into Glance:

1. Replace <NAME> with the name that users will refer to the disk image by. 

2. Replace <IMAGE_FILE> with the local path to the image file to upload.