Hello,
I would like to know if it is possible to configure scheduler and ranking to get this behaviour:
a VM is placed in hypervisor #1
the next VM resume should be at the same hypervisor only if avaliable CPUs is over 10%, that is to say, even hypervisor #1 has assigned 85 CPUs from its 100 CPUs, I want that my VM resumes in hypervisor #1
however, if hypervisor #1 has assigned 90 or more of its 100 CPUs, then my VM should be resumed in hypervisor #2
I have read at https://docs.opennebula.io/7.0/product/operation_references/configuration_references/template/#template-rank that something like>
SCHED_REQUIREMENTS = “FREE_CPU > 10” defined inside the template could be the solution, but I’m not sure about that.
Is it the correct policy for my question?
Thanks.
mkutouski
(Mikalai Kutouski)
October 27, 2026, 5:07pm
2
Hello @Daniel_Ruiz_Molina !
We would suggest to use CPU_USAGE host attribute instead of FREE_CPU because the first one is the allocated CPU metric whereas the second one is the monitored free CPU metric. In other words, FREE_CPU measures actual free CPU reported by monitoring, not CPU capacity already allocated to VMs.
You can find a description of these two host attributes as well as others in our documentation .
( OpenNebula expresses these CPU attributes in units of 100 per core. Therefore, 90 allocated cores correspond to CPU_USAGE = 9000).
Please, add the following two attributes in the VM template:
SCHED_RANK="CPU_USAGE"
SCHED_REQUIREMENTS="CPU_USAGE < 9000"
and try to instantiate several VMs from it to check if the behavior matches your expectations.
You may need to adjust MAX_HOST attribute value in /etc/one/schedulers/rank.conf file to make the rank scheduler behaves according to your needs:
MAX_HOST: Maximum number of Virtual Machines dispatched to a given Host in each scheduling action (Default: 1)
Please, note there are two documentation issues:
opened 12:52PM - 19 Aug 26 UTC
Category: Documentation
Status: Accepted
**Description**
Our 7.4 [docs](https://docs.opennebula.io/7.4/product/cloud_syst… em_administration/scheduler/rank_scheduler/) states there should be `opennebula-scheduler` systemd unit file:
> The Scheduler is distributed as part of the operating system package opennebula with the system service opennebula-scheduler
But since 7.0 the scheduler is not a stand-alone service, actually it's not a service any more. It's started by `oned` when it needs to schedule VMs, the Scheduler does its job and terminates.
## Progress Status
- [ ] Code committed
- [ ] Testing - QA
- [ ] Documentation (Release notes - resolved issues, compatibility, known issues)
opened 01:13PM - 19 Aug 26 UTC
Category: Documentation
Status: Accepted
**Description**
Current description of `MAX_HOST` attribute may lead to misunder… standing how it works.
**Current Content**
Our docs has [that](https://docs.opennebula.io/7.4/product/cloud_system_administration/scheduler/rank_scheduler/#configuration):
> MAX_HOST: Maximum number of Virtual Machines dispatched to a given Host in each scheduling action (Default: 1)
But it's not clear that under certain circumstances it may sufficiently influence on the final VMs distribution contradicting to what is defined in 'POLICY'.
For example, if `MAX_HOST=1` and `POLICY=0` (i.e. `packing`) 6 identical VMs will be distributed across two available HVs equally instead of expected HV1: 6, HV2: 0.
The explanation for that is as below.
When`oned` call the scheduler, it takes all VMs, which are in `pending` or `rescheduled` state. The Scheduler for all VMs makes a lists of available hosts, sorted by scheduling policy. In case of packing, the order might be something like:
```
VM1 - host1, host2, host3
VM2 - host1, host2, host3
VM3 - host1 , host2, host3
...
VM6 - host1 , host2, host3
```
I.e. the same order for all VMs, since they have same requirements.
Then it cycles VMs again and choose available host, for VM1 it's host1. For VM2: host1 already reaches `MAX_HOST` limit, so it pick the next available, which is host2, ...
If we place just one VM in each scheduling cycle, we never exceed the MAX_HOST limit and all of them will be placed on the same host. That's the 10 sec delay - not sure how long the delay have to be to get the proper packing
**Expected Content**
> MAX_HOST: Maximum number of Virtual Machines dispatched to a given Host in each scheduling action (Default: 1). Note, it can therefore constrain the effective VM distribution, potentially preventing scheduling policies such as packing from being fully realized.
**Affected doc version/s**
[7.2](https://docs.opennebula.io/7.2/product/cloud_system_administration/scheduler/rank_scheduler/#configuration)
[7.4](https://docs.opennebula.io/7.4/product/cloud_system_administration/scheduler/rank_scheduler/#configuration)
The last one describes what the MAX_HOST is in more details.
For detailed ranking decisions (helpful during debugging), the scheduler supports:
LOG = [
SYSTEM = "file",
DEBUG_LEVEL = 5
]
The detailed scheduling output is available in /var/log/one/rank_sched.log.