Managing Flavors Using the Command-line Interface

In Metacloud, flavors define the compute, memory, and storage capacity of Metacloud Compute instances. A flavor is an available hardware configuration for a server. It defines the size of a virtual server that can be launched.

Note
Flavors can also determine the compute host that flavor can be used on to launch an instance. For information about customizing flavors, refer to Managing Flavors.

A flavor consists of the following parameters:

Flavor ID—Unique ID (integer or UUID) for the new flavor. If specifying ‘auto’, a UUID will be automatically generated.

Name—Name for the new flavor.

VCPUs—Number of virtual CPUs to use.

Memory MB—Amount of RAM to use (in megabytes).

Root Disk GB—Amount of disk space (in gigabytes) to use for the root (/) partition.

Ephemeral Disk GB—Amount of disk space (in gigabytes) to use for the ephemeral partition. If unspecified, the value is 0 by default. Ephemeral disks offer machine local disk storage linked to the lifecycle of a VM instance. When a VM is terminated, all data on the ephemeral disk is lost. Ephemeral disks are not included in any snapshots.

Swap—Amount of swap space (in megabytes) to use. If unspecified, the value is 0 by default.

RXTX Factor—Optional property that allows servers with a different bandwidth be created with the RXTX Factor. The default value is 1.0. That is, the new bandwidth is the same as that of the attached network. The RXTX Factor is available only for Xen or NSX based systems.

Is Public—Boolean value defines whether the flavor is available to all users. Defaults to True.

Extra Specs—Key and value pairs that define on which compute nodes a flavor can run. These pairs must match corresponding pairs on the compute nodes. It can be used to implement special resources, such as flavors that run on only compute nodes with GPU hardware.

For a list of optional parameters, run the help command:

 $ openstack help flavor 

The default flavors are:

Flavor VCPUs Disk (in GB) RAM (in MB)
m1.tiny 1 1 512
m1.small 1 20 2048
m1.medium 2 40 4096
m1.large 4 80 8192
m1.xlarge 8 160 16384

Creating a Flavor

You can create and manage flavors with the openstack flavor-\* commands provided by the python-novaclient package.

  1. Run the openstack flavor list command to show the ID and name, the amount of memory, the amount of disk space for the root partition and for the ephemeral partition, the swap, and the number of virtual CPUs for each flavor:

    $ openstack flavor list
    +--------------------------------------+-----------+-------+------+-----------+-------+-----------+
    | ID                                   | Name      |   RAM | Disk | Ephemeral | VCPUs | Is Public |
    +--------------------------------------+-----------+-------+------+-----------+-------+-----------+
    | 2                                    | m1.small  |  2048 |   20 |         0 |     1 | True      |
    | 3                                    | m1.medium |  4096 |   40 |         0 |     2 | True      |
    | 4                                    | m1.large  |  8192 |   80 |         0 |     4 | True      |
    | 5                                    | m1.xlarge | 16384 |  160 |         0 |     8 | True      |
    | 7868cfb2-683e-4356-888c-d4d6674393d9 | m1.tiny   |   512 |    1 |         0 |     1 | True      |
    | 8d0d8200-2024-4c50-b7c6-f673dfb88320 | win10     |  2048 |   40 |         0 |     2 | True      |
    +--------------------------------------+-----------+-------+------+-----------+-------+-----------+
    
  2. Run openstack flavor create to create a flavor, specify a name, ID, RAM size, disk size, and the number of VCPUs for the flavor, as follows:

    $ openstack flavor create FLAVOR_NAME FLAVOR_ID RAM_IN_MB ROOT_DISK_IN_GB NUMBER_OF_VCPUS
    

Note
If you use auto when creating a new flavor, a Unique ID (integer or UUID) is automatically generated.

The following example creates a public extra tiny flavor with additional optional parameters so that it automatically gets an ID assigned, with 256 MB memory, no disk space, and one VCPU. The rxtx-factor indicates the slice of bandwidth that the instances with this flavor can use (through the Virtual Interface (vif) creation in the hypervisor):

  $ openstack flavor create --is-public true m1.extra_tiny auto 256 0 1 --rxtx-factor .1
  1. Assign the new flavor to a project by specifying the flavor name or ID and the tenant ID using the following command:

    $ nova flavor-access-add FLAVOR TENANT_ID
    

Note
You can set extra_spec for the existing flavor. The extra_spec metadata keys can influence the instance directly when it is launched. If a flavor sets the extra_spec key/value quota:vif_outbound_peak=65536, the instance’s outbound peak bandwidth I/O should be LTE 512 Mbps. There are several aspects that can work for an instance including CPU limits, Disk tuning, Bandwidth I/O, Watchdog behavior, and Random-number generator. For information about supporting metadata keys, see Managing Flavors.

Deleting a Flavor

To delete a flavor, run the following command:

$ openstack flavor delete FLAVOR_ID