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
This commit is contained in:
Gorka Eguileor 2017-07-03 12:00:02 +02:00
parent a688b872be
commit 019522b9de
1 changed files with 14 additions and 1 deletions

View File

@ -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 "