From 019522b9decd35e7de5b7bd1706693b7c456d2f4 Mon Sep 17 00:00:00 2001 From: Gorka Eguileor Date: Mon, 3 Jul 2017 12:00:02 +0200 Subject: [PATCH] Improve Capacity filter logging Logging in scheduler's filters have improved greatly over the years, but there are still two code paths that exclude backends but don't log the reason. This patch adds debug log levels to those 2 paths so all exclusion code paths will be covered. TrivialFix Change-Id: I57c773849200439713b18b61874dc33d8ee34390 --- cinder/scheduler/filters/capacity_filter.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/cinder/scheduler/filters/capacity_filter.py b/cinder/scheduler/filters/capacity_filter.py index 7493f949a36..9789ea84a8f 100644 --- a/cinder/scheduler/filters/capacity_filter.py +++ b/cinder/scheduler/filters/capacity_filter.py @@ -89,6 +89,9 @@ class CapacityFilter(filters.BaseBackendFilter): # also won't work. So the back-ends cannot serve the request. if reserved == 0: return True + LOG.debug("Cannot calculate GB of reserved space (%s%%) with " + "backend's reported total capacity '%s'", + backend_state.reserved_percentage, total_space) return False total = float(total_space) if total <= 0: @@ -146,7 +149,17 @@ class CapacityFilter(filters.BaseBackendFilter): # of reserved space) which we can over-subscribe. adjusted_free_virtual = ( free * backend_state.max_over_subscription_ratio) - return adjusted_free_virtual >= requested_size + res = adjusted_free_virtual >= requested_size + if not res: + msg_args = {"available": adjusted_free_virtual, + "size": requested_size, + "grouping": grouping, + "grouping_name": backend_state.backend_id} + LOG.warning("Insufficient free virtual space " + "(%(available)sGB) to accomodate thin " + "provisioned %(size)sGB volume on %(grouping)s" + " %(grouping_name)s.", msg_args) + return res elif thin and backend_state.thin_provisioning_support: LOG.warning("Filtering out %(grouping)s %(grouping_name)s " "with an invalid maximum over subscription ratio "