How to add flavors to openstack using cli: This is a continuation of getting started with Openstack compute platform series. Earlier in the series we looked at Adding images to Openstack Glance.
What are Openstack flavors?
In OpenStack, a flavor defines the compute, memory, and storage capacity of a virtual server, also known as an instance. As an administrative user, you can create, edit, and delete flavors. This can be done either from the cli or using the Horizon dashboard,
As of Newton openstack release, there are no default flavors. You’ll have to create them manually, this is why I’m writing this tutorial.
We’re going to define 6 flavors, each with unique flavor ID and starting from small to the largest. Please note that this is just an example, you can define custom flavors to suit your use.
You need OpenStack Client configured for this operation: How To Install and Configure OpenStack Client on Linux
Type the following commands to define the six flavors:
openstack flavor create --id 0 --ram 512 --vcpus 1 --disk 10 m1.tiny openstack flavor create --id 1 --ram 1024 --vcpus 1 --disk 20 m1.small openstack flavor create --id 2 --ram 2048 --vcpus 2 --disk 40 m1.medium openstack flavor create --id 3 --ram 4096 --vcpus 2 --disk 80 m1.large openstack flavor create --id 4 --ram 8192 --vcpus 4 --disk 160 m1.xlarge openstack flavor create --id 5 --ram 16384 --vcpus 6 --disk 320 m1.jumbo
Let me first explain the meaning of the values used in each definition. If you take example of the first line, 0 is the id of the image, 512 means flavor will have 512 mb ram with 1 vcpu and 10 GB root disk. The name given to the flavor is m1.tiny.
Confirm flavor list.
You can check if the flavors were created successfully from the cli using the command:
$ openstack flavor list
On the UI. this can be confirmed by going to Admin > System > Flavors
Now with the flavors added, you can create a test instance on your Openstack to test: