From efdeaf1cb60b63c0a8e6d92c14a8b0f0a42fe6d2 Mon Sep 17 00:00:00 2001 From: Vipin Balachandran Date: Tue, 18 Aug 2015 16:43:27 +0530 Subject: [PATCH] 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 --- cinder/scheduler/filters/capacity_filter.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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 " -- 2.45.2