Nova中调度配置:

scheduler_driver_task_period =
scheduler_driver = nova.scheduler.filter_scheduler.FilterScheduler
scheduler_available_filters = nova.scheduler.filters.all_filters
scheduler_default_filters = RetryFilter, AvailabilityZoneFilter,
RamFilter, DiskFilter, ComputeFilter, ComputeCapabilitiesFilter,
ImagePropertiesFilter, ServerGroupAntiAffinityFilter, ServerGroupAffinityFilter

scheduler Filtering

AggregateCoreFilter: 
看组中host上的vcpu个数能否满足创建虚拟机的instancetype中的vcpu个数。 通过 per-aggregate 的 cpu allocation_ratio 参数预定义的 CPU 核数进行过滤, 如果 per-aggregate的值没有被定义则回退到全局配置,如果宿主机在多个 aggregate 组中,且不止一个值被发现,则最小值会被使用

AggregateDiskFilter: 
通过 per-aggregate 的 disk allocation ratio 参数预定义磁盘分配大小.方式过滤方式同上.

AggregateImagePropertiesIsolation: 
匹配属性定义在 image的元数据中,用于对这些 aggregate 组进行匹配:

  • 如果一个 host 属于一个 aggregate,这个 aggregate定义了一个或多个元数据并匹到一个 image 的属性,这个host 会作为通过该 image 启动实例的候选宿主机.
  • 如果一个 host 不属于任何aggregate,则他可以从任何 image 启动虚拟机实例.

比如下面这个 aggregate 分组 myWinAgg 将 windows 系统作为元数据 os=windows

$ nova aggregate-details MyWinAgg
+----+----------+-------------------+------------+---------------+
| Id | Name | Availability Zone | Hosts | Metadata |
+----+----------+-------------------+------------+---------------+
| 1 | MyWinAgg | None | 'sf-devel' | 'os=windows' |
+----+----------+-------------------+------------+---------------+

在这个理子中,因为下面 win-2012的镜像中有 windows 的属性, 通过他启动的虚拟机实例会再 sf-devel 分组上启动.

$ glance image-show Win-2012
+------------------+--------------------------------------+
| Property | Value |
+------------------+--------------------------------------+
| Property 'os' | windows |
| checksum | f8a2eeee2dc65b3d9b6e63678955bd83 |
| container_format | ami |
| created_at | 2013-11-14T13:24:25 |

You can configure the AggregateImagePropertiesIsolation filter by using the following options in the nova.conf file: 
可以通过下面的方式配置AggregateImagePropertiesIsolation过滤

# Considers only keys matching the given namespace (string).
aggregate_image_properties_isolation_namespace = <None> # Separator used between the namespace and keys (string).
aggregate_image_properties_isolation_separator = .

AggregateInstanceExtraSpecsFilter: 
通过额外配置过滤,会匹配定义到设备组中的额外配置.将主机所属的aggregate的metadata属性,与创建虚拟机的instancetype中的extraspecs属性作比较。这个和ComputeCapabilitiesFilter有冲突,两者只能开一个 同时,在extraspecs属性中,支持一些伪操作符(nova\scheduler\filters\extraspecsops.py),比如extraspecs={'mem':'>= 512'},那么host所属的aggregate的metadata={'mem':'1024'}时,就允许创建虚拟机。

ComputeCapabilitiesFilte

  • ComputeCapabilitiesFilter - checks that the capabilities provided by the host compute service satisfy any extra specifications associated with the instance type. It passes hosts that can create the specified instance type.

    If an extra specs key contains a colon (:), anything before the colon is treated as a namespace and anything after the colon is treated as the key to be matched. If a namespace is present and is not capabilities, the filter ignores the namespace. For examplecapabilities:cpu_info:features is a valid scope format. For backward compatibility, the filter also treats the extra specs key as the key to be matched if no namespace is present; this action is highly discouraged because it conflicts with AggregateInstanceExtraSpecsFilter filter when you enable both filters

    The extra specifications can have an operator at the beginning of the value string of a key/value pair. If there is no operator specified, then a default operator of s== is used. Valid operators are:
    http://docs.openstack.org/developer/nova/filter_scheduler.html

AggregateIoOpsFilter 
功能:根据设备组中的设备的IO负载过滤。 IO负载由host->numioops表示,与CONF.maxioopsperhost(默认是8)比较。io,maxioopsperhost.如果机器属于多个设备组,同样会按maxioopsperhost的最小值来应用

AggregateMultiTenancyIsolation 
功能:租户和aggregate对应,实现创建虚拟机时租户独占资源。 host1所属的aggregate的metadata中filtertenantid=['tenant1', 'tenant2'],创建虚拟机的租户是tenant1,那么该虚拟机就允许创建在host1上。如果host1没有加入aggregate,或者aggregate没有配置metadata,则也允许创建虚拟机。

AggregateNumInstancesFilter 
选择那些设备组中hoststate.numinstances < CONF.maxinstancesper_host的主机。

AggregateRamFilter 
与 AggregateColeFilter 相同 ram allocation ratio=1.5

AggregateTypeAffinityFilter 
aggregate->metadata-> instancetype,一个aggregate中只允许创建同一规格的虚拟机。instancetype

AggregateMultiTenancyIsolation

定义host只能创建某些租户的instance

ComputeFilter

host必须是operational and enabled,should always enable this filter

CoreFilter

要保证足够的CPU core,可以设置CPU超用

cpu_allocation_ratio = 16.0

NUMATopologyFilter

根据host的NUMA topology,通过定义instance的 flavorextra_specs和image properties来使用。

DifferentHostFilter

调度到different_host=a0cf03a5-d921-4877-bb5c-86d26cf818e1不同的host上。

$ nova boot --image cedef40a-ed67-4d10-800e-17455edce175 --flavor  \
--hint different_host=a0cf03a5-d921--bb5c-86d26cf818e1 \
--hint different_host=8c19174f--44f0-824a-cd1eeef10287 server-

API

{
"server": {
"name": "server-1",
"imageRef": "cedef40a-ed67-4d10-800e-17455edce175",
"flavorRef": ""
},
"os:scheduler_hints": {
"different_host": [
"a0cf03a5-d921-4877-bb5c-86d26cf818e1",
"8c19174f-4220-44f0-824a-cd1eeef10287"
]
}
}

DiskFilter

调度的hosts需要足够的剩余disk给 root and ephemeral.

$ nova hypervisor-stats
+----------------------+-------+
| Property | Value |
+----------------------+-------+
| count | |
| current_workload | |
| disk_available_least | |
| free_disk_gb | |
| free_ram_mb | |
| local_gb | |
| local_gb_used | |
| memory_mb | |
| memory_mb_used | |
| running_vms | |
| vcpus | |
| vcpus_used | |
+----------------------+-------+

可以看到disk_available_least要小于free_disk_gb, disk_available_least是计算virtual size而不是image的实际大小。如果image是sparse or copy on write,那么它

实际大小要比virtual size小。

调度依据disk_available_least而不是free_disk_gb。

disk_allocation_ratio = 1.0 默认不disk over commitment,如果需要,设置 > 1 ,同时注意 free_disk_gb。它代表的是真实的磁盘空余。

GroupAffinityFilter

已经被ServerGroupAffinityFilter取代了。需要设置scheduler hint,其中,group 为key

$ nova boot --image IMAGE_ID --flavor  --hint group=foo server-

不能和 GroupAntiAffinityFilter同时使用,否则2个都不生效。

ImagePropertiesFilter

根据instance's image上定义的属性来过滤,熟悉包括

architecture, hypervisor type, hypervisor version (for Xen hypervisor type only), and virtual machine mode。

如果image->properties中没有这些属性,则通过过滤;如果有这些属性,而host->capabilities->supportedinstances没有,返回False。

比如,

$ glance image-update img-uuid --property architecture=arm --property hypervisor_type=qemu

IsolatedHostsFilter

定义特殊的image 集合只能运行在特殊的host集合上。设置flag restrict_isolated_hosts_to_isolated_images来enable。

需要事先在nova.conf里面设置isolated_images/isolated_hosts。

比如:

isolated_hosts = server1, server2
isolated_images = 342b492c-128f-4a42-8d3a-c5088cf27d13, ebd267a6-ca86-4d6c-9a0e-bd132d6b7d09

IoOpsFilter

host上的io并发超过max_io_ops_per_host 的会被过滤掉。

JsonFilter

自定义的json格式的scheduler hint。

支持的变量有:

  • $free_ram_mb

  • $free_disk_mb

  • $total_usable_ram_mb

  • $vcpus_total

  • $vcpus_used

比如

$ nova boot --image 827d564a-e636-4fc4-a376-d36f7ebe1747 \
--flavor --hint query='[">=","$free_ram_mb",1024]' server1

在API中使用os:scheduler_hints key:

{
"server": {
"name": "server-1",
"imageRef": "cedef40a-ed67-4d10-800e-17455edce175",
"flavorRef": ""
},
"os:scheduler_hints": {
"query": "[&gt;=,$free_ram_mb,1024]"
}
}

MetricsFilter

根据host上的meters weight_setting来过滤。

NumInstancesFilter

host上的instance数量大于max_instances_per_host则被过滤掉。

PciPassthroughFilter

Host上的设备满足flavor 里面定义的extra_specs 。

RamFilter

可以使用ram_allocation_ratio = 1.5来超用。

RetryFilter

如果调度的host,而host没能相应调度需求的次数超过scheduler_max_attempts,则过滤掉该host。

SameHostFilter

调度到和其他instance相同的host上。使用--hint flag。与DifferentHostFilter正好相反。

$ nova boot --image cedef40a-ed67-4d10-800e-17455edce175 --flavor  \
--hint same_host=a0cf03a5-d921--bb5c-86d26cf818e1 \
--hint same_host=8c19174f--44f0-824a-cd1eeef10287 server-

With the API, use the os:scheduler_hints key:

{
"server": {
"name": "server-1",
"imageRef": "cedef40a-ed67-4d10-800e-17455edce175",
"flavorRef": ""
},
"os:scheduler_hints": {
"same_host": [
"a0cf03a5-d921-4877-bb5c-86d26cf818e1",
"8c19174f-4220-44f0-824a-cd1eeef10287"
]
}
}

ServerGroupAffinityFilter

调度到某一组host上。先要创建带有affinity policy的server-group, instance创建是pass scheduler hint

$ nova server-group-create --policy affinity group-
$ nova boot --image IMAGE_ID --flavor --hint group=SERVER_GROUP_UUID server-

ServerGroupAntiAffinityFilter

each instance in a group is on a different host

$ nova server-group-create --policy anti-affinity group-
$ nova boot --image IMAGE_ID --flavor --hint group=SERVER_GROUP_UUID server-

SimpleCIDRAffinityFilter

基于host的IP subnet range来调度

$ nova boot --image cedef40a-ed67-4d10-800e-17455edce175 --flavor  \
--hint build_near_host_ip=192.168.1.1 --hint cidr=/ server-

TrustedFilter

host需要符合trust requirements

TypeAffinityFilter

根据host上的instance 类型来过滤,比如要求host上不能有不同类型的instance。

http://docs.openstack.org/liberty/config-reference/content/section_compute-scheduler.html

nova Scheduling 配置的更多相关文章

  1. openstack Q版部署-----nova服务配置-计算节点(6)

    一.服务安装(计算节点) 安装软件: yum install openstack-nova-compute -y 编辑/etc/nova/nova.conf文件并设置如下内容: [DEFAULT] e ...

  2. openstack Q版部署-----nova服务配置-控制节点(5)

    一.创建数据库(控制节点) 创建数据库以及用户: CREATE DATABASE nova_api; CREATE DATABASE nova; CREATE DATABASE nova_cell0; ...

  3. S1_搭建分布式OpenStack集群_06 nova服务配置 (控制节点)

    一.创建数据库(控制节点)创建数据库以及用户:# mysql -uroot -p12345678MariaDB [(none)]> CREATE DATABASE nova_api;MariaD ...

  4. nova cell配置

    Configuration option = Default value Description [cells] call_timeout = 60 (IntOpt) Seconds to wait ...

  5. S1_搭建分布式OpenStack集群_07 nova服务配置 (计算节点)

    一.服务安装(计算节点)安装软件:# yum install openstack-nova-compute -y 编辑/etc/nova/nova.conf文件并设置如下内容:# vim /etc/n ...

  6. 《4》CentOS7.0+OpenStack+kvm云平台部署—配置Nova

    感谢朋友支持本博客,欢迎共同探讨交流,因为能力和时间有限,错误之处在所难免,欢迎指正! 假设转载.请保留作者信息. 博客地址:http://blog.csdn.net/qq_21398167 原博文地 ...

  7. OpenStack Nova Release(Rocky to Train)

    目录 文章目录 目录 前言 演进方向 Cellv2 更新 Rocky Support disabling a cell Stein Handling a down cell Train Count q ...

  8. 【OpenStack】OpenStack系列8之Nova详解 Neutron详解

    Neutron下载安装 下载:git clone -b stable/icehouse https://github.com/openstack/neutron.git pip install -r ...

  9. 【OpenStack】OpenStack系列7之Nova详解

    源码下载.安装 参考: https://github.com/yongluo2013/osf-openstack-training/blob/master/installation/openstack ...

随机推荐

  1. 使用国内源(brew, pip, npm)

    如果网络不行,安装依赖包的速度小于 100k/s 或者丢包严重导致安装很慢,我认为就应该使用国内源了.今天因为国内源的问题弄了很久,我觉得在国内服务器部署,全部应该从国内下载资源.分为两种情况, 存在 ...

  2. TimeStamp 毫秒和纳秒

    毫秒 /** * Returns the time represented by this Timestamp object, as a long value * containing the num ...

  3. opencv如何打印长图?

    cv::Mat longMap(std::vector<cv::Mat> &set) { int matNumber = set.size(); int width = set[0 ...

  4. linux下安装mysql问题总结(一)mysqld_safe mysqld from pid file /usr/local/mysql/data/mysql.pid ended

    linux下安装mysql数据库 linux版本:CentOS release 6.8 (Final) mysql版本:mysql-5.7.16-linux-glibc2.5-x86_64.tar.g ...

  5. MySQL root用户忘记密码怎么办?修改密码方法:skip-grant-tables

    忘记密码怎么办? 1.以管理员身份打开cmd2.执行命令tasklist |findstr mysql ,查看正在运行的mysql进程 3.执行命令taskkill /F /PID 13644(此处进 ...

  6. CentOS6.9添加环境变量

    方法一:直接运行命令export PATH=$PATH:~/.composer/vendor/bin 使用这种方法,只会对当前会话有效,也就是说每当登出或注销系统以后,PATH 设置就会失效,只是临时 ...

  7. android studio 和gradle版本问题解决

    打开android studio 开始导入一个 covrdova项目 结果弹出一个这样的对话框意思是  "尚未配置此项目的 gradle" "是否希望项目使用gradle ...

  8. Nginx图片及样式文件不记录访问日志

    1.Nginx作为web服务器是可直接在server配置文件中做如下配置: server { listen ; server_name www.fansik.com; access_log /data ...

  9. ggplot2画图时标题无法居中的问题

    折腾了一天,终于好了.应该是版本的问题.在R3.2.2能居中(别问我为什么知道),在R3.3.2上就不能.解决方式如下: library(ggplot2) ggplot(data=mtcars, ae ...

  10. 爬虫五 Beautifulsoup模块详细

    一.基本使用 from bs4 import BeautifulSoup htmlCharset = "GB2312" soup=BeautifulSoup(html_doc,'l ...