Remove deprecated pollster-list option
Closes-Bug: #1700639 Change-Id: I4d3a404877254748d8c60e80e28a9cdc6a0ecbfc
This commit is contained in:
parent
ad933a0b63
commit
32c129aabd
@ -27,10 +27,8 @@ from keystoneauth1 import exceptions as ka_exceptions
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
import oslo_messaging
|
||||
from oslo_utils import fnmatch
|
||||
from oslo_utils import timeutils
|
||||
import six
|
||||
from six import moves
|
||||
from six.moves.urllib import parse as urlparse
|
||||
from stevedore import extension
|
||||
from tooz import coordination
|
||||
@ -72,19 +70,10 @@ POLLING_OPTS = [
|
||||
]
|
||||
|
||||
|
||||
class PollsterListForbidden(Exception):
|
||||
def __init__(self):
|
||||
msg = ('It is forbidden to use pollster-list option of polling agent '
|
||||
'in case of using coordination between multiple agents. Please '
|
||||
'use either multiple agents being coordinated or polling list '
|
||||
'option for one polling agent.')
|
||||
super(PollsterListForbidden, self).__init__(msg)
|
||||
|
||||
|
||||
class EmptyPollstersList(Exception):
|
||||
def __init__(self):
|
||||
msg = ('No valid pollsters can be loaded with the startup parameters'
|
||||
' polling-namespaces and pollster-list.')
|
||||
msg = ('No valid pollsters can be loaded with the startup parameter'
|
||||
' polling-namespaces.')
|
||||
super(EmptyPollstersList, self).__init__(msg)
|
||||
|
||||
|
||||
@ -232,26 +221,14 @@ class PollingTask(object):
|
||||
|
||||
class AgentManager(cotyledon.Service):
|
||||
|
||||
def __init__(self, worker_id, conf, namespaces=None, pollster_list=None):
|
||||
def __init__(self, worker_id, conf, namespaces=None):
|
||||
namespaces = namespaces or ['compute', 'central']
|
||||
pollster_list = pollster_list or []
|
||||
group_prefix = conf.polling.partitioning_group_prefix
|
||||
|
||||
# features of using coordination and pollster-list are exclusive, and
|
||||
# cannot be used at one moment to avoid both samples duplication and
|
||||
# samples being lost
|
||||
if pollster_list and conf.coordination.backend_url:
|
||||
raise PollsterListForbidden()
|
||||
|
||||
super(AgentManager, self).__init__(worker_id)
|
||||
|
||||
self.conf = conf
|
||||
|
||||
def _match(pollster):
|
||||
"""Find out if pollster name matches to one of the list."""
|
||||
return any(fnmatch.fnmatch(pollster.name, pattern) for
|
||||
pattern in pollster_list)
|
||||
|
||||
if type(namespaces) is not list:
|
||||
namespaces = [namespaces]
|
||||
|
||||
@ -262,11 +239,6 @@ class AgentManager(cotyledon.Service):
|
||||
# get the extensions from pollster builder
|
||||
extensions_fb = (self._extensions_from_builder('poll', namespace)
|
||||
for namespace in namespaces)
|
||||
if pollster_list:
|
||||
extensions = (moves.filter(_match, exts)
|
||||
for exts in extensions)
|
||||
extensions_fb = (moves.filter(_match, exts)
|
||||
for exts in extensions_fb)
|
||||
|
||||
self.extensions = list(itertools.chain(*list(extensions))) + list(
|
||||
itertools.chain(*list(extensions_fb)))
|
||||
|
@ -66,21 +66,13 @@ CLI_OPTS = [
|
||||
dest='polling_namespaces',
|
||||
help='Polling namespace(s) to be used while '
|
||||
'resource polling'),
|
||||
MultiChoicesOpt('pollster-list',
|
||||
default=[],
|
||||
deprecated_for_removal=True,
|
||||
dest='pollster_list',
|
||||
help='List of pollsters (or wildcard templates) to be '
|
||||
'used while polling. This option is deprecated. '
|
||||
'Configure pollsters via polling.yaml'),
|
||||
]
|
||||
|
||||
|
||||
def create_polling_service(worker_id, conf):
|
||||
return manager.AgentManager(worker_id,
|
||||
conf,
|
||||
conf.polling_namespaces,
|
||||
conf.pollster_list)
|
||||
conf.polling_namespaces)
|
||||
|
||||
|
||||
def main():
|
||||
|
@ -54,45 +54,16 @@ class TestManager(base.BaseTestCase):
|
||||
mgr = manager.AgentManager(0, self.conf)
|
||||
self.assertIsNotNone(list(mgr.extensions))
|
||||
|
||||
def test_load_plugins_pollster_list(self):
|
||||
mgr = manager.AgentManager(0, self.conf, pollster_list=['disk.*'])
|
||||
# currently we do have 28 disk-related pollsters
|
||||
self.assertEqual(28, len(list(mgr.extensions)))
|
||||
|
||||
def test_load_invalid_plugins_pollster_list(self):
|
||||
# if no valid pollsters have been loaded, the ceilometer
|
||||
# polling program should exit
|
||||
self.assertRaisesRegex(
|
||||
manager.EmptyPollstersList,
|
||||
'No valid pollsters can be loaded with the startup parameters'
|
||||
' polling-namespaces and pollster-list.',
|
||||
manager.AgentManager, 0, self.conf,
|
||||
pollster_list=['aaa'])
|
||||
|
||||
def test_load_plugins_no_intersection(self):
|
||||
# Let's test nothing will be polled if namespace and pollsters
|
||||
# list have no intersection.
|
||||
parameters = dict(namespaces=['compute'],
|
||||
pollster_list=['storage.*'])
|
||||
self.assertRaisesRegex(
|
||||
manager.EmptyPollstersList,
|
||||
'No valid pollsters can be loaded with the startup parameters'
|
||||
' polling-namespaces and pollster-list.',
|
||||
manager.AgentManager, 0, self.conf, parameters)
|
||||
|
||||
# Test plugin load behavior based on Node Manager pollsters.
|
||||
# pollster_list is just a filter, so sensor pollsters under 'ipmi'
|
||||
# namespace would be also instanced. Still need mock __init__ for it.
|
||||
@mock.patch('ceilometer.ipmi.pollsters.node._Base.__init__',
|
||||
mock.Mock(return_value=None))
|
||||
@mock.patch('ceilometer.ipmi.pollsters.sensor.SensorPollster.__init__',
|
||||
mock.Mock(return_value=None))
|
||||
def test_load_normal_plugins(self):
|
||||
mgr = manager.AgentManager(0, self.conf,
|
||||
namespaces=['ipmi'],
|
||||
pollster_list=['hardware.ipmi.node.*'])
|
||||
namespaces=['ipmi'])
|
||||
# 8 pollsters for Node Manager
|
||||
self.assertEqual(8, len(mgr.extensions))
|
||||
self.assertEqual(12, len(mgr.extensions))
|
||||
|
||||
# Skip loading pollster upon ExtensionLoadError
|
||||
@mock.patch('ceilometer.ipmi.pollsters.node._Base.__init__',
|
||||
@ -105,8 +76,7 @@ class TestManager(base.BaseTestCase):
|
||||
# list if param was not set as a list.
|
||||
try:
|
||||
manager.AgentManager(0, self.conf,
|
||||
namespaces='ipmi',
|
||||
pollster_list=['hardware.ipmi.node.*'])
|
||||
namespaces='ipmi')
|
||||
except manager.EmptyPollstersList:
|
||||
err_msg = 'Skip loading extension for %s'
|
||||
pollster_names = [
|
||||
@ -122,13 +92,11 @@ class TestManager(base.BaseTestCase):
|
||||
@mock.patch('ceilometer.ipmi.pollsters.sensor.SensorPollster.__init__',
|
||||
mock.Mock(return_value=None))
|
||||
def test_import_error_in_plugin(self):
|
||||
parameters = dict(namespaces=['ipmi'],
|
||||
pollster_list=['hardware.ipmi.node.*'])
|
||||
self.assertRaisesRegex(
|
||||
manager.EmptyPollstersList,
|
||||
'No valid pollsters can be loaded with the startup parameters'
|
||||
' polling-namespaces and pollster-list.',
|
||||
manager.AgentManager, 0, self.conf, parameters)
|
||||
'No valid pollsters can be loaded with the startup parameter'
|
||||
' polling-namespaces.',
|
||||
manager.AgentManager, 0, self.conf, {"namespaces": ['ipmi']})
|
||||
|
||||
# Exceptions other than ExtensionLoadError are propagated
|
||||
@mock.patch('ceilometer.ipmi.pollsters.node._Base.__init__',
|
||||
@ -139,16 +107,7 @@ class TestManager(base.BaseTestCase):
|
||||
self.assertRaises(PollingException,
|
||||
manager.AgentManager,
|
||||
0, self.conf,
|
||||
['ipmi'],
|
||||
['hardware.ipmi.node.*'])
|
||||
|
||||
def test_load_plugins_pollster_list_forbidden(self):
|
||||
self.conf.set_override('backend_url', 'http://',
|
||||
group='coordination')
|
||||
self.assertRaises(manager.PollsterListForbidden,
|
||||
manager.AgentManager,
|
||||
0, self.conf,
|
||||
pollster_list=['disk.*'])
|
||||
['ipmi'])
|
||||
|
||||
def test_builder(self):
|
||||
@staticmethod
|
||||
|
@ -344,20 +344,6 @@ Running :command:`ceilometer-agent-ipmi` is exactly the same as:
|
||||
|
||||
$ ceilometer-polling --polling-namespaces ipmi
|
||||
|
||||
In addition to loading all the polling plug-ins registered in the
|
||||
specified namespaces, the ``ceilometer-polling`` agent can also specify the
|
||||
polling plug-ins to be loaded by using the ``pollster-list`` option:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ ceilometer-polling --polling-namespaces central \
|
||||
--pollster-list image image.size storage.*
|
||||
|
||||
.. note::
|
||||
|
||||
HA deployment is NOT supported if the ``pollster-list`` option is
|
||||
used.
|
||||
|
||||
Compute agent
|
||||
-------------
|
||||
|
||||
|
@ -99,20 +99,12 @@ polling agent start via CLI parameter::
|
||||
ceilometer-polling --polling-namespaces central compute
|
||||
|
||||
This command will basically make polling agent to load all plugins from the
|
||||
central and compute namespaces and poll everything it can. If you need to load
|
||||
only some of the pollsters, you can use ``pollster-list`` option::
|
||||
|
||||
ceilometer-polling --pollster-list image image.size storage.*
|
||||
central and compute namespaces and poll everything it can.
|
||||
|
||||
If both of these options are passed, the polling agent will load only those
|
||||
pollsters specified in the pollster list, that can be loaded from the selected
|
||||
namespaces.
|
||||
|
||||
.. note::
|
||||
|
||||
Agents coordination cannot be used in case of pollster-list option usage.
|
||||
This allows to avoid both samples duplication and their lost.
|
||||
|
||||
Notifications
|
||||
-------------
|
||||
|
||||
|
@ -0,0 +1,4 @@
|
||||
---
|
||||
upgrade:
|
||||
- |
|
||||
The deprecated `pollster-list` option has been removed.
|
Loading…
x
Reference in New Issue
Block a user