Browse Source

Add DEBUG logs to help troubleshoot no allocation candidates

We currently have DEBUG logs that are emitted when at least one
allocation candidate is successfully found (added in changes
If9ddb8a6d2f03392f3cc11136c4a0b026212b95b and
I952d5229d6c40588cde6197683117a7e19127939) but we don't get much
logging in cases when no allocation candidates are found.

This adds DEBUG log messages for cases where we raise
ResourceProviderNotFound to aid in debugging scenarios where placement
is unexpectedly returning no allocation candidates for a request.

Change-Id: I129fe0098944f14fc0d9ef6228eb26cc38050237
(cherry picked from commit fa9ae57984)
(cherry picked from commit 33591b83cb)
melanie witt 1 month ago
1 changed files with 10 additions and 3 deletions
  1. +10

+ 10
- 3
placement/objects/ View File

@@ -82,6 +82,8 @@ class RequestGroupSearchContext(object):
self.rps_in_aggs = provider_ids_matching_aggregates(
context, self.member_of)
if not self.rps_in_aggs:
LOG.debug('found no providers matching aggregates %s',
raise exception.ResourceProviderNotFound()

# If True, this RequestGroup represents requests which must be
@@ -120,9 +122,12 @@ class RequestGroupSearchContext(object):
# aggregates to nested (non-root) providers (the aggregate
# flows down feature) rather than applying later the implicit rule
# that aggregate on root spans the whole tree
rc_name = context.rc_cache.string_from_id(rc_id)
LOG.debug('getting providers with %d %s', amount, rc_name)
provs_with_resource = get_providers_with_resource(
context, rc_id, amount, tree_root_id=self.tree_root_id)
if not provs_with_resource:
LOG.debug('found no providers with %d %s', amount, rc_name)
raise exception.ResourceProviderNotFound()
self._rps_with_resource[rc_id] = provs_with_resource

@@ -216,15 +221,17 @@ class RequestWideSearchContext(object):
if not (required or forbidden):

required = set(trait_obj.ids_from_names(
required_ids = set(trait_obj.ids_from_names(
self._ctx, required).values()) if required else None
forbidden = set(trait_obj.ids_from_names(
forbidden_ids = set(trait_obj.ids_from_names(
self._ctx, forbidden).values()) if forbidden else None

self.anchor_root_ids = _get_roots_with_traits(
self._ctx, required, forbidden)
self._ctx, required_ids, forbidden_ids)

if not self.anchor_root_ids:
LOG.debug('found no providers satisfying required traits: %s and '
'forbidden traits: %s', required, forbidden)
raise exception.ResourceProviderNotFound()

def in_filtered_anchors(self, anchor_root_id):