Add logging to capabilities filter

The capabilities filter gets incorrectly blamed for a lot of
deployment failures because on a retry of a node deployment the
filter has to fail because there is only one node that can match
when using predictable placement.  However, we don't have any
logging to help determine why the filter fails.  This adds logging
to explain why nodes fell through, which will hopefully help with
debugging these problems.

Change-Id: I702209e9b5a1e546bf8cb784eec8bdc3c97c63eb
Closes-Bug: 1718502
(cherry picked from commit e5d1615536)
This commit is contained in:
Ben Nemec 2017-09-13 16:40:41 +00:00 committed by Dmitry Tantsur
parent d03c54872f
commit ac5e3fc860
1 changed files with 13 additions and 1 deletions

View File

@ -13,6 +13,10 @@
# under the License.
from nova.scheduler import filters
from oslo_log import log as logging
LOG = logging.getLogger(__name__)
class TripleOCapabilitiesFilter(filters.BaseHostFilter):
@ -31,5 +35,13 @@ class TripleOCapabilitiesFilter(filters.BaseHostFilter):
instance_node = spec_obj.scheduler_hints.get('capabilities:node')
# The instance didn't request a specific node
if not instance_node:
LOG.debug('No specific node requested')
return True
return host_node == instance_node[0]
if host_node == instance_node[0]:
LOG.debug('Node tagged %s matches requested node %s', host_node,
instance_node[0])
return True
else:
LOG.debug('Node tagged %s does not match requested node %s',
host_node, instance_node[0])
return False