$ 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 vm的root磁盘,base image会被copy到这上面。当从一个 persistent volume启动时这个参数不被用到。
Ephemeral vm的第二个磁盘,随vm的消失而消失。没有被格式化
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

k/v键值,定义flavor可以运行在那些计算节点上。键值必须与计算节点上的键值匹配,用来实现某些特殊的资源,比如定义flavor只可以运行在有GPU硬件的node上。

Flavor customization

CPU limits

  • cpu_shares. CPU相对权重,如VM的cpu权重为2048的要比1024得到2倍的CPU时间,如果不设置,则又主机默认设置。

  • cpu_shares_level. 用在 VMWare上, 与cpu_shares作用相似. 可以为custom, high,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=
$ nova flavor-key m1.low_cpu set quota:cpu_period=

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: 虚拟机最大内存.

  • memory_reservation:  VMware上虚拟机最少/保证有的内存

  • memory_shares_level: On VMware, specifies the allocation level. This can be custom,high, normal or low. If you choose custom, set the number of shares usingmemory_shares_share.

  • memory_shares_share:

    $ 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

用在VMware上,与cpu/内存设置类似。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 custom, high,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
$ nova flavor-access-add 259d06a0-ba6d-4e60-b42d-ab3144411d58 86f94150ed744e08be565c2ff608eef9

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

nova Flavors的更多相关文章

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

    [root@controller ~]# cat flavor.py from novaclient import client as nvclient from novaclient import ...

  2. Python调用 Openstack 主要服务(keystone,nova,glance,neutron,heat)

    由于Openstack更新很快,现在准备搭建基于Queen版本的Openstack,Queen版本要求keystone版本为V3,所以之前大多数接口都不能用了,百度了一下都没有比较新的实例,官方文档又 ...

  3. The novaclient Python API

    The novaclient Python API Usage First create a client instance with your credentials: >>> f ...

  4. Openstack python api 学习文档 api创建虚拟机

    Openstack python api 学习文档 转载请注明http://www.cnblogs.com/juandx/p/4953191.html 因为需要学习使用api接口调用openstack ...

  5. trove datastore 浅析

    以下代码来自trove/datastore该目录下一共有4个文件__init__,views,models,service大概关系(主要是wsgi吧,没仔细学过,简单的从代码上做推测),service ...

  6. novaclient开发中遇到的问题小结

    1. 使用官网实例代码,并不能新建client; from novaclient import client nova = client.Client(VERSION, USERNAME, PASSW ...

  7. Flavors

    Flavors¶ Flavor interface. class novaclient.v1_1.flavors.Flavor(manager, info, loaded=False) Bases: ...

  8. OpenStack nova VM migration (live and cold) call flow

    OpenStack nova compute supports two flavors of Virtual Machine (VM) migration: Cold migration -- mig ...

  9. nova

    chen@controller:~$ nova usage: nova [--version] [--debug] [--os-cache] [--timings]             [--ti ...

随机推荐

  1. 关于angularjs的复选框选中

    最近在做复选框,业务人员要求选中一块区域里的任何一个适合,复选框呈现选中状态,然而,我的复选框是ng-repeat出来的,刚开始我想用directive指令,但是不知道为什么,我一旦设置了$(this ...

  2. Mybatis Insert 返回主键ID

    <insert id="insert" useGeneratedKeys="true" keyProperty="u_Id" para ...

  3. 阿里云服务器 进行zookeeper集群时候的肯!

    首先我本地虚拟机 部署过N次没什么问题! 擦,上了云就启动后不能正常节点之间连接和发现! 这上面有手误 擦,吧编号的2 打成22 了,这个看下日志就解决了 重点是zoo.conf 中的IP进行配置时候 ...

  4. KVC示例

    KVC –key value Coding,可以让我们通过键值编码的形式进行属性值的赋值 参考苹果官网的图.. 1.KVC 定义一个Person类 .h文件 1: #import <Founda ...

  5. MySQL错误日志提示innodb_table_stats和innodb_index_stats不存在故障处理

    查看MySQL error日志,发现有如下报错 7efbc586f700 InnoDB: Error: Table "mysql"."innodb_table_stats ...

  6. python面试题(四)

    1 常用字符串格式化哪几种? 最方便的 print('hello %s and %s' % ('df', 'another df')) 复制代码 但是,有时候,我们有很多的参数要进行格式化,这个时候, ...

  7. sql语句备份/导入 mysql数据库或表命令

    版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/qq1355541448/article/details/30049851

  8. 通过实例来分析I2C基本通信协议

    本文旨在用最通俗易懂的方式.让大家明确I2C通信的过程到底是怎么回事. I2C起源于飞利浦公司的电视设计,但之后朝通用路线发展,各种电子设计都有机会用到I2C 总的来说,I2C能够简单归纳为,两根线, ...

  9. 如何高效地分析Android_log中的问题?——查看Android源码

    在日常解bugs时,需要通过log日志来分析问题,例如查看crash发生时的堆栈信息时,就会有Android的源码的调用,这是就要去查看Android源码. 1.进入Android源码网址查看,例如  ...

  10. 理解spring中的BeanFactory和FactoryBean的区别与联系

    原文地址:http://blog.csdn.net/joenqc/article/details/66479154 首先,这俩都是个接口… 实现 BeanFactory 接口的类表明此类事一个工厂,作 ...