Question about scheduling policies and ranking

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.

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:

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.