]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Rename free_virtual in capacity filter
authorVipin Balachandran <vbala@vmware.com>
Tue, 18 Aug 2015 11:13:27 +0000 (16:43 +0530)
committerVipin Balachandran <vbala@vmware.com>
Tue, 18 Aug 2015 11:13:27 +0000 (16:43 +0530)
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

index f278e464d3e680c2a18a50878dba71bd504fa463..199b95e46769e60d4a91345efcd3cbd9155c3a13 100644 (file)
@@ -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 "