From: Vipin Balachandran Date: Tue, 18 Aug 2015 11:13:27 +0000 (+0530) Subject: Rename free_virtual in capacity filter X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=efdeaf1cb60b63c0a8e6d92c14a8b0f0a42fe6d2;p=openstack-build%2Fcinder-build.git Rename free_virtual in capacity filter Capacity filter uses free_virtual capacity to filter out a host if thin provisioning is enabled and over-subscription ratio is less than or equal to max_oversubscription_ratio. The current formula for free_virtual is not calculating the real free virtual capacity. Rather it computes "adjusted" free virtual capacity which is the current free capacity (after taking into account of reserved space) we can over-subscribe. This patch adds necessary documentation and renames free_virtual to adjusted_free_virtual to clarify this. Change-Id: I4c2b32ade09583497cf670f6504b8e929e961293 --- diff --git a/cinder/scheduler/filters/capacity_filter.py b/cinder/scheduler/filters/capacity_filter.py index f278e464d..199b95e46 100644 --- a/cinder/scheduler/filters/capacity_filter.py +++ b/cinder/scheduler/filters/capacity_filter.py @@ -101,8 +101,15 @@ class CapacityFilter(filters.BaseHostFilter): "host": host_state.host}) return False else: - free_virtual = free * host_state.max_over_subscription_ratio - return free_virtual >= volume_size + # Thin provisioning is enabled and projected over-subscription + # ratio does not exceed max_over_subscription_ratio. The host + # passes if "adjusted" free virtual capacity is enough to + # accommodate the volume. Adjusted free virtual capacity is + # the currently available free capacity (taking into account + # of reserved space) which we can over-subscribe. + adjusted_free_virtual = ( + free * host_state.max_over_subscription_ratio) + return adjusted_free_virtual >= volume_size if free < volume_size: LOG.warning(_LW("Insufficient free space for volume creation "