nova Flavors

$ nova help | grep flavor-
  flavor-access-add     Add flavor access for the given tenant.
  flavor-access-list    Print access information about the given flavor.
  flavor-access-remove  Remove flavor access for the given tenant.
  flavor-create         Create a new flavor
  flavor-delete         Delete a specific flavor
  flavor-key            Set or unset extra_spec for a flavor.
  flavor-list           Print a list of available ‘flavors‘ (sizes of
  flavor-show           Show details about the given flavor.

Flavors define these elements:

Element Description
Name 一般不需要,直接使用flavor ID.
Memory_MB 虚拟机内存
Disk Virtual root disk size in gigabytes. This is an ephemeral disk that the base image is copied into. When booting from a persistent volume it is not used. The “0” size is a special case which uses the native base image size as the size of the ephemeral root volume.
Ephemeral Specifies the size of a secondary ephemeral data disk. This is an empty, unformatted disk and exists only for the life of the instance.
Swap Optional swap space allocation for the instance.
VCPUs Number of virtual CPUs presented to the instance.
RXTX_Factor Optional property allows created servers to have a different bandwidth cap than that defined in the network they are attached to. This factor is multiplied by the rxtx_base property of the network. Default value is 1.0. That is, the same as attached network. This parameter is only available for Xen or NSX based systems.
Is_Public Boolean value, whether flavor is available to all users or private to the tenant it was created in. 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. Use to implement special resources, such as flavors that run on only compute nodes with GPU hardware.

Flavor customization

CPU limits

  • cpu_shares. CPU相对权重,如VM的cpu权重为2048的要比1024得到2倍的CPU时间,如果不设置,则又主机默认设置。
  • cpu_shares_level. 用在 VMWare上, 与cpu_shares作用相似. 可以为customhigh,normal, or low. 如果是 custom, 需要设置cpu_shares_share来决定cpu权重.
  • cpu_period. Specifies the enforcement interval (unit: microseconds) for QEMU and LXC hypervisors. 在一个period周期, 该VM的每个VCPU运行时间不能超过 quota. 设置值的范围为[1000, 1000000]. A period with value 0 means no value.
  • cpu_limit. Specifies the upper limit for VMware machine CPU allocation in MHz. This parameter ensures that a machine never uses more than the defined amount of CPU time. It can be used to enforce a limit on the machine’s CPU performance.
  • cpu_reservation. Specifies the guaranteed minimum CPU reservation in MHz for VMware. This means that if needed, the machine will definitely get allocated the reserved amount of CPU cycles.
  • cpu_quota. Specifies the maximum allowed bandwidth (unit: microseconds). A domain with a negative-value quota indicates that the domain has infinite bandwidth, which means that it is not bandwidth controlled. The value should be in range [1000,18446744073709551] or less than 0. A quota with value 0 means no value. You can use this feature to ensure that all vCPUs run at the same speed. For example:
$ nova flavor-key m1.low_cpu set quota:cpu_quota=10000
$ nova flavor-key m1.low_cpu set quota:cpu_period=20000

Memory limits

For VMware, you can configure the memory limits with control parameters.

Use these optional parameters to limit the memory allocation, guarantee minimum memory reservation, and to specify shares used in case of resource contention:

  • memory_limit: Specifies the upper limit for VMware machine memory allocation in MB. The utilization of a virtual machine will not exceed this limit, even if there are available resources. This is typically used to ensure a consistent performance of virtual machines independent of available resources.
  • memory_reservation: Specifies the guaranteed minimum memory reservation in MB for VMware. This means the specified amount of memory will definitely be allocated to the machine.
  • memory_shares_level: On VMware, specifies the allocation level. This can be custom,highnormal or low. If you choose custom, set the number of shares usingmemory_shares_share.
  • memory_shares_share: Specifies the number of shares allocated in the event thatcustom is used. There is no unit for this value. It is a relative measure based on the settings for other VMs. For example:
    $ nova flavor-key m1.medium set quota:memory_shares_level=custom
    $ nova flavor-key m1.medium set quota:memory_shares_share=15

Disk I/O limits

For VMware, you can configure the resource limits for disk with control parameters.

Use these optional parameters to limit the disk utilization, guarantee disk allocation, and to specify shares used in case of resource contention. This allows the VMWare driver to enable disk allocations for the running instance.

  • disk_io_limit: Specifies the upper limit for disk utilization in I/O per second. The utilization of a virtual machine will not exceed this limit, even if there are available resources. The default value is -1 which indicates unlimited usage.
  • disk_io_reservation: Specifies the guaranteed minimum disk allocation in terms of IOPS.
  • disk_io_shares_level: Specifies the allocation level. This can be customhigh,normal or low. If you choose custom, set the number of shares usingdisk_io_shares_share.
  • disk_io_shares_share: Specifies the number of shares allocated in the event thatcustom is used. When there is resource contention, this value is used to determine the resource allocation.

    The example below sets the disk_io_reservation to 2000 IOPS.

    $ nova flavor-key m1.medium set quota:disk_io_reservation=2000
    

Disk tuning

Using disk I/O quotas, you can set maximum disk write to 10 MB per second for a VM user. For example:

$ nova flavor-key m1.medium set quota:disk_write_bytes_sec=10485760

The disk I/O options are:

  • disk_read_bytes_sec
  • disk_read_iops_sec
  • disk_write_bytes_sec
  • disk_write_iops_sec
  • disk_total_bytes_sec
  • disk_total_iops_sec

Bandwidth I/O

The vif I/O options are:

  • vif_inbound_ average
  • vif_inbound_burst
  • vif_inbound_peak
  • vif_outbound_ average
  • vif_outbound_burst
  • vif_outbound_peak

Incoming and outgoing traffic can be shaped independently. The bandwidth element can have at most, one inbound and at most, one outbound child element. If you leave any of these child elements out, no quality of service (QoS) is applied on that traffic direction. So, if you want to shape only the network’s incoming traffic, use inbound only (and vice versa). Each element has one mandatory attribute average, which specifies the average bit rate on the interface being shaped.

There are also two optional attributes (integer): peak, which specifies the maximum rate at which a bridge can send data (kilobytes/second), and burst, the amount of bytes that can be burst at peak speed (kilobytes). The rate is shared equally within domains connected to the network.

The example below sets network traffic bandwidth limits for existing flavor as follows:

  • Outbound traffic:

    • average: 256 Mbps (32768 kilobytes/second)
    • peak: 512 Mbps (65536 kilobytes/second)
    • burst: 65536 kilobytes
  • Inbound traffic:
    • average: 256 Mbps (32768 kilobytes/second)
    • peak: 512 Mbps (65536 kilobytes/second)
    • burst: 65536 kilobytes
$ nova flavor-key nlimit set quota:vif_outbound_average=32768
$ nova flavor-key nlimit set quota:vif_outbound_peak=65536
$ nova flavor-key nlimit set quota:vif_outbound_burst=65536
$ nova flavor-key nlimit set quota:vif_inbound_average=32768
$ nova flavor-key nlimit set quota:vif_inbound_peak=65536
$ nova flavor-key nlimit set quota:vif_inbound_burst=65536

Note

All the speed limit values in above example are specified in kilobytes/second. And burst values are in kilobytes.

Random-number generator

如果一个random-number generator device 通过image properties添加到vm, 可以在flavor来enable和设置(如果没有对应的device?):

$ nova flavor-key FLAVOR-NAME set hw_rng:allowed=True
$ nova flavor-key FLAVOR-NAME set hw_rng:rate_bytes=RATE-BYTES
$ nova flavor-key FLAVOR-NAME set hw_rng:rate_period=RATE-PERIOD

Where:

  • RATE-BYTES—(Integer) 每个周期可以从host的entropy 读取多少字节.
  • RATE-PERIOD—(Integer) 每个周期多少秒.

Watchdog behavior

如果VM server hangs. The watchdog uses the i6300esb device (emulating a PCI Intel 6300ESB). If hw:watchdog_action is not specified, the watchdog is disabled.

To set the behavior, use:

$ nova flavor-key FLAVOR-NAME set hw:watchdog_action=ACTION

Valid ACTION values are:

  • disabled—(default) The device is not attached.
  • reset—Forcefully reset the guest.
  • poweroff—Forcefully power off the guest.
  • pause—Pause the guest.
  • none—Only enable the watchdog; do nothing if the server hangs.

Note

image’s watchdog 设置会覆盖flavors的设置.

CPU toplogy

设置vm的cpu toplogy。 max limit类型的设置也可以通过image 属性来设置.

$ nova flavor-key FLAVOR-NAME set hw:cpu_sockets=FLAVOR-SOCKETS
$ nova flavor-key FLAVOR-NAME set hw:cpu_cores=FLAVOR-CORES
$ nova flavor-key FLAVOR-NAME set hw:cpu_threads=FLAVOR-THREADS
$ nova flavor-key FLAVOR-NAME set hw:cpu_max_sockets=FLAVOR-SOCKETS
$ nova flavor-key FLAVOR-NAME set hw:cpu_max_cores=FLAVOR-CORES
$ nova flavor-key FLAVOR-NAME set hw:cpu_max_threads=FLAVOR-THREADS

Where:

  • FLAVOR-SOCKETS—(Integer) The number of sockets for the guest VM. By this is set to the number of vCPUs requested.
  • FLAVOR-CORES—(Integer) The number of cores per socket for the guest VM. By this is set to 1.
  • FLAVOR-THREADS—(Integer) The number of threads per core for the guest VM. By this is set to 1.

Project private flavors

默认是public,所有租户都可用。

$ nova flavor-create --is-public false p1.medium auto 512 40 4
$ nova flavor-access-add 259d06a0-ba6d-4e60-b42d-ab3144411d58 86f94150ed744e08be565c2ff608eef9

http://docs.openstack.org/admin-guide-cloud/compute-flavors.html

时间: 2024-08-29 13:01:22

nova Flavors的相关文章

Nova 通过Python API 查询,创建,删除flavor

1 [[email protected] ~]# cat flavor.py 2 from novaclient import client as nvclient 3 from novaclient import utils 4 from novaclient import base 5 6 from keystoneauth1.identity import v3 7 from keystoneauth1 import session 8 from keystoneclient.v3 imp

The novaclient Python API

The novaclient Python API Usage First create a client instance with your credentials: >>> from novaclient.client import Client >>> nova = Client(VERSION, USERNAME, PASSWORD, PROJECT_ID, AUTH_URL) Here VERSION can be: 1.1, 2 and 3. Altern

Openstack python api 学习文档

Openstack python api 学习文档 转载请注明http://www.cnblogs.com/juandx/p/4953191.html 因为需要学习使用api接口调用openstack,所以上一篇写了一些使用openstack的纯api调用的方法, 但是openstack还提供了更好的python的api,只需要python的包即可,感觉更好使用. 对于compute的api,包是放在了/usr/lib/python2.7/site-packages/novaclient/目录,

《openstack-nova》use-novaclient 创建虚拟机(createvms.py)

import sys import time import keystoneclient.v2_0.client as keystoneclient import novaclient.v1_1.client as novaclient import neutronclient.v2_0.client as neutronclient from credentials import * ''' Creates a network and a COUNT of instances using th

OpenStack 学习笔记(五):OpenStack nova服务搭建

--先决条件 1.)创建数据库 MariaDB [(none)]> CREATE DATABASE nova; Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> GRANT ALL ON nova.* TO 'nova'@'%' IDENTIFIED BY 'nova'; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> GRANT ALL ON nova.* TO 'n

nova api源码分析(二)

转载于:http://www.it165.net/pro/html/201407/17020.html (经过部分编辑) 一.使用到的库或组件如下: paste.deploy 用来解析/etc/nova/api-paste.ini文件,加载用于服务的wsgi app.它的功能有: 1.api-paste.ini中配置多个wsgi app,deploy可根据传入的app name加载指定的wsgi app: deploy.loadapp("config:/etc/nova/api-paste.in

OpenStack Mitaka Nova API 接口扩展之instance_resize

# Mitaka NOVA API 接口开发 背景: OpenStack官方默认Resize接口支持local storage 不是很好,问题很多,因此重新定 制Resize接口,实现云主机套餐变更,比之前的接口提高了很多时间 ### 配置 Resize 路由 vim /usr/lib/python2.7/site-packages/nova-13.1.0-py2.7.egg-info/entry_points.txt  [nova.api.v21.extensions]          in

nova

[email protected]:~$ nova usage: nova [--version] [--debug] [--os-cache] [--timings] [--timeout <seconds>] [--os-auth-token OS_AUTH_TOKEN] [--os-username <auth-user-name>] [--os-password <auth-password>] [--os-tenant-name <auth-tenant

OpenStack nova VM migration (live and cold) call flow

OpenStack nova compute supports two flavors of Virtual Machine (VM) migration: Cold migration -- migration of a VM which requires the VM to be powered off during the migrate operation during which time the VM is inaccessible. Hot or live migration --