The nova.scheduler.least_cost Module

Least Cost is an algorithm for choosing which host machines to provision a set of resources to. The input is a WeightedHost object which is decided upon by a set of objective-functions, called the ‘cost-functions’. The WeightedHost contains a combined weight for each cost-function.

The cost-function and weights are tabulated, and the host with the least cost is then selected for provisioning.

class WeightedHost(weight, host_state=None)

Bases: object

Reduced set of information about a host that has been weighed. This is an attempt to remove some of the ad-hoc dict structures previously used.

to_dict()
compute_fill_first_cost_fn(host_state, weighing_properties)

More free ram = higher weight. So servers with less free ram will be preferred.

Note: the weight for this function in default configuration is -1.0. With a -1.0 this function runs in reverse, so systems with the most free memory will be preferred.

noop_cost_fn(host_state, weighing_properties)

Return a pre-weight cost of 1 for each host

weighted_sum(weighted_fns, host_states, weighing_properties)

Use the weighted-sum method to compute a score for an array of objects.

Normalize the results of the objective-functions so that the weights are meaningful regardless of objective-function’s range.

Parameters:
  • host_list[(host, HostInfo()), ...]
  • weighted_fns

    list of weights and functions like:

    [(weight, objective-functions), ...]
    
  • weighing_properties – an arbitrary dict of values that can influence weights.
Returns:

a single WeightedHost object which represents the best candidate.

Previous topic

The nova.scheduler.host_manager Module

Next topic

The nova.scheduler.manager Module

This Page