Previous topic

The nova.scheduler.host_manager Module

Next topic

The nova.scheduler.manager Module

This Page

Psst... hey. You're reading the latest content, but it might be out of sync with code. You can read Nova 2011.2 docs or all OpenStack docs too.

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 will less free ram 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.