The nova.scheduler.filters.utils Module

Bench of utility methods used by filters.

aggregate_metadata_get_by_host(host_state, key=None)

Returns a dict of all metadata based on a metadata key for a specific host. If the key is not provided, returns a dict of all metadata.

aggregate_values_from_key(host_state, key_name)

Returns a set of values based on a metadata key for a specific host.

instance_uuids_overlap(host_state, uuids)

Tests for overlap between a host_state and a list of uuids.

Returns True if any of the supplied uuids match any of the instance.uuid values in the host_state.

other_types_on_host(host_state, instance_type_id)

Tests for overlap between a host_state’s instances and an instance_type_id.

Returns True if there are any instances in the host_state whose instance_type_id is different than the supplied instance_type_id value.

validate_num_values(vals, default=None, cast_to=<type 'int'>, based_on=<built-in function min>)

Returns a correctly casted value based on a set of values.

This method is useful to work with per-aggregate filters, It takes a set of values then return the ‘based_on’{min/max} converted to ‘cast_to’ of the set or the default value.

Note: The cast implies a possible ValueError

Previous topic

The nova.scheduler.filters.type_filter Module

Next topic

The nova.scheduler.host_manager Module

Project Source

This Page