Move central agent code to the polling agent module

That's the preparation for further compute and central agents
merge

Partially-Implements-Blueprint: merge-compute-central-agents

Change-Id: If5f151ab7d30c9711929f6dcade553fdca09ab67
This commit is contained in:
Dina Belova 2014-10-08 16:47:33 +04:00
parent fec091a2db
commit 68df2bb9dc
50 changed files with 223 additions and 223 deletions

View File

@ -1,4 +1,3 @@
#
# Copyright 2014 Red Hat, Inc # Copyright 2014 Red Hat, Inc
# #
# Author: Nejc Saje <nsaje@redhat.com> # Author: Nejc Saje <nsaje@redhat.com>
@ -17,9 +16,9 @@
from oslo.config import cfg from oslo.config import cfg
from ceilometer.agent import plugin_base as plugin
from ceilometer.i18n import _LW from ceilometer.i18n import _LW
from ceilometer.openstack.common import log from ceilometer.openstack.common import log
from ceilometer import plugin
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)
@ -47,16 +46,3 @@ class EndpointDiscovery(plugin.DiscoveryBase):
return [] return []
else: else:
return endpoints return endpoints
class TenantDiscovery(plugin.DiscoveryBase):
"""Discovery that supplies keystone tenants.
This discovery should be used when the pollster's work can't be divided
into smaller pieces than per-tenant. Example of this is the Swift
pollster, which polls account details and does so per-tenant.
"""
def discover(self, manager, param=None):
tenants = manager.keystone.tenants.list()
return tenants or []

View File

@ -0,0 +1,37 @@
# Copyright 2014 Red Hat, Inc
#
# Author: Nejc Saje <nsaje@redhat.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from oslo.config import cfg
from ceilometer.agent import plugin_base as plugin
from ceilometer.openstack.common import log
LOG = log.getLogger(__name__)
cfg.CONF.import_group('service_credentials', 'ceilometer.service')
class TenantDiscovery(plugin.DiscoveryBase):
"""Discovery that supplies keystone tenants.
This discovery should be used when the pollster's work can't be divided
into smaller pieces than per-tenant. Example of this is the Swift
pollster, which polls account details and does so per-tenant.
"""
def discover(self, manager, param=None):
tenants = manager.keystone.tenants.list()
return tenants or []

View File

@ -18,30 +18,32 @@
from keystoneclient.v2_0 import client as ksclient from keystoneclient.v2_0 import client as ksclient
from oslo.config import cfg from oslo.config import cfg
from ceilometer import agent from ceilometer.agent import base
from ceilometer.openstack.common import log from ceilometer.openstack.common import log
OPTS = [ OPTS = [
cfg.StrOpt('partitioning_group_prefix', cfg.StrOpt('partitioning_group_prefix',
default=None, default=None,
deprecated_group='central',
help='Work-load partitioning group prefix. Use only if you ' help='Work-load partitioning group prefix. Use only if you '
'want to run multiple central agents with different ' 'want to run multiple polling agents with different '
'config files. For each sub-group of the central agent ' 'config files. For each sub-group of the agent '
'pool with the same partitioning_group_prefix a disjoint ' 'pool with the same partitioning_group_prefix a disjoint '
'subset of pollsters should be loaded.'), 'subset of pollsters should be loaded.'),
] ]
cfg.CONF.register_opts(OPTS, group='central')
cfg.CONF.import_opt('http_timeout', 'ceilometer.service') cfg.CONF.register_opts(OPTS, group='polling')
cfg.CONF.import_group('service_credentials', 'ceilometer.service') cfg.CONF.import_group('service_credentials', 'ceilometer.service')
cfg.CONF.import_opt('http_timeout', 'ceilometer.service')
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)
class AgentManager(agent.AgentManager): class AgentManager(base.AgentManager):
def __init__(self): def __init__(self, namespace='agent'):
super(AgentManager, self).__init__( super(AgentManager, self).__init__(
'central', group_prefix=cfg.CONF.central.partitioning_group_prefix) namespace, group_prefix=cfg.CONF.polling.partitioning_group_prefix)
def interval_task(self, task): def interval_task(self, task):
try: try:

View File

@ -21,6 +21,8 @@ import abc
import collections import collections
import fnmatch import fnmatch
from keystoneclient.v2_0 import client as ksclient
from oslo.config import cfg
import oslo.messaging import oslo.messaging
import six import six
@ -29,12 +31,60 @@ from ceilometer import messaging
from ceilometer.openstack.common import context from ceilometer.openstack.common import context
from ceilometer.openstack.common import log from ceilometer.openstack.common import log
cfg.CONF.import_group('service_credentials', 'ceilometer.service')
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)
ExchangeTopics = collections.namedtuple('ExchangeTopics', ExchangeTopics = collections.namedtuple('ExchangeTopics',
['exchange', 'topics']) ['exchange', 'topics'])
def _get_keystone():
try:
return ksclient.Client(
username=cfg.CONF.service_credentials.os_username,
password=cfg.CONF.service_credentials.os_password,
tenant_id=cfg.CONF.service_credentials.os_tenant_id,
tenant_name=cfg.CONF.service_credentials.os_tenant_name,
cacert=cfg.CONF.service_credentials.os_cacert,
auth_url=cfg.CONF.service_credentials.os_auth_url,
region_name=cfg.CONF.service_credentials.os_region_name,
insecure=cfg.CONF.service_credentials.insecure)
except Exception as e:
return e
def check_keystone(service_type=None):
"""Decorator function to check if manager has valid keystone client.
Also checks if the service is registered/enabled in Keystone.
:param service_type: name of service in Keystone
"""
def wrapped(f):
def func(self, *args, **kwargs):
manager = kwargs.get('manager')
if not manager and len(args) > 0:
manager = args[0]
keystone = getattr(manager, 'keystone', None)
if not keystone:
keystone = _get_keystone()
if isinstance(keystone, Exception):
LOG.error(_('Skip due to keystone error %s'),
str(keystone) if keystone else '')
return iter([])
elif service_type:
endpoints = keystone.service_catalog.get_endpoints(
service_type=service_type)
if not endpoints:
LOG.warning(_('Skipping because %s service is not '
'registered in keystone') % service_type)
return iter([])
return f(self, *args, **kwargs)
return func
return wrapped
class PluginBase(object): class PluginBase(object):
"""Base class for all plugins.""" """Base class for all plugins."""

View File

@ -1,80 +0,0 @@
#
# Copyright 2012 New Dream Network, LLC (DreamHost)
#
# Author: Doug Hellmann <doug.hellmann@dreamhost.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""Base class for plugins used by the central agent.
"""
from keystoneclient.v2_0 import client as ksclient
from oslo.config import cfg
from ceilometer.i18n import _
from ceilometer.openstack.common import log
from ceilometer import plugin
cfg.CONF.import_opt('http_timeout', 'ceilometer.service')
cfg.CONF.import_group('service_credentials', 'ceilometer.service')
LOG = log.getLogger(__name__)
class CentralPollster(plugin.PollsterBase):
"""Base class for plugins that support the polling API."""
def _get_keystone():
try:
return ksclient.Client(
username=cfg.CONF.service_credentials.os_username,
password=cfg.CONF.service_credentials.os_password,
tenant_id=cfg.CONF.service_credentials.os_tenant_id,
tenant_name=cfg.CONF.service_credentials.os_tenant_name,
cacert=cfg.CONF.service_credentials.os_cacert,
auth_url=cfg.CONF.service_credentials.os_auth_url,
region_name=cfg.CONF.service_credentials.os_region_name,
insecure=cfg.CONF.service_credentials.insecure,
timeout=cfg.CONF.http_timeout)
except Exception as e:
return e
def check_keystone(service_type=None):
"""Decorator function to check if manager has valid keystone client.
Also checks if the service is registered/enabled in Keystone.
:param service_type: name of service in Keystone
"""
def wrapped(f):
def func(self, *args, **kwargs):
manager = kwargs.get('manager')
if not manager and len(args) > 0:
manager = args[0]
keystone = getattr(manager, 'keystone', None)
if not keystone:
keystone = _get_keystone()
if isinstance(keystone, Exception):
LOG.error(_('Skip due to keystone error %s'),
str(keystone) if keystone else '')
return iter([])
elif service_type:
endpoints = keystone.service_catalog.get_endpoints(
service_type=service_type)
if not endpoints:
LOG.warning(_('Skipping because %s service is not '
'registered in keystone') % service_type)
return iter([])
return f(self, *args, **kwargs)
return func
return wrapped

View File

@ -14,7 +14,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from ceilometer.central import manager from ceilometer.agent import manager
from ceilometer.openstack.common import service as os_service from ceilometer.openstack.common import service as os_service
from ceilometer import service from ceilometer import service

View File

@ -17,8 +17,8 @@
from oslo.config import cfg from oslo.config import cfg
from ceilometer.agent import plugin_base
from ceilometer import nova_client from ceilometer import nova_client
from ceilometer import plugin
OPTS = [ OPTS = [
cfg.BoolOpt('workload_partitioning', cfg.BoolOpt('workload_partitioning',
@ -29,7 +29,7 @@ OPTS = [
cfg.CONF.register_opts(OPTS, group='compute') cfg.CONF.register_opts(OPTS, group='compute')
class InstanceDiscovery(plugin.DiscoveryBase): class InstanceDiscovery(plugin_base.DiscoveryBase):
def __init__(self): def __init__(self):
super(InstanceDiscovery, self).__init__() super(InstanceDiscovery, self).__init__()
self.nova_cli = nova_client.Client() self.nova_cli = nova_client.Client()

View File

@ -15,14 +15,14 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from ceilometer import agent from ceilometer.agent import manager
from ceilometer.compute.virt import inspector as virt_inspector from ceilometer.compute.virt import inspector as virt_inspector
from ceilometer.openstack.common import log from ceilometer.openstack.common import log
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)
class AgentManager(agent.AgentManager): class AgentManager(manager.AgentManager):
def __init__(self): def __init__(self):
super(AgentManager, self).__init__('compute') super(AgentManager, self).__init__('compute')

View File

@ -18,7 +18,7 @@
from oslo.config import cfg from oslo.config import cfg
import oslo.messaging import oslo.messaging
from ceilometer import plugin from ceilometer.agent import plugin_base
OPTS = [ OPTS = [
@ -31,7 +31,7 @@ OPTS = [
cfg.CONF.register_opts(OPTS) cfg.CONF.register_opts(OPTS)
class ComputeNotificationBase(plugin.NotificationBase): class ComputeNotificationBase(plugin_base.NotificationBase):
@staticmethod @staticmethod
def get_targets(conf): def get_targets(conf):
"""Return a sequence of oslo.messaging.Target """Return a sequence of oslo.messaging.Target

View File

@ -22,7 +22,7 @@ import abc
from oslo.utils import timeutils from oslo.utils import timeutils
import six import six
from ceilometer import plugin from ceilometer.agent import plugin_base as plugin
@six.add_metaclass(abc.ABCMeta) @six.add_metaclass(abc.ABCMeta)

View File

@ -17,7 +17,7 @@
from oslo.config import cfg from oslo.config import cfg
import oslo.messaging import oslo.messaging
from ceilometer import plugin from ceilometer.agent import plugin_base
from ceilometer import sample from ceilometer import sample
@ -31,7 +31,7 @@ cfg.CONF.register_opts(OPTS)
SERVICE = 'sahara' SERVICE = 'sahara'
class DataProcessing(plugin.NotificationBase): class DataProcessing(plugin_base.NotificationBase):
resource_name = '%s.cluster' % SERVICE resource_name = '%s.cluster' % SERVICE

View File

@ -21,7 +21,7 @@ from oslo.config import cfg
import requests import requests
import six import six
from ceilometer.central import plugin from ceilometer.agent import plugin_base
from ceilometer.i18n import _ from ceilometer.i18n import _
from ceilometer.openstack.common import log from ceilometer.openstack.common import log
from ceilometer import sample from ceilometer import sample
@ -62,8 +62,8 @@ class KwapiClient(object):
yield probe_dict yield probe_dict
class _Base(plugin.CentralPollster): class _Base(plugin_base.PollsterBase):
"""Base class for the Kwapi pollster, derived from CentralPollster.""" """Base class for the Kwapi pollster, derived from PollsterBase."""
@property @property
def default_discovery(self): def default_discovery(self):

View File

@ -14,10 +14,10 @@
from oslo.config import cfg from oslo.config import cfg
from ceilometer.agent import plugin_base
from ceilometer.i18n import _ from ceilometer.i18n import _
from ceilometer import nova_client from ceilometer import nova_client
from ceilometer.openstack.common import log from ceilometer.openstack.common import log
from ceilometer import plugin
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)
@ -37,7 +37,7 @@ OPTS = [
cfg.CONF.register_opts(OPTS, group='hardware') cfg.CONF.register_opts(OPTS, group='hardware')
class NodesDiscoveryTripleO(plugin.DiscoveryBase): class NodesDiscoveryTripleO(plugin_base.DiscoveryBase):
def __init__(self): def __init__(self):
super(NodesDiscoveryTripleO, self).__init__() super(NodesDiscoveryTripleO, self).__init__()
self.nova_cli = nova_client.Client() self.nova_cli = nova_client.Client()

View File

@ -25,7 +25,7 @@ import itertools
from oslo.utils import netutils from oslo.utils import netutils
import six import six
from ceilometer.central import plugin from ceilometer.agent import plugin_base
from ceilometer.hardware import inspector as insloader from ceilometer.hardware import inspector as insloader
from ceilometer.i18n import _ from ceilometer.i18n import _
from ceilometer.openstack.common import log from ceilometer.openstack.common import log
@ -34,7 +34,7 @@ LOG = log.getLogger(__name__)
@six.add_metaclass(abc.ABCMeta) @six.add_metaclass(abc.ABCMeta)
class HardwarePollster(plugin.CentralPollster): class HardwarePollster(plugin_base.PollsterBase):
"""Base class for plugins that support the polling API.""" """Base class for plugins that support the polling API."""
CACHE_KEY = None CACHE_KEY = None

View File

@ -14,7 +14,7 @@
from oslo.config import cfg from oslo.config import cfg
import oslo.messaging import oslo.messaging
from ceilometer import plugin from ceilometer.agent import plugin_base
from ceilometer import sample from ceilometer import sample
OPTS = [ OPTS = [
@ -29,7 +29,7 @@ cfg.CONF.register_opts(OPTS)
SERVICE = 'identity' SERVICE = 'identity'
class _Base(plugin.NotificationBase): class _Base(plugin_base.NotificationBase):
"""Convert identity notification into Samples.""" """Convert identity notification into Samples."""
resource_type = None resource_type = None

View File

@ -24,7 +24,7 @@ import glanceclient
from oslo.config import cfg from oslo.config import cfg
from oslo.utils import timeutils from oslo.utils import timeutils
from ceilometer.central import plugin from ceilometer.agent import plugin_base
from ceilometer import sample from ceilometer import sample
@ -49,7 +49,7 @@ cfg.CONF.register_opts(OPTS)
cfg.CONF.register_opts(SERVICE_OPTS, group='service_types') cfg.CONF.register_opts(SERVICE_OPTS, group='service_types')
class _Base(plugin.CentralPollster): class _Base(plugin_base.PollsterBase):
@property @property
def default_discovery(self): def default_discovery(self):

View File

@ -21,7 +21,7 @@
from oslo.config import cfg from oslo.config import cfg
import oslo.messaging import oslo.messaging
from ceilometer import plugin from ceilometer.agent import plugin_base
from ceilometer import sample from ceilometer import sample
OPTS = [ OPTS = [
@ -34,7 +34,7 @@ OPTS = [
cfg.CONF.register_opts(OPTS) cfg.CONF.register_opts(OPTS)
class ImageBase(plugin.NotificationBase): class ImageBase(plugin_base.NotificationBase):
"""Base class for image counting.""" """Base class for image counting."""
@staticmethod @staticmethod

View File

@ -14,10 +14,10 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from ceilometer import agent from ceilometer.agent import manager
class AgentManager(agent.AgentManager): class AgentManager(manager.AgentManager):
def __init__(self): def __init__(self):
super(AgentManager, self).__init__('ipmi') super(AgentManager, self).__init__('ipmi')

View File

@ -21,8 +21,8 @@ notification events.
from oslo.config import cfg from oslo.config import cfg
from oslo import messaging from oslo import messaging
from ceilometer.agent import plugin_base
from ceilometer.openstack.common import log from ceilometer.openstack.common import log
from ceilometer import plugin
from ceilometer import sample from ceilometer import sample
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)
@ -67,7 +67,7 @@ class InvalidSensorData(ValueError):
pass pass
class SensorNotification(plugin.NotificationBase): class SensorNotification(plugin_base.NotificationBase):
"""A generic class for extracting samples from sensor data notifications. """A generic class for extracting samples from sensor data notifications.
A notification message can contain multiple samples from multiple A notification message can contain multiple samples from multiple

View File

@ -20,8 +20,8 @@ from oslo.config import cfg
from oslo.utils import timeutils from oslo.utils import timeutils
import six import six
from ceilometer.agent import plugin_base
from ceilometer.ipmi.platform import intel_node_manager as node_manager from ceilometer.ipmi.platform import intel_node_manager as node_manager
from ceilometer import plugin
from ceilometer import sample from ceilometer import sample
CONF = cfg.CONF CONF = cfg.CONF
@ -29,7 +29,7 @@ CONF.import_opt('host', 'ceilometer.service')
@six.add_metaclass(abc.ABCMeta) @six.add_metaclass(abc.ABCMeta)
class _Base(plugin.PollsterBase): class _Base(plugin_base.PollsterBase):
def __init__(self): def __init__(self):
self.nodemanager = node_manager.NodeManager() self.nodemanager = node_manager.NodeManager()

View File

@ -17,9 +17,9 @@
from oslo.config import cfg from oslo.config import cfg
from oslo.utils import timeutils from oslo.utils import timeutils
from ceilometer.agent import plugin_base
from ceilometer.ipmi.notifications import ironic as parser from ceilometer.ipmi.notifications import ironic as parser
from ceilometer.ipmi.platform import ipmi_sensor from ceilometer.ipmi.platform import ipmi_sensor
from ceilometer import plugin
from ceilometer import sample from ceilometer import sample
CONF = cfg.CONF CONF = cfg.CONF
@ -30,7 +30,7 @@ class InvalidSensorData(ValueError):
pass pass
class SensorPollster(plugin.PollsterBase): class SensorPollster(plugin_base.PollsterBase):
METRIC = None METRIC = None

View File

@ -18,7 +18,7 @@
from oslo.config import cfg from oslo.config import cfg
import oslo.messaging import oslo.messaging
from ceilometer import plugin from ceilometer.agent import plugin_base
from ceilometer import sample from ceilometer import sample
cfg.CONF.import_opt('nova_control_exchange', cfg.CONF.import_opt('nova_control_exchange',
@ -42,7 +42,7 @@ OPTS = [
cfg.CONF.register_opts(OPTS) cfg.CONF.register_opts(OPTS)
class HTTPRequest(plugin.NotificationBase): class HTTPRequest(plugin_base.NotificationBase):
event_types = ['http.request'] event_types = ['http.request']
@staticmethod @staticmethod

View File

@ -21,7 +21,7 @@
from oslo.config import cfg from oslo.config import cfg
from oslo.utils import timeutils from oslo.utils import timeutils
from ceilometer.central import plugin from ceilometer.agent import plugin_base
from ceilometer.i18n import _ from ceilometer.i18n import _
from ceilometer import nova_client from ceilometer import nova_client
from ceilometer.openstack.common import log from ceilometer.openstack.common import log
@ -33,7 +33,7 @@ LOG = log.getLogger(__name__)
cfg.CONF.import_group('service_types', 'ceilometer.nova_client') cfg.CONF.import_group('service_types', 'ceilometer.nova_client')
class FloatingIPPollster(plugin.CentralPollster): class FloatingIPPollster(plugin_base.PollsterBase):
def _get_floating_ips(self, ksclient, endpoint): def _get_floating_ips(self, ksclient, endpoint):
nv = nova_client.Client( nv = nova_client.Client(

View File

@ -22,9 +22,9 @@
from oslo.config import cfg from oslo.config import cfg
import oslo.messaging import oslo.messaging
from ceilometer.agent import plugin_base
from ceilometer.i18n import _ from ceilometer.i18n import _
from ceilometer.openstack.common import log from ceilometer.openstack.common import log
from ceilometer import plugin
from ceilometer import sample from ceilometer import sample
OPTS = [ OPTS = [
@ -39,7 +39,7 @@ cfg.CONF.register_opts(OPTS)
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)
class NetworkNotificationBase(plugin.NotificationBase): class NetworkNotificationBase(plugin_base.NotificationBase):
resource_name = None resource_name = None

View File

@ -15,9 +15,9 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from ceilometer.agent import plugin_base
from ceilometer import neutron_client from ceilometer import neutron_client
from ceilometer.openstack.common import log from ceilometer.openstack.common import log
from ceilometer import plugin
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)
@ -30,7 +30,7 @@ STATUS = {
} }
class BaseServicesPollster(plugin.PollsterBase): class BaseServicesPollster(plugin_base.PollsterBase):
FIELDS = [] FIELDS = []
nc = neutron_client.Client() nc = neutron_client.Client()

View File

@ -17,15 +17,14 @@
from oslo.config import cfg from oslo.config import cfg
from ceilometer.central import plugin from ceilometer.agent import plugin_base
from ceilometer import neutron_client from ceilometer import neutron_client
from ceilometer import plugin as base_plugin
cfg.CONF.import_group('service_types', 'ceilometer.neutron_client') cfg.CONF.import_group('service_types', 'ceilometer.neutron_client')
class _BaseServicesDiscovery(base_plugin.DiscoveryBase): class _BaseServicesDiscovery(plugin_base.DiscoveryBase):
def __init__(self): def __init__(self):
super(_BaseServicesDiscovery, self).__init__() super(_BaseServicesDiscovery, self).__init__()
@ -33,7 +32,7 @@ class _BaseServicesDiscovery(base_plugin.DiscoveryBase):
class LBPoolsDiscovery(_BaseServicesDiscovery): class LBPoolsDiscovery(_BaseServicesDiscovery):
@plugin.check_keystone(cfg.CONF.service_types.neutron) @plugin_base.check_keystone(cfg.CONF.service_types.neutron)
def discover(self, manager, param=None): def discover(self, manager, param=None):
"""Discover resources to monitor.""" """Discover resources to monitor."""
@ -43,7 +42,7 @@ class LBPoolsDiscovery(_BaseServicesDiscovery):
class LBVipsDiscovery(_BaseServicesDiscovery): class LBVipsDiscovery(_BaseServicesDiscovery):
@plugin.check_keystone(cfg.CONF.service_types.neutron) @plugin_base.check_keystone(cfg.CONF.service_types.neutron)
def discover(self, manager, param=None): def discover(self, manager, param=None):
"""Discover resources to monitor.""" """Discover resources to monitor."""
@ -53,7 +52,7 @@ class LBVipsDiscovery(_BaseServicesDiscovery):
class LBMembersDiscovery(_BaseServicesDiscovery): class LBMembersDiscovery(_BaseServicesDiscovery):
@plugin.check_keystone(cfg.CONF.service_types.neutron) @plugin_base.check_keystone(cfg.CONF.service_types.neutron)
def discover(self, manager, param=None): def discover(self, manager, param=None):
"""Discover resources to monitor.""" """Discover resources to monitor."""
@ -63,7 +62,7 @@ class LBMembersDiscovery(_BaseServicesDiscovery):
class LBHealthMonitorsDiscovery(_BaseServicesDiscovery): class LBHealthMonitorsDiscovery(_BaseServicesDiscovery):
@plugin.check_keystone(cfg.CONF.service_types.neutron) @plugin_base.check_keystone(cfg.CONF.service_types.neutron)
def discover(self, manager, param=None): def discover(self, manager, param=None):
"""Discover resources to monitor.""" """Discover resources to monitor."""
@ -72,7 +71,7 @@ class LBHealthMonitorsDiscovery(_BaseServicesDiscovery):
class VPNServicesDiscovery(_BaseServicesDiscovery): class VPNServicesDiscovery(_BaseServicesDiscovery):
@plugin.check_keystone(cfg.CONF.service_types.neutron) @plugin_base.check_keystone(cfg.CONF.service_types.neutron)
def discover(self, manager, param=None): def discover(self, manager, param=None):
"""Discover resources to monitor.""" """Discover resources to monitor."""
@ -82,7 +81,7 @@ class VPNServicesDiscovery(_BaseServicesDiscovery):
class IPSecConnectionsDiscovery(_BaseServicesDiscovery): class IPSecConnectionsDiscovery(_BaseServicesDiscovery):
@plugin.check_keystone(cfg.CONF.service_types.neutron) @plugin_base.check_keystone(cfg.CONF.service_types.neutron)
def discover(self, manager, param=None): def discover(self, manager, param=None):
"""Discover resources to monitor.""" """Discover resources to monitor."""
@ -91,7 +90,7 @@ class IPSecConnectionsDiscovery(_BaseServicesDiscovery):
class FirewallDiscovery(_BaseServicesDiscovery): class FirewallDiscovery(_BaseServicesDiscovery):
@plugin.check_keystone(cfg.CONF.service_types.neutron) @plugin_base.check_keystone(cfg.CONF.service_types.neutron)
def discover(self, manager, param=None): def discover(self, manager, param=None):
"""Discover resources to monitor.""" """Discover resources to monitor."""
@ -101,7 +100,7 @@ class FirewallDiscovery(_BaseServicesDiscovery):
class FirewallPolicyDiscovery(_BaseServicesDiscovery): class FirewallPolicyDiscovery(_BaseServicesDiscovery):
@plugin.check_keystone(cfg.CONF.service_types.neutron) @plugin_base.check_keystone(cfg.CONF.service_types.neutron)
def discover(self, manager, param=None): def discover(self, manager, param=None):
"""Discover resources to monitor.""" """Discover resources to monitor."""

View File

@ -20,12 +20,12 @@ import six
from six.moves.urllib import parse as urlparse from six.moves.urllib import parse as urlparse
from stevedore import driver as _driver from stevedore import driver as _driver
from ceilometer.central import plugin from ceilometer.agent import plugin_base
from ceilometer import sample from ceilometer import sample
@six.add_metaclass(abc.ABCMeta) @six.add_metaclass(abc.ABCMeta)
class _Base(plugin.CentralPollster): class _Base(plugin_base.PollsterBase):
NAMESPACE = 'network.statistics.drivers' NAMESPACE = 'network.statistics.drivers'
drivers = {} drivers = {}

View File

@ -25,7 +25,7 @@ from oslo.utils import timeutils
import six.moves.urllib.parse as urlparse import six.moves.urllib.parse as urlparse
from swiftclient import client as swift from swiftclient import client as swift
from ceilometer.central import plugin from ceilometer.agent import plugin_base
from ceilometer.i18n import _ from ceilometer.i18n import _
from ceilometer.openstack.common import log from ceilometer.openstack.common import log
from ceilometer import sample from ceilometer import sample
@ -51,7 +51,7 @@ cfg.CONF.register_opts(SERVICE_OPTS, group='service_types')
cfg.CONF.import_group('service_credentials', 'ceilometer.service') cfg.CONF.import_group('service_credentials', 'ceilometer.service')
class _Base(plugin.CentralPollster): class _Base(plugin_base.PollsterBase):
METHOD = 'head' METHOD = 'head'
_ENDPOINT = None _ENDPOINT = None

View File

@ -13,13 +13,13 @@
# under the License. # under the License.
import itertools import itertools
import ceilometer.agent.manager
import ceilometer.alarm.notifier.rest import ceilometer.alarm.notifier.rest
import ceilometer.alarm.rpc import ceilometer.alarm.rpc
import ceilometer.alarm.service import ceilometer.alarm.service
import ceilometer.api import ceilometer.api
import ceilometer.api.app import ceilometer.api.app
import ceilometer.api.controllers.v2 import ceilometer.api.controllers.v2
import ceilometer.central.manager
import ceilometer.cmd.alarm import ceilometer.cmd.alarm
import ceilometer.collector import ceilometer.collector
import ceilometer.compute.discovery import ceilometer.compute.discovery
@ -104,7 +104,7 @@ def list_opts():
('api', ('api',
itertools.chain(ceilometer.api.OPTS, itertools.chain(ceilometer.api.OPTS,
ceilometer.api.app.API_OPTS,)), ceilometer.api.app.API_OPTS,)),
('central', ceilometer.central.manager.OPTS), ('central', ceilometer.agent.manager.OPTS),
('collector', ceilometer.collector.OPTS), ('collector', ceilometer.collector.OPTS),
('compute', ceilometer.compute.discovery.OPTS), ('compute', ceilometer.compute.discovery.OPTS),
('coordination', ceilometer.coordination.OPTS), ('coordination', ceilometer.coordination.OPTS),

View File

@ -18,7 +18,7 @@
from oslo.config import cfg from oslo.config import cfg
import oslo.messaging import oslo.messaging
from ceilometer import plugin from ceilometer.agent import plugin_base
from ceilometer import sample from ceilometer import sample
@ -32,7 +32,7 @@ cfg.CONF.register_opts(OPTS)
SERVICE = 'orchestration' SERVICE = 'orchestration'
class StackCRUD(plugin.NotificationBase): class StackCRUD(plugin_base.NotificationBase):
resource_name = '%s.stack' % SERVICE resource_name = '%s.stack' % SERVICE

View File

@ -16,7 +16,7 @@
from oslo.config import cfg from oslo.config import cfg
import oslo.messaging import oslo.messaging
from ceilometer import plugin from ceilometer.agent import plugin_base
from ceilometer import sample from ceilometer import sample
@ -32,7 +32,7 @@ cfg.CONF.import_opt('keystone_control_exchange',
'ceilometer.identity.notifications') 'ceilometer.identity.notifications')
class ProfilerNotifications(plugin.NotificationBase): class ProfilerNotifications(plugin_base.NotificationBase):
event_types = ["profiler.*"] event_types = ["profiler.*"]

View File

View File

@ -31,8 +31,8 @@ from oslotest import mockpatch
import six import six
from stevedore import extension from stevedore import extension
from ceilometer.agent import plugin_base
from ceilometer import pipeline from ceilometer import pipeline
from ceilometer import plugin
from ceilometer import publisher from ceilometer import publisher
from ceilometer.publisher import test as test_publisher from ceilometer.publisher import test as test_publisher
from ceilometer import sample from ceilometer import sample
@ -70,7 +70,7 @@ default_test_data = TestSample(
) )
class TestPollster(plugin.PollsterBase): class TestPollster(plugin_base.PollsterBase):
test_data = default_test_data test_data = default_test_data
discovery = None discovery = None
@ -95,13 +95,13 @@ class TestPollsterException(TestPollster):
raise Exception() raise Exception()
class TestDiscovery(plugin.DiscoveryBase): class TestDiscovery(plugin_base.DiscoveryBase):
def discover(self, manager, param=None): def discover(self, manager, param=None):
self.params.append(param) self.params.append(param)
return self.resources return self.resources
class TestDiscoveryException(plugin.DiscoveryBase): class TestDiscoveryException(plugin_base.DiscoveryBase):
def discover(self, manager, param=None): def discover(self, manager, param=None):
self.params.append(param) self.params.append(param)
raise Exception() raise Exception()
@ -310,7 +310,7 @@ class BaseAgentManagerTestCase(base.BaseTestCase):
def test_setup_polling_tasks(self): def test_setup_polling_tasks(self):
polling_tasks = self.mgr.setup_polling_tasks() polling_tasks = self.mgr.setup_polling_tasks()
self.assertEqual(1, len(polling_tasks)) self.assertEqual(1, len(polling_tasks))
self.assertIn(60, polling_tasks.keys()) self.assertTrue(60 in polling_tasks.keys())
per_task_resources = polling_tasks[60].resources per_task_resources = polling_tasks[60].resources
self.assertEqual(1, len(per_task_resources)) self.assertEqual(1, len(per_task_resources))
self.assertEqual(set(self.pipeline_cfg[0]['resources']), self.assertEqual(set(self.pipeline_cfg[0]['resources']),
@ -332,8 +332,8 @@ class BaseAgentManagerTestCase(base.BaseTestCase):
self.setup_pipeline() self.setup_pipeline()
polling_tasks = self.mgr.setup_polling_tasks() polling_tasks = self.mgr.setup_polling_tasks()
self.assertEqual(2, len(polling_tasks)) self.assertEqual(2, len(polling_tasks))
self.assertIn(60, polling_tasks.keys()) self.assertTrue(60 in polling_tasks.keys())
self.assertIn(10, polling_tasks.keys()) self.assertTrue(10 in polling_tasks.keys())
def test_setup_polling_tasks_mismatch_counter(self): def test_setup_polling_tasks_mismatch_counter(self):
self.pipeline_cfg.append( self.pipeline_cfg.append(
@ -347,7 +347,7 @@ class BaseAgentManagerTestCase(base.BaseTestCase):
}) })
polling_tasks = self.mgr.setup_polling_tasks() polling_tasks = self.mgr.setup_polling_tasks()
self.assertEqual(1, len(polling_tasks)) self.assertEqual(1, len(polling_tasks))
self.assertIn(60, polling_tasks.keys()) self.assertTrue(60 in polling_tasks.keys())
def test_setup_polling_task_same_interval(self): def test_setup_polling_task_same_interval(self):
self.pipeline_cfg.append({ self.pipeline_cfg.append({
@ -529,7 +529,7 @@ class BaseAgentManagerTestCase(base.BaseTestCase):
self.setup_pipeline() self.setup_pipeline()
polling_tasks = self.mgr.setup_polling_tasks() polling_tasks = self.mgr.setup_polling_tasks()
self.assertEqual(1, len(polling_tasks)) self.assertEqual(1, len(polling_tasks))
self.assertIn(60, polling_tasks.keys()) self.assertTrue(60 in polling_tasks.keys())
self.mgr.interval_task(polling_tasks.get(60)) self.mgr.interval_task(polling_tasks.get(60))
self.assertEqual([None], self.Discovery.params) self.assertEqual([None], self.Discovery.params)
self.assertEqual([None], self.DiscoveryAnother.params) self.assertEqual([None], self.DiscoveryAnother.params)
@ -553,11 +553,11 @@ class BaseAgentManagerTestCase(base.BaseTestCase):
published = pipe_line.publishers[0].samples[0] published = pipe_line.publishers[0].samples[0]
published_resources = published.resource_metadata['resources'] published_resources = published.resource_metadata['resources']
self.assertEqual(3, len(published_resources)) self.assertEqual(3, len(published_resources))
self.assertIn(published_resources[0], expected_pipelines) self.assertTrue(published_resources[0] in expected_pipelines)
self.assertEqual(expected_pipelines[published_resources[0]], self.assertEqual(expected_pipelines[published_resources[0]],
pipe_line.name) pipe_line.name)
for published_resource in published_resources: for published_resource in published_resources:
self.assertIn(published_resource, all_resources) self.assertTrue(published_resource in all_resources)
sunk_resources.extend(published_resources) sunk_resources.extend(published_resources)
self.assertEqual(all_resources, set(sunk_resources)) self.assertEqual(all_resources, set(sunk_resources))
@ -585,7 +585,7 @@ class BaseAgentManagerTestCase(base.BaseTestCase):
self.setup_pipeline() self.setup_pipeline()
polling_tasks = self.mgr.setup_polling_tasks() polling_tasks = self.mgr.setup_polling_tasks()
self.assertEqual(1, len(polling_tasks)) self.assertEqual(1, len(polling_tasks))
self.assertIn(60, polling_tasks.keys()) self.assertTrue(60 in polling_tasks.keys())
self.mgr.interval_task(polling_tasks.get(60)) self.mgr.interval_task(polling_tasks.get(60))
self.assertEqual(1, len(self.Pollster.samples)) self.assertEqual(1, len(self.Pollster.samples))
self.assertEqual(['discovered_1', 'discovered_2'], self.assertEqual(['discovered_1', 'discovered_2'],
@ -612,7 +612,7 @@ class BaseAgentManagerTestCase(base.BaseTestCase):
self.setup_pipeline() self.setup_pipeline()
polling_tasks = self.mgr.setup_polling_tasks() polling_tasks = self.mgr.setup_polling_tasks()
self.assertEqual(1, len(polling_tasks)) self.assertEqual(1, len(polling_tasks))
self.assertIn(60, polling_tasks.keys()) self.assertTrue(60 in polling_tasks.keys())
self.mgr.interval_task(polling_tasks.get(60)) self.mgr.interval_task(polling_tasks.get(60))
self.assertEqual(1, len(self.Pollster.samples)) self.assertEqual(1, len(self.Pollster.samples))
self.assertEqual(['discovered_1', 'discovered_2'], self.assertEqual(['discovered_1', 'discovered_2'],
@ -681,7 +681,7 @@ class BaseAgentManagerTestCase(base.BaseTestCase):
polling_task = self.mgr.setup_polling_tasks().values()[0] polling_task = self.mgr.setup_polling_tasks().values()[0]
pollster = list(polling_task.pollster_matches['test_pipeline'])[0] pollster = list(polling_task.pollster_matches['test_pipeline'])[0]
LOG = mock.MagicMock() LOG = mock.MagicMock()
with mock.patch('ceilometer.agent.LOG', LOG): with mock.patch('ceilometer.agent.base.LOG', LOG):
polling_task.poll_and_publish() polling_task.poll_and_publish()
if not self.mgr.discover(): if not self.mgr.discover():
LOG.info.assert_called_with('Skip polling pollster %s, no ' LOG.info.assert_called_with('Skip polling pollster %s, no '

View File

@ -21,14 +21,14 @@ import mock
from oslo.config import fixture as fixture_config from oslo.config import fixture as fixture_config
from oslotest import base from oslotest import base
from ceilometer.central import discovery from ceilometer.agent.discovery import endpoint
class TestEndpointDiscovery(base.BaseTestCase): class TestEndpointDiscovery(base.BaseTestCase):
def setUp(self): def setUp(self):
super(TestEndpointDiscovery, self).setUp() super(TestEndpointDiscovery, self).setUp()
self.discovery = discovery.EndpointDiscovery() self.discovery = endpoint.EndpointDiscovery()
self.manager = mock.MagicMock() self.manager = mock.MagicMock()
self.CONF = self.useFixture(fixture_config.Config()).conf self.CONF = self.useFixture(fixture_config.Config()).conf

View File

@ -22,10 +22,10 @@ from oslotest import base
from oslotest import mockpatch from oslotest import mockpatch
from stevedore import extension from stevedore import extension
from ceilometer.central import manager from ceilometer.agent import manager
from ceilometer.central import plugin from ceilometer.agent import plugin_base
from ceilometer import pipeline from ceilometer import pipeline
from ceilometer.tests import agentbase from ceilometer.tests.agent import agentbase
class TestManager(base.BaseTestCase): class TestManager(base.BaseTestCase):
@ -37,7 +37,7 @@ class TestManager(base.BaseTestCase):
class TestPollsterKeystone(agentbase.TestPollster): class TestPollsterKeystone(agentbase.TestPollster):
@plugin.check_keystone @plugin_base.check_keystone
def get_samples(self, manager, cache, resources): def get_samples(self, manager, cache, resources):
func = super(TestPollsterKeystone, self).get_samples func = super(TestPollsterKeystone, self).get_samples
return func(manager=manager, return func(manager=manager,
@ -111,3 +111,8 @@ class TestRunTasks(agentbase.BaseAgentManagerTestCase):
polling_tasks = self.mgr.setup_polling_tasks() polling_tasks = self.mgr.setup_polling_tasks()
self.mgr.interval_task(polling_tasks.values()[0]) self.mgr.interval_task(polling_tasks.values()[0])
self.assertFalse(self.PollsterKeystone.samples) self.assertFalse(self.PollsterKeystone.samples)
def test_interval_exception_isolation(self):
super(TestRunTasks, self).test_interval_exception_isolation()
self.assertEqual(1, len(self.PollsterException.samples))
self.assertEqual(1, len(self.PollsterExceptionAnother.samples))

View File

@ -19,7 +19,7 @@ import mock
from oslo.config import fixture as fixture_config from oslo.config import fixture as fixture_config
from oslotest import base from oslotest import base
from ceilometer import plugin from ceilometer.agent import plugin_base
TEST_NOTIFICATION = { TEST_NOTIFICATION = {
@ -78,29 +78,29 @@ class NotificationBaseTestCase(base.BaseTestCase):
self.CONF = self.useFixture(fixture_config.Config()).conf self.CONF = self.useFixture(fixture_config.Config()).conf
def test_handle_event_type(self): def test_handle_event_type(self):
self.assertFalse(plugin.NotificationBase._handle_event_type( self.assertFalse(plugin_base.NotificationBase._handle_event_type(
'compute.instance.start', ['compute'])) 'compute.instance.start', ['compute']))
self.assertFalse(plugin.NotificationBase._handle_event_type( self.assertFalse(plugin_base.NotificationBase._handle_event_type(
'compute.instance.start', ['compute.*.foobar'])) 'compute.instance.start', ['compute.*.foobar']))
self.assertFalse(plugin.NotificationBase._handle_event_type( self.assertFalse(plugin_base.NotificationBase._handle_event_type(
'compute.instance.start', ['compute.*.*.foobar'])) 'compute.instance.start', ['compute.*.*.foobar']))
self.assertTrue(plugin.NotificationBase._handle_event_type( self.assertTrue(plugin_base.NotificationBase._handle_event_type(
'compute.instance.start', ['compute.*'])) 'compute.instance.start', ['compute.*']))
self.assertTrue(plugin.NotificationBase._handle_event_type( self.assertTrue(plugin_base.NotificationBase._handle_event_type(
'compute.instance.start', ['*'])) 'compute.instance.start', ['*']))
self.assertTrue(plugin.NotificationBase._handle_event_type( self.assertTrue(plugin_base.NotificationBase._handle_event_type(
'compute.instance.start', ['compute.*.start'])) 'compute.instance.start', ['compute.*.start']))
self.assertTrue(plugin.NotificationBase._handle_event_type( self.assertTrue(plugin_base.NotificationBase._handle_event_type(
'compute.instance.start', ['*.start'])) 'compute.instance.start', ['*.start']))
self.assertTrue(plugin.NotificationBase._handle_event_type( self.assertTrue(plugin_base.NotificationBase._handle_event_type(
'compute.instance.start', ['compute.*.*.foobar', 'compute.*'])) 'compute.instance.start', ['compute.*.*.foobar', 'compute.*']))
class FakePlugin(plugin.NotificationBase): class FakePlugin(plugin_base.NotificationBase):
def get_exchange_topics(self, conf): def get_exchange_topics(self, conf):
return [plugin.ExchangeTopics(exchange="exchange1", return [plugin_base.ExchangeTopics(exchange="exchange1",
topics=["t1", "t2"]), topics=["t1", "t2"]),
plugin.ExchangeTopics(exchange="exchange2", plugin_base.ExchangeTopics(exchange="exchange2",
topics=['t3'])] topics=['t3'])]
def process_notification(self, message): def process_notification(self, message):
return message return message

View File

@ -22,7 +22,7 @@ from oslotest import base
from oslotest import mockpatch from oslotest import mockpatch
import six import six
from ceilometer.central import manager from ceilometer.agent import manager
from ceilometer.energy import kwapi from ceilometer.energy import kwapi
from ceilometer.openstack.common import context from ceilometer.openstack.common import context

View File

@ -18,7 +18,7 @@
import fixtures import fixtures
import mock import mock
from ceilometer.central import manager from ceilometer.agent import manager
from ceilometer.hardware.inspector import base as inspector_base from ceilometer.hardware.inspector import base as inspector_base
from ceilometer.tests import base as test_base from ceilometer.tests import base as test_base

View File

@ -20,7 +20,7 @@ from oslo.config import fixture as fixture_config
from oslotest import base from oslotest import base
from oslotest import mockpatch from oslotest import mockpatch
from ceilometer.central import manager from ceilometer.agent import manager
from ceilometer.image import glance from ceilometer.image import glance
from ceilometer.openstack.common import context from ceilometer.openstack.common import context

View File

@ -17,11 +17,12 @@
""" """
from ceilometer.ipmi import manager from ceilometer.ipmi import manager
from ceilometer.tests import agentbase
import mock import mock
from oslotest import base from oslotest import base
from ceilometer.tests.agent import agentbase
class TestManager(base.BaseTestCase): class TestManager(base.BaseTestCase):

View File

@ -19,8 +19,8 @@ import mock
from oslotest import base from oslotest import base
from oslotest import mockpatch from oslotest import mockpatch
from ceilometer.central import manager from ceilometer.agent import manager
from ceilometer.central import plugin from ceilometer.agent import plugin_base
from ceilometer.network.services import discovery from ceilometer.network.services import discovery
from ceilometer.network.services import fwaas from ceilometer.network.services import fwaas
from ceilometer.openstack.common import context from ceilometer.openstack.common import context
@ -34,9 +34,9 @@ class _BaseTestFWPollster(base.BaseTestCase):
self.addCleanup(mock.patch.stopall) self.addCleanup(mock.patch.stopall)
self.context = context.get_admin_context() self.context = context.get_admin_context()
self.manager = manager.AgentManager() self.manager = manager.AgentManager()
plugin._get_keystone = mock.Mock() plugin_base._get_keystone = mock.Mock()
plugin._get_keystone.service_catalog.get_endpoints = mock.MagicMock( plugin_base._get_keystone.service_catalog.get_endpoints = (
return_value={'network': mock.ANY}) mock.MagicMock(return_value={'network': mock.ANY}))
class TestFirewallPollster(_BaseTestFWPollster): class TestFirewallPollster(_BaseTestFWPollster):

View File

@ -19,8 +19,8 @@ import mock
from oslotest import base from oslotest import base
from oslotest import mockpatch from oslotest import mockpatch
from ceilometer.central import manager from ceilometer.agent import manager
from ceilometer.central import plugin from ceilometer.agent import plugin_base
from ceilometer.network.services import discovery from ceilometer.network.services import discovery
from ceilometer.network.services import lbaas from ceilometer.network.services import lbaas
from ceilometer.openstack.common import context from ceilometer.openstack.common import context
@ -34,9 +34,9 @@ class _BaseTestLBPollster(base.BaseTestCase):
self.addCleanup(mock.patch.stopall) self.addCleanup(mock.patch.stopall)
self.context = context.get_admin_context() self.context = context.get_admin_context()
self.manager = manager.AgentManager() self.manager = manager.AgentManager()
plugin._get_keystone = mock.Mock() plugin_base._get_keystone = mock.Mock()
plugin._get_keystone.service_catalog.get_endpoints = mock.MagicMock( plugin_base._get_keystone.service_catalog.get_endpoints = (
return_value={'network': mock.ANY}) mock.MagicMock(return_value={'network': mock.ANY}))
class TestLBPoolPollster(_BaseTestLBPollster): class TestLBPoolPollster(_BaseTestLBPollster):

View File

@ -19,8 +19,8 @@ import mock
from oslotest import base from oslotest import base
from oslotest import mockpatch from oslotest import mockpatch
from ceilometer.central import manager from ceilometer.agent import manager
from ceilometer.central import plugin from ceilometer.agent import plugin_base
from ceilometer.network.services import discovery from ceilometer.network.services import discovery
from ceilometer.network.services import vpnaas from ceilometer.network.services import vpnaas
from ceilometer.openstack.common import context from ceilometer.openstack.common import context
@ -34,9 +34,9 @@ class _BaseTestVPNPollster(base.BaseTestCase):
self.addCleanup(mock.patch.stopall) self.addCleanup(mock.patch.stopall)
self.context = context.get_admin_context() self.context = context.get_admin_context()
self.manager = manager.AgentManager() self.manager = manager.AgentManager()
plugin._get_keystone = mock.Mock() plugin_base._get_keystone = mock.Mock()
plugin._get_keystone.service_catalog.get_endpoints = mock.MagicMock( plugin_base._get_keystone.service_catalog.get_endpoints = (
return_value={'network': mock.ANY}) mock.MagicMock(return_value={'network': mock.ANY}))
class TestVPNServicesPollster(_BaseTestVPNPollster): class TestVPNServicesPollster(_BaseTestVPNPollster):

View File

@ -22,7 +22,7 @@
import mock import mock
from oslotest import base from oslotest import base
from ceilometer.central import manager from ceilometer.agent import manager
from ceilometer.network import floatingip from ceilometer.network import floatingip
from ceilometer.openstack.common import context from ceilometer.openstack.common import context

View File

@ -25,7 +25,7 @@ from oslotest import mockpatch
from swiftclient import client as swift_client from swiftclient import client as swift_client
import testscenarios.testcase import testscenarios.testcase
from ceilometer.central import manager from ceilometer.agent import manager
from ceilometer.objectstore import swift from ceilometer.objectstore import swift
HEAD_ACCOUNTS = [('tenant-000', {'x-account-object-count': 12, HEAD_ACCOUNTS = [('tenant-000', {'x-account-object-count': 12,

View File

@ -21,7 +21,7 @@ events.
from oslo.config import cfg from oslo.config import cfg
import oslo.messaging import oslo.messaging
from ceilometer import plugin from ceilometer.agent import plugin_base
from ceilometer import sample from ceilometer import sample
OPTS = [ OPTS = [
@ -34,7 +34,7 @@ OPTS = [
cfg.CONF.register_opts(OPTS) cfg.CONF.register_opts(OPTS)
class VolumeBase(plugin.NotificationBase): class VolumeBase(plugin_base.NotificationBase):
"""Convert volume/snapshot notification into Counters.""" """Convert volume/snapshot notification into Counters."""
@staticmethod @staticmethod

View File

@ -93,8 +93,8 @@ ceilometer.notification =
ceilometer.discover = ceilometer.discover =
local_instances = ceilometer.compute.discovery:InstanceDiscovery local_instances = ceilometer.compute.discovery:InstanceDiscovery
endpoint = ceilometer.central.discovery:EndpointDiscovery endpoint = ceilometer.agent.discovery.endpoint:EndpointDiscovery
tenant = ceilometer.central.discovery:TenantDiscovery tenant = ceilometer.agent.discovery.tenant:TenantDiscovery
lb_pools = ceilometer.network.services.discovery:LBPoolsDiscovery lb_pools = ceilometer.network.services.discovery:LBPoolsDiscovery
lb_vips = ceilometer.network.services.discovery:LBVipsDiscovery lb_vips = ceilometer.network.services.discovery:LBVipsDiscovery
lb_members = ceilometer.network.services.discovery:LBMembersDiscovery lb_members = ceilometer.network.services.discovery:LBMembersDiscovery