OpenStack instance type management

1) Basic understanding

1. Basic concepts

The cloud host is also called an instance, and the instance type (Flavor) is similar to the virtual hardware configuration template of the cloud host. The template defines the information of the cloud host including the memory and hard disk size, the number of CPUs, etc., and the OpenStack cloud computing platform is based on this configuration. Templates to mass-produce cloud hosts. OpenStack M version and previous cloud computing platform systems have default instance types. Since the OpenStack N version, there is no default instance type, which needs to be defined by the system administrator.
The default instance types that exist in OpenStack M version and previous cloud computing platform systems

instance type Virtual CPU/pc HDD/GB RAM/GB
m1.tiny 1 1 512
m1.small 1 20 2048
m1.my 2 40 4096
m1.large 4 80 8192
2. Instance type management

Instance types can only be managed by users with Admin permissions. Typically, instance type management includes creation, deletion, query, etc. You can use the following commands to manage OpenStack instance types.

openstack flavor <操作> [选项] <实例类型名>

Common operations and function descriptions of instance type management commands:

Common operations Function Description
create Create a new instance type
delete delete instance type
list List existing instance types
show Show instance type details

Common options and function descriptions of instance type management commands:

Common options Function Description
–h show help information
–id Set the ID of the instance type, the default value is auto
–ram Set the memory size, in MB
–disk Set the hard disk size, in GB
–swap Set the size of the swap partition in MB
–vcpus The number of virtual CPUs, the default value is 1
–public Public, allowing the instance type to be used by other projects, this is the default value
–private Private, as opposed to public, this instance type is not allowed to be used by other projects
3. Examples
a - Create a public instance type called "m1.tiny"
openstack flavor create --id auto --vcpus 1 --ram 512 --disk 1 m1.tiny

image.png
As above, an instance type with 1 CPU, 512MB, and 1GB hard disk is created. Since "--public" is the default option, an instance type that can be shared by multiple projects is created here.

b- View the list of existing instance types
openstack flavor list

image.png

c - Delete the "m1.tiny" instance type
openstack flavor delete m1.tiny

image.png

2) Project implementation

1. Create and manage instance types with Dashboard
a - create instance type

Enter the [Instance Type] interface. After logging in, select [Administrator] —> [Computing] —> [Instance Type] in the left navigation bar of the main interface to enter the following interface: Start
image.png
setting instance information. Select [Create instance type], and in the pop-up dialog box, we can specifically set the CPU, memory, hard disk and other information in the instance type.
image.png
Here is a reference setting:
image.png
Of course, you can also configure and run according to your actual needs.
If the memory of the computing node is 4GB, the memory of this instance type should not exceed 1GB, otherwise the OpenStack cloud computing platform may not be able to run normally due to too little memory left.
After the instance type creation is complete. After configuring the configuration of the instance type, complete the creation task of the strength type. After the creation is successful, it will automatically return to the [Instance Type] interface, and you can see the list of newly created instance types.
image.png
In actual work, system administrators can pre-create multiple instance types to meet users' needs for creating different cloud hosts.

b - delete instance type

Choose the instance type to delete. Enter the [Instance Type] interface, and select the instance type to be deleted. Click [Delete Instance Type], and then select [Delete Instance Type] in the pop-up dialog box to confirm the deletion.
image.pngimage.png

2. Create and manage instance types with command mode
a- View the instance type in command mode

The first step is to import environment variables to simulate login.
When a message such as "Missing value auth-url required for auth plugin password" appears when operating OpenStack components, it means that you have not logged in. At this time, you need to introduce environment variables to enable Keystone authentication to achieve login. Use "source" or "." to perform environment variable import operation, the code is as follows:

source admin-login

View a list of existing instance types:

openstack flavor list

image.png

b - delete instance type with command mode

When there is data in the queried instance type list, the instance type can be deleted. For example, in the above instance type list, there is an
instance type named "Mini", and its ID is "22d9f3dd-5799-4def-87d7-49258ec6a920". Copy this ID and delete the instance type using the following command.

openstack flavor delete  22d9f3dd-5799-4def-87d7-49258ec6a920 
c - create instance type with command pattern

Use the following command:

openstack flavor create --id auto --vcpus 1 --ram 1024 --disk 10 myflavor

image.png

d- View instance type details in command mode

The first step is to view the list of instance types.

openstack flavor list

image.png
The second step is to view the detailed information of the instance type.

openstack flavor show myflavor

image.png

Guess you like

Origin blog.csdn.net/xiaoyu070321/article/details/131824283