Improve logs on scheduler

Scheduler decisions still not easy to track due lacking of information
about backends and pools. This adds more verbose information on that
so we can have a better means to help debug problems.

TrivialFix

Change-Id: I4a59ed298ba2542dcb4d6787b47085749a34244e
(cherry picked from commit 9c4cd4a2d7)
This commit is contained in:
Erlon R. Cruz 2018-02-12 15:41:17 -02:00
parent d02b6894f5
commit 525191ab0f
2 changed files with 33 additions and 7 deletions

View File

@ -118,6 +118,10 @@ class CapacityFilter(filters.BaseBackendFilter):
if provision_type == 'thick':
thin = False
msg_args = {"grouping_name": backend_state.backend_id,
"grouping": grouping,
"requested": requested_size,
"available": free}
# Only evaluate using max_over_subscription_ratio if
# thin_provisioning_support is True. Check if the ratio of
# provisioned capacity over total capacity has exceeded over
@ -126,6 +130,8 @@ class CapacityFilter(filters.BaseBackendFilter):
backend_state.max_over_subscription_ratio >= 1):
provisioned_ratio = ((backend_state.provisioned_capacity_gb +
requested_size) / total)
LOG.debug("Checking provisioning for request of %s GB. "
"Backend: %s", requested_size, backend_state)
if provisioned_ratio > backend_state.max_over_subscription_ratio:
msg_args = {
"provisioned_ratio": provisioned_ratio,
@ -159,6 +165,11 @@ class CapacityFilter(filters.BaseBackendFilter):
"(%(available)sGB) to accommodate thin "
"provisioned %(size)sGB volume on %(grouping)s"
" %(grouping_name)s.", msg_args)
else:
LOG.debug("Space information for volume creation "
"on %(grouping)s %(grouping_name)s "
"(requested / avail): "
"%(requested)s/%(available)s", msg_args)
return res
elif thin and backend_state.thin_provisioning_support:
LOG.warning("Filtering out %(grouping)s %(grouping_name)s "
@ -171,11 +182,6 @@ class CapacityFilter(filters.BaseBackendFilter):
"grouping_name": backend_state.backend_id})
return False
msg_args = {"grouping_name": backend_state.backend_id,
"grouping": grouping,
"requested": requested_size,
"available": free}
if free < requested_size:
LOG.warning("Insufficient free space for volume creation "
"on %(grouping)s %(grouping_name)s (requested / "

View File

@ -313,6 +313,7 @@ class BackendState(object):
self.free_capacity_gb -= volume_gb
if update_time:
self.updated = timeutils.utcnow()
LOG.debug("Consumed %s GB from backend: %s", volume['size'], self)
def __repr__(self):
# FIXME(zhiteng) backend level free_capacity_gb isn't as
@ -320,8 +321,27 @@ class BackendState(object):
# come up with better representation of HostState.
grouping = 'cluster' if self.cluster_name else 'host'
grouping_name = self.backend_id
return ("%s '%s': free_capacity_gb: %s, pools: %s" %
(grouping, grouping_name, self.free_capacity_gb, self.pools))
return ("%(grouping)s '%(grouping_name)s':"
"free_capacity_gb: %(free_capacity_gb)s, "
"total_capacity_gb: %(total_capacity_gb)s,"
"allocated_capacity_gb: %(allocated_capacity_gb)s, "
"max_over_subscription_ratio: %(mosr)s,"
"reserved_percentage: %(reserved_percentage)s, "
"provisioned_capacity_gb: %(provisioned_capacity_gb)s,"
"thin_provisioning_support: %(thin_provisioning_support)s, "
"thick_provisioning_support: %(thick)s,"
"pools: %(pools)s,"
"updated at: %(updated)s" %
{'grouping': grouping, 'grouping_name': grouping_name,
'free_capacity_gb': self.free_capacity_gb,
'total_capacity_gb': self.total_capacity_gb,
'allocated_capacity_gb': self.allocated_capacity_gb,
'mosr': self.max_over_subscription_ratio,
'reserved_percentage': self.reserved_percentage,
'provisioned_capacity_gb': self.provisioned_capacity_gb,
'thin_provisioning_support': self.thin_provisioning_support,
'thick': self.thick_provisioning_support,
'pools': self.pools, 'updated': self.updated})
class PoolState(BackendState):