cinder.scheduler.sched_utils module

calculate_capacity_factors(total_capacity: float, free_capacity: float, provisioned_capacity: float, thin_provisioning_support: bool, max_over_subscription_ratio: float, reserved_percentage: int, thin: bool) dict

Create the various capacity factors of the a particular backend.

Based off of definition of terms cinder-specs/specs/queens/provisioning-improvements.html Description of factors calculated where units of gb are Gibibytes. reserved_capacity - The amount of space reserved from the total_capacity as reported by the backend. total_reserved_available_capacity - The total capacity minus reserved capacity total_available_capacity - The total capacity available to cinder calculated from total_reserved_available_capacity (for thick) OR for thin total_reserved_available_capacity max_over_subscription_ratio calculated_free_capacity - total_available_capacity - provisioned_capacity virtual_free_capacity - The calculated free capacity available to cinder to allocate new storage. For thin: calculated_free_capacity For thick: the reported free_capacity can be less than the calculated capacity, so we use free_capacity - reserved_capacity.

free_percent - the percentage of the virtual_free_capacity and total_available_capacity is left over provisioned_ratio - The ratio of provisioned storage to total_available_capacity

Parameters:
  • total_capacity (float) – The reported total capacity in the backend.

  • free_capacity (float) – The free space/capacity as reported by the backend.

  • provisioned_capacity (float) – as reported by backend or volume manager from allocated_capacity_gb

  • thin_provisioning_support (bool) – Is thin provisioning supported?

  • max_over_subscription_ratio (float) – as reported by the backend

  • reserved_percentage (int, 0-100) – the % amount to reserve as unavailable. 0-100

  • thin (bool) – calculate based on thin provisioning if enabled by thin_provisioning_support

Returns:

A dictionary of all of the capacity factors.

Return type:

dict

calculate_max_over_subscription_ratio(capability: dict, global_max_over_subscription_ratio: float) float
calculate_virtual_free_capacity(total_capacity: float, free_capacity: float, provisioned_capacity: float, thin_provisioning_support: bool, max_over_subscription_ratio: float, reserved_percentage: int, thin: bool) float

Calculate the virtual free capacity based on multiple factors.

Parameters:
  • total_capacity – total_capacity_gb of a host_state or pool.

  • free_capacity – free_capacity_gb of a host_state or pool.

  • provisioned_capacity – provisioned_capacity_gb of a host_state or pool.

  • thin_provisioning_support – thin_provisioning_support of a host_state or a pool.

  • max_over_subscription_ratio – max_over_subscription_ratio of a host_state or a pool

  • reserved_percentage – reserved_percentage of a host_state or a pool.

  • thin – whether volume to be provisioned is thin

Returns:

the calculated virtual free capacity.