OpenStack-Nova目前的filter及其功能
2013-07-20 14:57
204 查看
原博客地址:http://blog.csdn.net/lynn_kong
关于filter的抽象逻辑结构和机制,在我之前的博客中有讲到,本篇博客的关注点在于Nova目前提供了哪些host filter,以及他们提供的功能。
说的简单一点,在host1上运行着vm1,要创建vm2,创建时指定了scheduler_hints->different_host=[vm1],那么vm2就不会在host1上创建。
同时,在extra_specs属性中,支持一些伪操作符(nova\scheduler\filters\extra_specs_ops.py),比如extra_specs={'mem':'>= 512'},那么host所属的aggregate的metadata={'mem':'1024'}时,就允许创建虚拟机。
host1所属的aggregate的metadata中filter_tenant_id=['tenant1', 'tenant2'],创建虚拟机的租户是tenant1,那么该虚拟机就允许创建在host1上。如果host1没有加入aggregate,或者aggregate没有配置metadata,则也允许创建虚拟机。
如果创建时没有指定availability_zone,那么允许;否则就看是否与host所属aggregate的metadata['availability_zone']匹配。
将host->capabilities与虚拟机的instance_type->extra_specs作比较,比较方法类似于AggregateInstanceExtraSpecsFilter
根据CONF.cpu_allocation_ratio(默认是16)确定host上当前的vcpus_total。
根据host所属的aggregate的metadata-> cpu_allocation_ratio,选取最小值作为ratio
计算disk总量时,会根据CONF.disk_allocation_ratio计算
属性包括:architecture、hypervisor_type、vm_mode。如果image->properties中没有这些属性,则通过过滤;如果有这些属性,而host->capabilities->supported_instances没有,返回False。
IO负载由host->num_io_ops表示,与CONF.max_io_ops_per_host(默认是8)比较。
关于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.516、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中只允许创建同一规格的虚拟机。相关文章推荐
- 【OpenStack】Nova目前的filter及其功能
- OpenStack-Nova的filter及其功能
- 通过Openstack + novadocker创建有存储功能的docker
- openstack-nova添加镜像预分发功能
- openstack nova 基础知识——scheduler的filter和weight
- OpenStack之Nova的功能
- OpenStack 之Nova添加扩展API流程,附带资源的查找功能
- OpenStack 之Nova添加扩展API流程,附带资源的查找功能
- 企业博客目前的发展状态及其主要功能
- openstack nova后端使用ceph rbd(增加在线迁移live_migrate和快照snapshot功能)
- OpenStack 之Nova添加扩展API流程,附带资源的查找功能
- HTMLParser的功能及实现之Filter模式
- web.xml 中的listener、 filter、servlet 加载顺序及其详解
- 三、RFID系统组成及其功能(第一次作业)
- openstack安装部署之Nova