Fix for rgw still throwing errors

When raising the PollsterPermanentError,
the list of resources(tenants) are passed,
which enables the Agent Manager to blacklist
those resources. This stops those resources
from being polled again and avoids any unwanted
error messages from being logged.

Change-Id: I4f7bf23d5d7f3c182e4089d80b03a1587fa31222
Closes-Bug: #1475441
This commit is contained in:
Rohit Jaiswal 2015-08-06 01:45:54 +00:00
parent ece5275fce
commit 833385f846
6 changed files with 8 additions and 8 deletions

View File

@ -202,7 +202,7 @@ class PollingTask(object):
'Prevent pollster %(name)s for '
'polling source %(source)s anymore!')
% ({'name': pollster.name, 'source': source_name}))
self.resources[key].blacklist.append(err.fail_res)
self.resources[key].blacklist.extend(err.fail_res_list)
except Exception as err:
LOG.warning(_(
'Continue after error from %(name)s: %(error)s')

View File

@ -178,8 +178,8 @@ class PollsterPermanentError(Exception):
error.
"""
def __init__(self, resource):
self.fail_res = resource
def __init__(self, resources):
self.fail_res_list = resources
@six.add_metaclass(abc.ABCMeta)

View File

@ -69,7 +69,7 @@ class _Base(plugin_base.PollsterBase):
if (CONF.ipmi.polling_retry >= 0 and
self.polling_failures > CONF.ipmi.polling_retry):
LOG.warning(_('Pollster for %s is disabled!') % self.NAME)
raise plugin_base.PollsterPermanentError(resources[0])
raise plugin_base.PollsterPermanentError(resources)
else:
return

View File

@ -72,7 +72,7 @@ class SensorPollster(plugin_base.PollsterBase):
if (CONF.ipmi.polling_retry >= 0 and
self.polling_failures > CONF.ipmi.polling_retry):
LOG.warning(_('Pollster for %s is disabled!') % self.METRIC)
raise plugin_base.PollsterPermanentError(resources[0])
raise plugin_base.PollsterPermanentError(resources)
else:
return

View File

@ -93,8 +93,8 @@ class _Base(plugin_base.PollsterBase):
try:
from ceilometer.objectstore.rgw_client import RGWAdminClient
rgw_client = RGWAdminClient(endpoint, self.access_key, self.secret)
except ImportError as e:
raise plugin_base.PollsterPermanentError(e)
except ImportError:
raise plugin_base.PollsterPermanentError(tenants)
for t in tenants:
api_method = 'get_%s' % self.METHOD

View File

@ -145,7 +145,7 @@ class TestPollsterPollingException(agentbase.TestPollster):
# Raise polling exception after 2 times
self.polling_failures += 1
if self.polling_failures > 2:
raise plugin_base.PollsterPermanentError(resources[0])
raise plugin_base.PollsterPermanentError(resources)
return sample