【OpenStack】Nova目前的filter及其功能

来源:互联网 发布:ubuntu可以安装在u盘 编辑:程序博客网 时间:2024/06/05 18:46

转载自  http://blog.csdn.net/lynn_kong/article/details/9354455

 

关于filter的抽象逻辑结构和机制,在我之前的博客中有讲到,本篇博客的关注点在于Nova目前提供了哪些host filter,以及他们提供的功能。

1、affinity_filter.py

这里文件里其实有四个可用filter,都是关于亲和性的调度策略,分别如下:

DifferentHostFilter

创建虚拟机的同时可以指定一些虚拟机,要求新的虚拟机不能在这些虚拟机所在主机上创建。
说的简单一点,在host1上运行着vm1,要创建vm2,创建时指定了scheduler_hints->different_host=[vm1],那么vm2就不会在host1上创建。

SameHostFilter

与上面的filter功能相反,如果创建时指定了scheduler_hints-> same_host=[vm1],那么vm2就可以创建在host1上。

SimpleCIDRAffinityFilter

如果指定了scheduler_hints-> build_near_host_ip,那么只能在host1的管理IP网段内选择主机。

GroupAntiAffinityFilter

功能:指定scheduler_hints-> group_hosts=[host1, host2],那么虚拟机不能创建在这些host上。

2、aggregate_instance_extra_specs.py

AggregateInstanceExtraSpecsFilter

功能:将主机所属的aggregate的metadata属性,与创建虚拟机的instance_type中的extra_specs属性作比较。
同时,在extra_specs属性中,支持一些伪操作符(nova\scheduler\filters\extra_specs_ops.py),比如extra_specs={'mem':'>= 512'},那么host所属的aggregate的metadata={'mem':'1024'}时,就允许创建虚拟机。

3、aggregate_multitenancy_isolation.py

AggregateMultiTenancyIsolation

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

4、all_hosts_filter.py

AllHostsFilter

功能:不设置任何过滤规则

5、availability_zone_filter.py

AvailabilityZoneFilter

功能:保证虚拟机所属的availability_zone与host所属的availability_zone一致
如果创建时没有指定availability_zone,那么允许;否则就看是否与host所属aggregate的metadata['availability_zone']匹配。

6、compute_capabilities_filter.py

ComputeCapabilitiesFilter

功能:根据host的capabilities判断是否允许创建虚拟机。
将host->capabilities与虚拟机的instance_type->extra_specs作比较,比较方法类似于AggregateInstanceExtraSpecsFilter

7、compute_filter.py

ComputeFilter

功能:根据主机的状态和服务的可用性过滤

8、core_filter.py

CoreFilter

功能:看host上的vcpu个数能否满足创建虚拟机的instance_type中的vcpu个数。
根据CONF.cpu_allocation_ratio(默认是16)确定host上当前的vcpus_total。

AggregateCoreFilter

功能:同上
根据host所属的aggregate的metadata-> cpu_allocation_ratio,选取最小值作为ratio

9、disk_filter.py

DiskFilter

功能:看host上的disk大小能否满足创建虚拟机的instance_type中的(root_gb + ephemeral_gb)。
计算disk总量时,会根据CONF.disk_allocation_ratio计算

10、image_props_filter.py

ImagePropertiesFilter

功能:看虚拟机image->properties中某些属性是否在host的capabilities->supported_instances内。
属性包括:architecture、hypervisor_type、vm_mode。如果image->properties中没有这些属性,则通过过滤;如果有这些属性,而host->capabilities->supported_instances没有,返回False。

11、io_ops_filter.py

IoOpsFilter

功能:根据主机的IO负载过滤。
IO负载由host->num_io_ops表示,与CONF.max_io_ops_per_host(默认是8)比较。

12、isolated_hosts_filter.py

IsolatedHostsFilter

功能:如果没有配置CONF.isolated_images,当前host不在CONF.isolated_hosts中,返回True;如果虚拟机image_ref在CONF.isolated_images中,且host在CONF.isolated_hosts中,返回True;其他情况返回False。

13、json_filter.py

JsonFilter

入参中的scheduler_hints->query,类似于['=', 'mem', '512'],对host_state相关属性进行比较。

14、num_instances_filter.py

NumInstancesFilter

选择那些host_state.num_instances < CONF.max_instances_per_host的主机。

15、ram_filter.py

RamFilter

AggregateRamFilter

同CoreFilter相同。CONF.ram_allocation_ratio=1.5

16、retry_filter.py

RetryFilter

用于nova-scheduler的retry机制,看本机是否在retry->hosts里。

17、trusted_filter.py

TrustedFilter

支持Trusted Computing Pools。根据instance_type-> extra_specs-> trust:trusted_host,校验主机是否可信。

18、type_filter.py

TypeAffinityFilter

如果该主机上存在规格不为instance_type的虚拟机,返回False,也就是保证一个主机上只允许创建相同规格的虚拟机。

AggregateTypeAffinityFilter

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

原创粉丝点击