Manage instance templates, including images and flavors

1. Overview

Before you get started!

Welcome to OpenStack!

In this series of tutorials, we will walk you through all the necessary steps to install, configure and get started with OpenStack. Using just a single machine, you will learn how to use OpenStack for cloud infrastructure implementation purposes, from a single-node installation to large-scale clusters.

This tutorial is the fifth in the “Phase 1 - Learn OpenStack” series.

Explore other tutorials >

What is OpenStack?

OpenStack is a collection of open source projects designed to work together to form the basis of a cloud. OpenStack can be used for both private and public cloud implementation.

What is Sunbeam?

Sunbeam is an upstream project under the governance of the OpenInfra Foundation (OIF), which was created to lower the barrier to entry for OpenStack, simplify its adoption process, and set the foundation for an autonomous private cloud. Sunbeam uses cloud-native architecture and total bottom-up automation to make OpenStack more accessible to newcomers and to help users get to grips with the platform immediately.

What is MicroStack?

MicroStack (based on Sunbeam) is an OpenStack distribution designed for small-scale cloud environments. While it is available with full commercial support from Canonical, it can also be self-deployed with no friction, effectively eliminating the need for a paid consulting engagement. MicroStack currently includes core OpenStack services only, but is expected to evolve quickly to ensure full feature parity with Canonical’s Charmed OpenStack soon.

In this tutorial, you will learn how to:

  • Distinguish between the various instance templates
  • Manage images
  • Manage flavors

You will only need:

One fresh physical or virtual machine with:


2. Manage images

Images are templates for creating instances on OpenStack. They contain the guest OS and are customised by cloud-init during the provisioning process.

The repository of Ubuntu cloud images is available at https://cloud-images.ubuntu.com/.

First, let’s download Ubuntu 20.04 LTS image to your workstation by clicking on the following link:

In the following steps, we’ll upload this images to Glance with minimum disk size and minimum RAM size set to 8 GB and 512 MB respectively. We’ll make the image available to the admin project only.

Manage images through the OpenStack client

To upload the image to Glance, execute the following command:


$ openstack image create --disk-format qcow2 --min-disk 8 --min-ram 512 --file ~/Downloads/focal-server-cloudimg-amd64-disk-kvm.img --private ubuntu-focal

To list all images, execute the following command:


$ openstack image list

Sample output:


+--------------------------------------+--------------+--------+
| ID                                   | Name         | Status |
+--------------------------------------+--------------+--------+
| 4c4fbf96-c5e5-49de-be6d-31bea2ea0ac8 | ubuntu       | active |
| 855b0d6d-eea7-45a0-bc41-bdeed2d9b362 | ubuntu-focal | active |
+--------------------------------------+--------------+--------+

Manage images through the OpenStack dashboard

Navigate to AdminComputeImages and click the Create Image button on the right:

1.5.1

To upload the image to Glance, fill in the form as follows:

  • Image Name - Type ubuntu-focal

  • File - Click Browse and find the focal-server-cloudimg-amd64-disk-kvm.img file in your Downloads directory

  • Format - Select QCOW2 - QEMU Emulator

  • Minimum Disk (GB) - Type 8

  • Minimum RAM (MB) - Type 512

  • Visibility - Choose Private

Then click the Create Image button:

1.5.2

You are now able to see two images in the Glance’s database:

1.5.3


3. Manage flavors

Flavors are other templates for creating instances on OpenStack. They define the size of virtual resources attached to the instance by default during the provisioning process. When creating an instance on OpenStack, the user needs to specify both the image and the flavor.

During OpenStack initialisation, Nova creates five flavors by default. In the following steps, we’ll create a new flavor called myflavor with 1 GB of RAM, 10 GB of disk for rootfs and 1 vCPU.

Manage flavors through the OpenStack client

To create the flavor, execute the following command:


$ openstack flavor create --ram 1024 --disk 10 --vcpus 1 myflavor

To list all flavors, execute the following command:


$ openstack flavor list

Sample output:


+--------------------------------------+-----------+------+------+-----------+-------+-----------+
| ID                                   | Name      |  RAM | Disk | Ephemeral | VCPUs | Is Public |
+--------------------------------------+-----------+------+------+-----------+-------+-----------+
| 62ed11a5-6884-431e-b878-08dc63d06d7b | m1.large  | 8192 |   90 |         0 |     4 | True      |
| 6f196c0c-187f-4228-a4dc-862c6dbd7650 | m1.medium | 4096 |   60 |         0 |     2 | True      |
| cfb4b2e6-744a-4dac-b9a5-9b67518c0d56 | myflavor  | 1024 |   10 |         0 |     1 | True      |
| d7b19405-1731-47ac-8c3a-831e7163272c | m1.small  | 2048 |   30 |         0 |     1 | True      |
| e8984cb9-4d11-461b-9fed-fd17002b7653 | m1.tiny   |  512 |    4 |         0 |     1 | True      |
+--------------------------------------+-----------+------+------+-----------+-------+-----------+

Manage flavors through the OpenStack dashboard

Navigate to AdminComputeFlavors and click the Create Flavor button on the right:

1.5.4

To create the flavor, fill in the form as follows:

  • Name - Type myflavor

  • VCPUS - Type 1

  • RAM (MB) - Type 1024

  • Root Disk (GB) - Type 10

Then click the Create Flavor button:

1.5.5

You are now able to see all five flavors in the Nova’s database:

1.5.6

Note that flavor IDs may be different in your environment.


4. Next steps