Chapter 3. Creating flavors for launching instances
An instance flavor is a resource template that specifies the virtual hardware profile for the instance. Cloud users must specify a flavor when they launch an instance.
A flavor can specify the quantity of the following resources the Compute service must allocate to an instance:
- The number of vCPUs.
- The RAM, in MB.
- The root disk, in GB.
- The virtual storage, including secondary ephemeral storage and swap disk.
You can specify who can use flavors by making the flavor public to all projects, or private to specific projects or domains.
Flavors can use metadata, also referred to as "extra specs", to specify instance hardware support and quotas. The flavor metadata influences the instance placement, resource usage limits, and performance. For a complete list of available metadata properties, see Flavor metadata.
You can also use the flavor metadata keys to find a suitable host aggregate to host the instance, by matching the extra_specs
metadata set on the host aggregate. To schedule an instance on a host aggregate, you must scope the flavor metadata by prefixing the extra_specs
key with the aggregate_instance_extra_specs:
namespace. For more information, see Creating and managing host aggregates.
A Red Hat OpenStack Platform (RHOSP) deployment includes the following set of default public flavors that your cloud users can use.
Name | vCPUs | RAM | Root Disk Size |
---|---|---|---|
m1.nano | 1 | 128 MB | 1 GB |
m1.micro | 1 | 192 MB | 1 GB |
Behavior set using flavor properties override behavior set using images. When a cloud user launches an instance, the properties of the flavor they specify override the properties of the image they specify.
3.1. Creating a flavor
You can create and manage specialized flavors for specific functionality or behaviors, for example:
- Change default memory and capacity to suit the underlying hardware needs.
- Add metadata to force a specific I/O rate for the instance or to match a host aggregate.
Procedure
Create a flavor that specifies the basic resources to make available to an instance:
(overcloud)$ openstack flavor create --ram <size_mb> \ --disk <size_gb> --vcpus <no_vcpus> \ [--private --project <project_id>] <flavor_name>
-
Replace
<size_mb>
with the size of RAM to allocate to an instance created with this flavor. -
Replace
<size_gb>
with the size of root disk to allocate to an instance created with this flavor. -
Replace
<no_vcpus>
with the number of vCPUs to reserve for an instance created with this flavor. Optional: Specify the
--private
and--project
options to make the flavor accessible only by a particular project or group of users. Replace<project_id>
with the ID of the project that can use this flavor to create instances. If you do not specify the accessibility, the flavor defaults to public, which means that it is available to all projects.NoteYou cannot make a public flavor private after it has been created.
Replace
<flavor_name>
with a unique name for your flavor.For more information about flavor arguments, see Flavor arguments.
-
Replace
Optional: To specify flavor metadata, set the required properties by using key-value pairs:
(overcloud)$ openstack flavor set \ --property <key=value> --property <key=value> ... <flavor_name>
-
Replace
<key>
with the metadata key of the property you want to allocate to an instance that is created with this flavor. For a list of available metadata keys, see Flavor metadata. -
Replace
<value>
with the value of the metadata key you want to allocate to an instance that is created with this flavor. Replace
<flavor_name>
with the name of your flavor.For example, an instance that is launched by using the following flavor has two CPU sockets, each with two CPUs:
(overcloud)$ openstack flavor set \ --property hw:cpu_sockets=2 \ --property hw:cpu_cores=2 processor_topology_flavor
-
Replace
3.2. Flavor arguments
The openstack flavor create
command has one positional argument, <flavor_name>
, to specify the name of your new flavor.
The following table details the optional arguments that you can specify as required when you create a new flavor.
Optional argument | Description |
---|---|
|
Unique ID for the flavor. The default value, |
| (Mandatory) Size of memory to make available to the instance, in MB. Default: 256 MB |
| (Mandatory) Amount of disk space to use for the root (/) partition, in GB. The root disk is an ephemeral disk that the base image is copied into. When an instance boots from a persistent volume, the root disk is not used. Note
Creation of an instance with a flavor that has Default: 0 GB |
| Amount of disk space to use for the ephemeral disks, in GB. Defaults to 0 GB, which means that no secondary ephemeral disk is created. Ephemeral disks offer machine local disk storage linked to the lifecycle of the instance. Ephemeral disks are not included in any snapshots. This disk is destroyed and all data is lost when the instance is deleted. Default: 0 GB |
|
Swap disk size in MB. Do not specify Default: 0 GB |
| (Mandatory) Number of virtual CPUs for the instance. Default: 1 |
| The flavor is available to all projects. By default, a flavor is public and available to all projects. |
|
The flavor is only available to the projects specified by using the |
| Metadata, or "extra specs", specified by using key-value pairs in the following format:
Repeat this option to set multiple properties. |
|
Specifies the project that can use the private flavor. You must use this argument with the Repeat this option to allow access to multiple projects. |
|
Specifies the project domain that can use the private flavor. You must use this argument with the Repeat this option to allow access to multiple project domains. |
| Description of the flavor. Limited to 65535 characters in length. You can use only printable characters. |
3.3. Flavor metadata
Use the --property
option to specify flavor metadata when you create a flavor. Flavor metadata is also referred to as extra specs. Flavor metadata determines instance hardware support and quotas, which influence instance placement, instance limits, and performance.
Instance resource usage
Use the property keys in the following table to configure limits on CPU, memory and disk I/O usage by instances.
The extra specs for limiting instance CPU resource usage are host-specific tunable properties that are passed directly to libvirt, which then passes the limits onto the host OS. Therefore, the supported instance CPU resource limits configurations are dependent on the underlying host OS.
For more information on how to configure instance CPU resource usage for the Compute nodes in your RHOSP deployment, see Understanding cgroups in the RHEL 9 documentation, and CPU Tuning in the Libvirt documentation.
Key | Description |
---|---|
|
Specifies the proportional weighted share of CPU time for the domain. Defaults to the OS provided defaults. The Compute scheduler weighs this value relative to the setting of this property on other instances in the same domain. For example, an instance that is configured with |
|
Specifies the period of time within which to enforce the |
|
Specifies the maximum allowed bandwidth for the vCPU in each
You can use $ openstack flavor set cpu_limits_flavor \ --property quota:cpu_quota=10000 \ --property quota:cpu_period=20000 |
Instance disk tuning
Use the property keys in the following table to tune the instance disk performance.
The Compute service applies the following quality of service settings to storage that the Compute service has provisioned, such as ephemeral storage. To tune the performance of Block Storage (cinder) volumes, you must also configure and associate a Quality of Service (QoS) specification for the volume type. For more information, see Block Storage service (cinder) Quality of Service specifications in the Configuring persistent storage guide.
Key | Description |
---|---|
| Specifies the maximum disk reads available to an instance, in bytes per second. |
| Specifies the maximum disk reads available to an instance, in IOPS. |
| Specifies the maximum disk writes available to an instance, in bytes per second. |
| Specifies the maximum disk writes available to an instance, in IOPS. |
| Specifies the maximum I/O operations available to an instance, in bytes per second. |
| Specifies the maximum I/O operations available to an instance, in IOPS. |
Instance network traffic bandwidth
Use the property keys in the following table to configure bandwidth limits on the instance network traffic by configuring the VIF I/O options.
The quota :vif_*
properties are deprecated. Instead, you should use the Networking (neutron) service Quality of Service (QoS) policies. For more information about QoS policies, see Configuring Quality of Service (QoS) policies in the Configuring Red Hat OpenStack Platform networking guide. The quota:vif_*
properties are only supported when you use the ML2/OVS mechanism driver with NeutronOVSFirewallDriver
set to iptables_hybrid
.
Key | Description |
---|---|
| (Deprecated) Specifies the required average bit rate on the traffic incoming to the instance, in kbps. |
| (Deprecated) Specifies the maximum amount of incoming traffic that can be burst at peak speed, in KB. |
| (Deprecated) Specifies the maximum rate at which the instance can receive incoming traffic, in kbps. |
| (Deprecated) Specifies the required average bit rate on the traffic outgoing from the instance, in kbps. |
| (Deprecated) Specifies the maximum amount of outgoing traffic that can be burst at peak speed, in KB. |
| (Deprecated) Specifies the maximum rate at which the instance can send outgoing traffic, in kbps. |
Hardware video RAM
Use the property key in the following table to configure limits on the instance RAM to use for video devices.
Key | Description |
---|---|
|
Specifies the maximum RAM to use for video devices, in MB. Use with the |
Watchdog behavior
Use the property key in the following table to enable the virtual hardware watchdog device on the instance.
Key | Description |
---|---|
|
Specify to enable the virtual hardware watchdog device and set its behavior. Watchdog devices perform the configured action if the instance hangs or fails. The watchdog uses the i6300esb device, which emulates a PCI Intel 6300ESB. If Set to one of the following valid values:
|
Random number generator (RNG)
Use the property keys in the following table to enable the RNG device on the instance.
Key | Description |
---|---|
|
Set to
Default: |
| Specifies the maximum number of bytes that the instance can read from the entropy of the host, per period. |
| Specifies the duration of the read period in milliseconds. |
Virtual Performance Monitoring Unit (vPMU)
Use the property key in the following table to enable the vPMU for the instance.
Key | Description |
---|---|
|
Set to
Tools such as |
Virtual Trusted Platform Module (vTPM) devices
Use the property keys in the following table to enable a vTPM device for the instance.
Key | Description |
---|---|
|
Set to the version of TPM to use. TPM version |
|
Set to the model of TPM device to use. Ignored if
|
Instance CPU topology
Use the property keys in the following table to define the topology of the processors in the instance.
Key | Description |
---|---|
| Specifies the preferred number of sockets for the instance. Default: the number of vCPUs requested |
| Specifies the preferred number of cores per socket for the instance.
Default: |
| Specifies the preferred number of threads per core for the instance.
Default: |
| Specifies the maximum number of sockets that users can select for their instances by using image properties.
Example: |
| Specifies the maximum number of cores per socket that users can select for their instances by using image properties. |
| Specifies the maximum number of threads per core that users can select for their instances by using image properties. |
Serial ports
Use the property key in the following table to configure the number of serial ports per instance.
Key | Description |
---|---|
| Maximum serial ports per instance. |
CPU pinning policy
By default, instance virtual CPUs (vCPUs) are sockets with one core and one thread. You can use properties to create flavors that pin the vCPUs of instances to the physical CPU cores (pCPUs) of the host. You can also configure the behavior of hardware CPU threads in a simultaneous multithreading (SMT) architecture where one or more cores have thread siblings.
Use the property keys in the following table to define the CPU pinning policy of the instance.
Key | Description |
---|---|
| Specifies the CPU policy to use. Set to one of the following valid values:
|
|
Specifies the CPU thread policy to use when
|
| Specifies which CPUs are dedicated (pinned) or shared (unpinned/floating).
|
Instance PCI NUMA affinity policy
Use the property key in the following table to create flavors that specify the NUMA affinity policy for PCI passthrough devices and SR-IOV interfaces.
Key | Description |
---|---|
| Specifies the NUMA affinity policy for PCI passthrough devices and SR-IOV interfaces. Set to one of the following valid values:
|
Instance NUMA topology
You can use properties to create flavors that define the host NUMA placement for the instance vCPU threads, and the allocation of instance vCPUs and memory from the host NUMA nodes.
Defining a NUMA topology for the instance improves the performance of the instance OS for flavors whose memory and vCPU allocations are larger than the size of NUMA nodes in the Compute hosts.
The Compute scheduler uses these properties to determine a suitable host for the instance. For example, a cloud user launches an instance by using the following flavor:
$ openstack flavor set numa_top_flavor \ --property hw:numa_nodes=2 \ --property hw:numa_cpus.0=0,1,2,3,4,5 \ --property hw:numa_cpus.1=6,7 \ --property hw:numa_mem.0=3072 \ --property hw:numa_mem.1=1024
The Compute scheduler searches for a host that has two NUMA nodes, one with 3GB of RAM and the ability to run six CPUs, and the other with 1GB of RAM and two CPUS. If a host has a single NUMA node with capability to run eight CPUs and 4GB of RAM, the Compute scheduler does not consider it a valid match.
NUMA topologies defined by a flavor cannot be overridden by NUMA topologies defined by the image. The Compute service raises an ImageNUMATopologyForbidden
error if the image NUMA topology conflicts with the flavor NUMA topology.
You cannot use this feature to constrain instances to specific host CPUs or NUMA nodes. Use this feature only after you complete extensive testing and performance measurements. You can use the hw:pci_numa_affinity_policy
property instead.
Use the property keys in the following table to define the instance NUMA topology.
Key | Description |
---|---|
| Specifies the number of host NUMA nodes to restrict execution of instance vCPU threads to. If not specified, the vCPU threads can run on any number of the available host NUMA nodes. |
| A comma-separated list of instance vCPUs to map to instance NUMA node N. If this key is not specified, vCPUs are evenly divided among available NUMA nodes. N starts from 0. Use *.N values with caution, and only if you have at least two NUMA nodes.
This property is valid only if you have set |
| The number of MB of instance memory to map to instance NUMA node N. If this key is not specified, memory is evenly divided among available NUMA nodes. N starts from 0. Use *.N values with caution, and only if you have at least two NUMA nodes.
This property is valid only if you have set |
If the combined values of hw:numa_cpus.N
or hw:numa_mem.N
are greater than the available number of CPUs or memory respectively, the Compute service raises an exception.
CPU real-time policy
Use the property keys in the following table to define the real-time policy of the processors in the instance.
- Although most of your instance vCPUs can run with a real-time policy, you must mark at least one vCPU as non-real-time to use for both non-real-time guest processes and emulator overhead processes.
- To use this extra spec, you must enable pinned CPUs.
Key | Description |
---|---|
|
Set to
Default: |
| Specifies the vCPUs to not assign a real-time policy to. You must prepend the mask value with a caret symbol (^). The following example indicates that all vCPUs except vCPUs 0 and 1 have a real-time policy: $ openstack flavor set <flavor> \ --property hw:cpu_realtime="yes" \ --property hw:cpu_realtime_mask=^0-1 Note
If the |
Emulator threads policy
You can assign a pCPU to an instance to use for emulator threads. Emulator threads are emulator processes that are not directly related to the instance. A dedicated emulator thread pCPU is required for real-time workloads. To use the emulator threads policy, you must enable pinned CPUs by setting the following property:
--property hw:cpu_policy=dedicated
Use the property key in the following table to define the emulator threads policy of the instance.
Key | Description |
---|---|
| Specifies the emulator threads policy to use for instances. Set to one of the following valid values:
|
Instance memory page size
Use the property keys in the following table to create an instance with an explicit memory page size.
Key | Description |
---|---|
|
Specifies the size of large pages to use to back the instances. Use of this option creates an implicit NUMA topology of 1 NUMA node unless otherwise specified by
|
PCI passthrough
Use the property key in the following table to attach a physical PCI device, such as a graphics card or a network device, to an instance. For more information about using PCI passthrough, see Configuring PCI passthrough.
Key | Description |
---|---|
| Specifies the PCI device to assign to an instance by using the following format: <alias>:<count>
|
Hypervisor signature
Use the property key in the following table to hide the hypervisor signature from the instance.
Key | Description |
---|---|
|
Set to |
UEFI Secure Boot
Use the property key in the following table to create an instance that is protected with UEFI Secure Boot.
Instances with UEFI Secure Boot must support UEFI and the GUID Partition Table (GPT) standard, and include an EFI system partition.
Key | Description |
---|---|
|
Set to |
Instance resource traits
Each resource provider has a set of traits. Traits are the qualitative aspects of a resource provider, for example, the type of storage disk, or the Intel CPU instruction set extension. An instance can specify which of these traits it requires.
The traits that you can specify are defined in the os-traits
library. Example traits include the following:
-
COMPUTE_TRUSTED_CERTS
-
COMPUTE_NET_ATTACH_INTERFACE_WITH_TAG
-
COMPUTE_IMAGE_TYPE_RAW
-
HW_CPU_X86_AVX
-
HW_CPU_X86_AVX512VL
-
HW_CPU_X86_AVX512CD
For details about how to use the os-traits
library, see https://docs.openstack.org/os-traits/latest/user/index.html.
Use the property key in the following table to define the resource traits of the instance.
Key | Description |
---|---|
| Specifies Compute node traits. Set the trait to one of the following valid values:
Example: $ openstack flavor set --property trait:HW_CPU_X86_AVX512BW=required avx512-flavor |
Instance bare-metal resource class
Use the property key in the following table to request a bare-metal resource class for an instance.
Key | Description |
---|---|
| Use this property to specify standard bare-metal resource classes to override the values of, or to specify custom bare-metal resource classes that the instance requires.
The standard resource classes that you can override are
The name of custom resource classes must start with
For example, to schedule instances on a node that has $ openstack flavor set \ --property resources:CUSTOM_BAREMETAL_SMALL=1 \ --property resources:VCPU=0 --property resources:MEMORY_MB=0 \ --property resources:DISK_GB=0 compute-small |