前言
使用openstack中的AggregateImagePropertiesIsolation实现分区调度镜像
一、用途
为了实现Windows镜像,Linux镜像的分区调度
二、原理
利用镜像属性进行区分调度
代码分析得知:
1.主机组没有属性(metedate)直接通过
2.如果镜像属性和主机组的metedata一致则会通过(调度到相应主机组上)。
3.镜像没有metedata,则不会筛选掉主机组,正常调度(会在日志显示warning,AttributeError)
4.镜像有属性,主机组有属性,但是主机组的metedata与镜像不一致,则不会通过
三、使用步骤
1.修改配置文件
vim /etc/nova/nova.conf
enabled_filters配置AggregateImagePropertiesIsolation
systemctl restart openstack-nova-scheduler
2.属性配置
所有image文件配置metadata
openstack image set --property os_type=windows <image_id>
openstack image set --property os_type=linux <image_id>
3.创建所有主机组
nova aggregate-create <name> [<availability-zone>]
4.所有主机组配置metadata
nova aggregate-set-metadata <aggregate_id> os_type=windows
nova aggregate-set-metadata <aggregate_id> os_type=linux
测试完成分区调度