说明:
主参考:https://www.sunmite.com/openstack/use-local-storage-for-different-hypervisors.html
控制节点上执行:
1.配置nova调度程序支持AggregateInstanceExtraSpecsFilter过滤算法
openstack-config --set /etc/nova/nova.conf DEFAULT scheduler_default_filters RetryFilter,AvailabilityZoneFilter,RamFilter,ComputeFilter,ComputeCapabilitiesFilter,ImagePropertiesFilter,ServerGroupAntiAffinityFilter,ServerGroupAffinityFilter,AggregateInstanceExtraSpecsFilter
systemctl restart openstack-nova-scheduler.service
2.创建两个主机集合,包含ceph compute nodes 和 local storage compute nodes
nova aggregate-create ephemeral-compute-storage
nova aggregate-create ceph-compute-storage
3.查看计算节点的名称
source ~/admin-openrc
nova hypervisor-list
得到四台主机:
compute-1.ideal.yfb0801800.islab.net.cn
compute-2.ideal.yfb0801800.islab.net.cn
compute-3.ideal.yfb0801800.islab.net.cn
compute-4.ideal.yfb0801800.islab.net.cn
4.分别添加主机到不同的主机集合(一台主机只能添加到一个主机集合中)
nova aggregate-add-host ephemeral-compute-storage compute-1.ideal.yfb0801800.islab.net.cn
nova aggregate-add-host ephemeral-compute-storage compute-2.ideal.yfb0801800.islab.net.cn
nova aggregate-add-host ephemeral-compute-storage compute-3.ideal.yfb0801800.islab.net.cn
nova aggregate-add-host ceph-compute-storage compute-4.ideal.yfb0801800.islab.net.cn
5.为主机集合创建新的metadata
nova aggregate-set-metadata ephemeral-compute-storage ephemeralcomputestorage=true
nova aggregate-set-metadata ceph-compute-storage cephcomputestorage=true
6.为使用本地存储和ceph存储的虚拟机创建flavor
openstack flavor create --vcpus 2 --ram 4096 --disk 40 m1.ephemeral-compute-storage
openstack flavor create --vcpus 2 --ram 4096 --disk 40 m1.ceph-compute-storage
7.为flavor绑定指定的属性
nova flavor-key m1.ceph-compute-storage set aggregate_instance_extra_specs:cephcomputestorage=true
nova flavor-key m1.ephemeral-compute-storage set aggregate_instance_extra_specs:ephemeralcomputestorage=true
计算节点上执行:
1.本地存储配置
nova默认支持,无需配置。为了支持迁移可以配置共享存储(NFS等)
2.ceph存储配置
编辑计算节点的 /etc/nova/nova.conf 文件加入修改以下选项,然后重启nova-compute服务(这里没有详细写,例如导入secret-uuid等操作请自行添加)
vim /etc/nova/nova.conf
[libvirt]
images_type = rbd
images_rbd_pool = vms
images_rbd_ceph_conf = /etc/ceph/ceph.conf
rbd_user = cinder
rbd_secret_uuid =20c3fd98-2bab-457a-b1e2-12e50dc6c98e
disk_cachemodes="network=writeback"
inject_partition=-2
inject_key=False
live_migration_flag=VIR_MIGRATE_UNDEFINE_SOURCE,VIR_MIGRATE_PEER2PEER,VIR_MIGRATE_LIVE,VIR_MIGRATE_PERSIST_DEST
systemctl restart openstack-nova-compute.service
原文地址:https://www.cnblogs.com/jipinglong/p/11212474.html