- When multiple instances are created simultaneously through UI or Heat templates most of the instances are scheduled on the same hypervisor.
- How to configure nova-scheduler to select different hypervisor for each instance when multiple instances are created in batch?
- Platform9 Managed OpenStack - All Versions
The nova-scheduler is responsible for selecting the hypervisor to schedule the instances. It has the concept of filters and weights where filters will filter out hosts based on certain criteria like host capabilities, host aggregate, etc. while weights will weigh the hosts based on measurable factors, such as RAM, CPU, IOPS, and other metrics. There might be a way in which the scheduler is able to configure to multiply the weights in a way that one factor is weighed more than the another, but, there is no such weight directly pertaining to the spread of instances based on the count. You can read more about it in OpenStack Documentation.
- As a workaround, you can try using soft-anti-affinity groups. It will try to ensure that each instance is scheduled onto a different hypervisor, where possible, after considering the other filters and weights. If the number of instances to be created are more than the total number of hosts available it will allow scheduling of some instances on the same host.
- The soft-anti-affinity policy is currently supported using the OpenStack CLI.
You can refer to the article Create-Soft-Affinity-Anti-Affinity-Server-Groups for more detailed steps on creating soft-anti-affinity-policy.