Creating custom flavors for virtual machines

In the compute cluster, a configuration template for virtual machines is called a flavor. Flavors simplify VM deployment. They allow you to set the number of virtual CPU cores and the amount of RAM a virtual machine will use. By default, five predefined flavors are created with the following parameters:

Name vCPUs Memory
tiny 1 512 MiB
small 1 2 GiB
medium 2 4 GiB
large 4 8 GiB
xlarge 8 16 GiB

You can create custom flavors with different sets of vCPU and RAM resources: public flavors (default), shared between all of the projects, and private flavors, shared with specific projects. Also, you can delete existing flavors, including the predefined ones.

Prerequisites

To create a public flavor

Admin panel

  1. On the Compute > Virtual machines > Flavors tab, click Create flavor.
  2. In the Create flavor window, specify a flavor name, a number of virtual CPU cores, an amount of RAM, and then click Create.

The created flavor will be available to all of the projects.

Command-line interface

Use the following command:

vinfra service compute flavor create [--swap <size-mb>] --vcpus <vcpus> --ram <size-mb> <flavor-name>
--swap <size-mb>
Swap space size, in megabytes
--vcpus <vcpus>
Number of virtual CPUs
--ram <size-mb>
Memory size, in megabytes
<flavor-name>
Flavor name

For example, to create a flavor called myflavor with 1 vCPU and 3 GB of RAM, run:

# vinfra service compute flavor create myflavor --vcpus 1 --ram 3072

The new flavor will appear in the vinfra service compute flavor list output:

# vinfra service compute flavor list
+--------------------------------------+----------+-------+------+-------+
| id                                   | name     | ram   | swap | vcpus |
+--------------------------------------+----------+-------+------+-------+
| 100                                  | tiny     | 512   | 0    | 1     |
| 101                                  | small    | 2048  | 0    | 1     |
| 102                                  | medium   | 4096  | 0    | 2     |
| 103                                  | large    | 8192  | 0    | 4     |
| 104                                  | xlarge   | 16384 | 0    | 8     |
| 2e32ebd2-5d83-45fd-a526-3ae4a6658078 | myflavor | 3072  | 0    | 1     |
+--------------------------------------+----------+-------+------+-------+

To create a private flavor

  1. Create a flavor with the --private option. For example, to create the flavor private_tiny with 1 vCPU, 512 MiB of RAM, and the automatically generated UUID, run:

    # openstack --insecure flavor create private_tiny --private --id auto --ram 512 --disk 0 --vcpus 1
  2. Assign the flavor to a project. For example, to assign the flavor private_tiny to the project myproject within the domain mydomain, run:

    # openstack --insecure flavor set private_tiny --project myproject --project-domain mydomain

The created flavor will only be available to the assigned project.

To delete a flavor

Admin panel

  1. On the Compute > Virtual machines > Flavors tab, select the flavor you want to delete, and then click Delete.
  2. Click Delete in the confirmation window.

Command-line interface

Use the following command:

vinfra service compute flavor delete <flavor>
<flavor>
Flavor ID or name

For example, to delete the flavor myflavor, run:

# vinfra service compute flavor delete myflavor