- nova aggregates
Last active
February 16, 2017 09:13
-
-
Save zhanghui9700/48144e05afbec1244dec61636ae511c7 to your computer and use it in GitHub Desktop.
nova aggregates
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
aggregates
what's aggregates in nova
Aggregates是在 OpenStack 的 Regions 和 Availability Zones 之后被提出来,并建立于 Availability Zones 基础之上更进一步划分 computes 节点物理资源的一种机制。
Availability Zones 通常是对 computes 节点上的资源在小的区域内进行逻辑上的分组和隔离。例如在同一个数据中心,我们可以将 Availability Zones 规划到不同的机房,或者在同一机房的几个相邻的机架,从而保障如果某个 Availability Zone 的节点发生故障(如供电系统或网络),而不影响其他的 Availability Zones 上节点运行的虚拟机,通过这种划分来提高 OpenStack 的可用性。目前 OpenStack 默认的安装是把所有的 computes 节点划分到 nova 的 Availability Zone 上。
Host Aggregates 是在 Availability Zones 的基础上更进一步地进行逻辑的分组和隔离。例如我们可以根据不同的 computes 节点的物理硬件配置将具有相同共性的物理资源规划在同一 Host Aggregate 之下,或者根据用户的具体需求将几个 computes 节点规划在具有相同用途的同一 Host Aggregate 之下,通过这样的划分有利于提高 OpenStack 资源的使用效率。使用场景如下:
az对用户是可见的,aggregates只对程序可见,由nova-scheduler使用。
查看nova源码下的ls scheduler/filters
nova help | grep 'aggregate
nova help aggregate-create
新建一个aggregate
root@node-6:~# nova availability-zone-list
root@node-6:~# nova service-list
root@node-6:~# nova aggregate-create cpu/xeon-e7 nova
root@node-6:~# nova hypervisor-list
root@node-6:~# nova aggregate-add-host cpu/xeon-e7 node-4.suninfo.com
确认添加AggregateInstanceExtraSpecsFilter到nova.conf的scheduler_default_filters
整合aggregates和flavor, 选择flavor后自动调度到相应的aggregates meta匹配的计算节点
root@node-6:~# nova aggregate-set-metadata cpu/xeon-e7 cpu=xeon-e7
root@node-6:~# nova flavor-create cpu.xeon-e7 auto 4096 10 2
root@node-6:~# nova flavor-key cpu.xeon-e7 set aggregate_instance_extra_specs:cpu=xeon-e7
再创建一个测试用的flavor,规格相同,extra_specs不同
root@node-6:~# nova flavor-create cpu.xeon-e5 auto 4096 10 2
root@node-6:~# nova flavor-key cpu.xeon-e5 set aggregate_instance_extra_specs:cpu=xeon-e5
测试,通过flavor启动vm
nova boot --image 027e7611-c85f-4097-8d66-eab63f620987 --flavor cpu.xeon-e5 --nic net-id=a18d722f-1edf-4e17-a86d-a96c45fcaaaf aggregate-test-vm
nova boot --image 027e7611-c85f-4097-8d66-eab63f620987 --flavor cpu.xeon-e7 --nic net-id=a18d722f-1edf-4e17-a86d-a96c45fcaaaf aggregate-test-vm
warning
root@node-6:~# nova aggregate-add-host cpu/xeon-e5 node-4.suninfo.com
一个nova-compute节点只能在一个az内,但是可以存在多个aggregate内。
ComputeCapabilitiesFilter
也会使用flavor的extra-specs去和host-state的属性做对比,所以flavor的extra-spece key需要根据一定的规则跳过ComputeCapabilitiesFilter的检查, key名称用此格式"TYPE:KEY", type只要不等于"capabilities"即可跳过AggregateInstanceExtraSpecsFilter
的metadata key也需要一些规则约束,key名称使用格式flavor extra-specs中的"aggregate_instance_extra_specs:KEY"中的KEY部分一个计算节点属于多个aggregate,并且具有相同的metadata key,那么这个host的key对应的值为set集合,匹配规则为任一个满足即可。
ATTENTION
REFERENCES:
host-aggregate