From 33591b83cbb7daf1a53c481e1d4c2797376dc888 Mon Sep 17 00:00:00 2001 From: melanie witt Date: Mon, 3 Aug 2020 22:15:50 +0000 Subject: [PATCH] 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 fa9ae57984ba1f839331174d9b3ef9658af5b775) --- placement/objects/research_context.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/placement/objects/research_context.py b/placement/objects/research_context.py index 75d410eae..5d4124d4d 100644 --- a/placement/objects/research_context.py +++ b/placement/objects/research_context.py @@ -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', + self.member_of) 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): return - 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):