Add debug logs for weigher filters
Add logs for weigher filters so that we can debug from the log. Change-Id: I95f6145c77028aee4cce310c7b2a9636fdeed5d8
This commit is contained in:
parent
130de4f9cb
commit
b0ae94feb9
@ -19,11 +19,15 @@ Pluggable Weighing support
|
||||
|
||||
import abc
|
||||
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
||||
from cinder.scheduler import base_handler
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def normalize(weight_list, minval=None, maxval=None):
|
||||
"""Normalize the values in a list between 0 and 1.0.
|
||||
|
||||
@ -142,4 +146,10 @@ class BaseWeightHandler(base_handler.BaseHandler):
|
||||
obj = weighed_objs[i]
|
||||
obj.weight += weigher.weight_multiplier() * weight
|
||||
|
||||
LOG.debug("Weigher %(cls_name)s returned, "
|
||||
"weigher value is {max: %(maxval)s, min: %(minval)s}",
|
||||
{'cls_name': weigher_cls.__name__,
|
||||
'maxval': weigher.maxval,
|
||||
'minval': weigher.minval})
|
||||
|
||||
return sorted(weighed_objs, key=lambda x: x.weight, reverse=True)
|
||||
|
@ -493,9 +493,12 @@ class HostManager(object):
|
||||
weigher_class_names=None):
|
||||
"""Weigh the backends."""
|
||||
weigher_classes = self._choose_backend_weighers(weigher_class_names)
|
||||
return self.weight_handler.get_weighed_objects(weigher_classes,
|
||||
backends,
|
||||
weight_properties)
|
||||
|
||||
weighed_backends = self.weight_handler.get_weighed_objects(
|
||||
weigher_classes, backends, weight_properties)
|
||||
|
||||
LOG.debug("Weighed %s", weighed_backends)
|
||||
return weighed_backends
|
||||
|
||||
def update_service_capabilities(self, service_name, host, capabilities,
|
||||
cluster_name, timestamp):
|
||||
|
Loading…
Reference in New Issue
Block a user