remove resource if not created

gnocchi dispatcher will attempt to patch resource after pushing
measures. if we can't create resource, we shouldn't bother trying
to handle the patch later on. also, add better logging to figure
out which resource failed

Change-Id: Icfb2a694230d5c185a2726463657d3a11ed59fe0
(cherry picked from commit 54aea5b2d7)
This commit is contained in:
gord chung 2017-03-13 21:45:05 +00:00 committed by Mehdi Abaakouk (sileht)
parent c25e934b8c
commit 1cc4068298
1 changed files with 4 additions and 1 deletions

View File

@ -419,9 +419,12 @@ class GnocchiDispatcher(dispatcher.MeterDispatcherBase,
# NOTE(sileht): resource created in the meantime
pass
except gnocchi_exc.ClientException as e:
LOG.error(six.text_type(e))
LOG.error(_LE('Error creating resource %(id)s: %(err)s'),
{'id': resource['id'], 'err': six.text_type(e)})
# We cannot post measures for this resource
# and we can't patch it later
del measures[resource['id']]
del resource_infos[resource['id']]
# NOTE(sileht): we have created missing resources/metrics,
# now retry to post measures