summaryrefslogtreecommitdiff
path: root/ceilometer
diff options
context:
space:
mode:
Diffstat (limited to 'ceilometer')
-rw-r--r--ceilometer/cache_utils.py53
-rw-r--r--ceilometer/compute/pollsters/util.py8
-rw-r--r--ceilometer/hardware/__init__.py0
-rw-r--r--ceilometer/hardware/discovery.py144
-rw-r--r--ceilometer/hardware/inspector/__init__.py26
-rw-r--r--ceilometer/hardware/inspector/base.py40
-rw-r--r--ceilometer/hardware/inspector/snmp.py346
-rw-r--r--ceilometer/hardware/pollsters/__init__.py0
-rw-r--r--ceilometer/hardware/pollsters/data/snmp.yaml287
-rw-r--r--ceilometer/hardware/pollsters/generic.py225
-rw-r--r--ceilometer/hardware/pollsters/util.py59
-rw-r--r--ceilometer/locale/de/LC_MESSAGES/ceilometer.po41
-rw-r--r--ceilometer/locale/en_GB/LC_MESSAGES/ceilometer.po32
-rw-r--r--ceilometer/locale/es/LC_MESSAGES/ceilometer.po33
-rw-r--r--ceilometer/locale/fr/LC_MESSAGES/ceilometer.po25
-rw-r--r--ceilometer/locale/it/LC_MESSAGES/ceilometer.po29
-rw-r--r--ceilometer/locale/ja/LC_MESSAGES/ceilometer.po31
-rw-r--r--ceilometer/locale/ko_KR/LC_MESSAGES/ceilometer.po31
-rw-r--r--ceilometer/locale/pt_BR/LC_MESSAGES/ceilometer.po29
-rw-r--r--ceilometer/locale/ru/LC_MESSAGES/ceilometer.po39
-rw-r--r--ceilometer/locale/zh_CN/LC_MESSAGES/ceilometer.po23
-rw-r--r--ceilometer/locale/zh_TW/LC_MESSAGES/ceilometer.po23
-rw-r--r--ceilometer/network/statistics/__init__.py9
-rw-r--r--ceilometer/network/statistics/opendaylight/client.py3
-rw-r--r--ceilometer/opts.py5
-rw-r--r--ceilometer/pipeline/base.py12
-rw-r--r--ceilometer/polling/dynamic_pollster.py14
-rw-r--r--ceilometer/polling/manager.py86
-rw-r--r--ceilometer/polling/plugin_base.py3
-rw-r--r--ceilometer/publisher/data/gnocchi_resources.yaml55
-rw-r--r--ceilometer/publisher/gnocchi.py4
-rw-r--r--ceilometer/publisher/utils.py2
-rw-r--r--ceilometer/sample.py5
-rw-r--r--ceilometer/tests/unit/event/test_endpoint.py84
-rw-r--r--ceilometer/tests/unit/hardware/__init__.py0
-rw-r--r--ceilometer/tests/unit/hardware/inspector/__init__.py0
-rw-r--r--ceilometer/tests/unit/hardware/inspector/test_inspector.py31
-rw-r--r--ceilometer/tests/unit/hardware/inspector/test_snmp.py271
-rw-r--r--ceilometer/tests/unit/hardware/pollsters/__init__.py0
-rw-r--r--ceilometer/tests/unit/hardware/pollsters/test_generic.py193
-rw-r--r--ceilometer/tests/unit/hardware/pollsters/test_util.py59
-rw-r--r--ceilometer/tests/unit/image/test_glance.py112
-rw-r--r--ceilometer/tests/unit/meter/test_notifications.py242
-rw-r--r--ceilometer/tests/unit/network/statistics/opendaylight/test_driver.py24
-rw-r--r--ceilometer/tests/unit/polling/test_discovery.py79
-rw-r--r--ceilometer/tests/unit/polling/test_manager.py124
-rw-r--r--ceilometer/tests/unit/publisher/test_gnocchi.py172
-rw-r--r--ceilometer/tests/unit/publisher/test_utils.py6
-rw-r--r--ceilometer/tests/unit/test_middleware.py78
-rw-r--r--ceilometer/tests/unit/test_neutronclient.py2
-rw-r--r--ceilometer/tests/unit/test_notification.py84
-rw-r--r--ceilometer/tests/unit/test_sample.py40
-rw-r--r--ceilometer/tests/unit/volume/test_cinder.py144
53 files changed, 778 insertions, 2689 deletions
diff --git a/ceilometer/cache_utils.py b/ceilometer/cache_utils.py
new file mode 100644
index 00000000..55a9e263
--- /dev/null
+++ b/ceilometer/cache_utils.py
@@ -0,0 +1,53 @@
+#
+# Copyright 2022 Red Hat, Inc
+#
+# 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.
+
+"""Simple wrapper for oslo_cache."""
+
+
+from oslo_cache import core as cache
+
+
+class CacheClient(object):
+ def __init__(self, region):
+ self.region = region
+
+ def get(self, key):
+ value = self.region.get(key)
+ if value == cache.NO_VALUE:
+ return None
+ return value
+
+ def set(self, key, value):
+ return self.region.set(key, value)
+
+ def delete(self, key):
+ return self.region.delete(key)
+
+
+def get_client(conf, expiration_time=0):
+ cache.configure(conf)
+ if conf.cache.enabled:
+ return CacheClient(_get_default_cache_region(
+ conf,
+ expiration_time=expiration_time
+ ))
+
+
+def _get_default_cache_region(conf, expiration_time):
+ region = cache.create_region()
+ if expiration_time != 0:
+ conf.cache.expiration_time = expiration_time
+ cache.configure_cache_region(conf, region)
+ return region
diff --git a/ceilometer/compute/pollsters/util.py b/ceilometer/compute/pollsters/util.py
index a0ac83b7..1c708dfc 100644
--- a/ceilometer/compute/pollsters/util.py
+++ b/ceilometer/compute/pollsters/util.py
@@ -34,15 +34,15 @@ def _get_metadata_from_object(conf, instance):
instance_type = instance.flavor['name'] if instance.flavor else None
metadata = {
'display_name': instance.name,
- 'name': getattr(instance, 'OS-EXT-SRV-ATTR:instance_name', u''),
+ 'name': getattr(instance, 'OS-EXT-SRV-ATTR:instance_name', ''),
'instance_id': instance.id,
'instance_type': instance_type,
'host': instance.hostId,
- 'instance_host': getattr(instance, 'OS-EXT-SRV-ATTR:host', u''),
+ 'instance_host': getattr(instance, 'OS-EXT-SRV-ATTR:host', ''),
'flavor': instance.flavor,
'status': instance.status.lower(),
- 'state': getattr(instance, 'OS-EXT-STS:vm_state', u''),
- 'task_state': getattr(instance, 'OS-EXT-STS:task_state', u''),
+ 'state': getattr(instance, 'OS-EXT-STS:vm_state', ''),
+ 'task_state': getattr(instance, 'OS-EXT-STS:task_state', ''),
}
# Image properties
diff --git a/ceilometer/hardware/__init__.py b/ceilometer/hardware/__init__.py
deleted file mode 100644
index e69de29b..00000000
--- a/ceilometer/hardware/__init__.py
+++ /dev/null
diff --git a/ceilometer/hardware/discovery.py b/ceilometer/hardware/discovery.py
deleted file mode 100644
index b3c38f07..00000000
--- a/ceilometer/hardware/discovery.py
+++ /dev/null
@@ -1,144 +0,0 @@
-# -*- encoding: utf-8 -*-
-#
-# 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.
-
-import warnings
-
-from oslo_config import cfg
-from oslo_log import log
-from oslo_utils import timeutils
-
-from ceilometer import nova_client
-from ceilometer.polling import plugin_base
-
-LOG = log.getLogger(__name__)
-
-OPTS = [
- cfg.StrOpt('url_scheme',
- default='snmp://',
- deprecated_for_removal=True,
- help='URL scheme to use for hardware nodes.'),
- cfg.StrOpt('readonly_user_name',
- default='ro_snmp_user',
- deprecated_for_removal=True,
- help='SNMPd user name of all nodes running in the cloud.'),
- cfg.StrOpt('readonly_user_password',
- default='password',
- deprecated_for_removal=True,
- help='SNMPd v3 authentication password of all the nodes '
- 'running in the cloud.',
- secret=True),
- cfg.StrOpt('readonly_user_auth_proto',
- choices=['md5', 'sha'],
- deprecated_for_removal=True,
- help='SNMPd v3 authentication algorithm of all the nodes '
- 'running in the cloud'),
- cfg.StrOpt('readonly_user_priv_proto',
- choices=['des', 'aes128', '3des', 'aes192', 'aes256'],
- deprecated_for_removal=True,
- help='SNMPd v3 encryption algorithm of all the nodes '
- 'running in the cloud'),
- cfg.StrOpt('readonly_user_priv_password',
- deprecated_for_removal=True,
- help='SNMPd v3 encryption password of all the nodes '
- 'running in the cloud.',
- secret=True),
- cfg.StrOpt('tripleo_network_name',
- default='ctlplane',
- deprecated_for_removal=True,
- help='Name of the control plane Tripleo network')
-]
-
-
-class NodesDiscoveryTripleO(plugin_base.DiscoveryBase):
- def __init__(self, conf):
- super(NodesDiscoveryTripleO, self).__init__(conf)
- self.nova_cli = nova_client.Client(conf)
- self.last_run = None
- self.instances = {}
-
- warnings.warn('GenericHardwareDeclarativePollster has been deprecated '
- 'and will be removed in a future release.',
- category=DeprecationWarning, stacklevel=3)
-
- def _make_resource_url(self, ip):
- hwconf = self.conf.hardware
- url = hwconf.url_scheme
- username = hwconf.readonly_user_name
- password = hwconf.readonly_user_password
- if username:
- url += username
- if password:
- url += ':' + password
- if username or password:
- url += '@'
- url += ip
-
- opts = ['auth_proto', 'priv_proto', 'priv_password']
- query = "&".join(opt + "=" + hwconf['readonly_user_%s' % opt]
- for opt in opts
- if hwconf['readonly_user_%s' % opt])
- if query:
- url += '?' + query
-
- return url
-
- def discover(self, manager, param=None):
- """Discover resources to monitor.
-
- instance_get_all will return all instances if last_run is None,
- and will return only the instances changed since the last_run time.
- """
- try:
- instances = self.nova_cli.instance_get_all(self.last_run)
- except Exception:
- # NOTE(zqfan): instance_get_all is wrapped and will log exception
- # when there is any error. It is no need to raise it again and
- # print one more time.
- return []
-
- for instance in instances:
- if getattr(instance, 'OS-EXT-STS:vm_state', None) in ['deleted',
- 'error']:
- self.instances.pop(instance.id, None)
- else:
- self.instances[instance.id] = instance
- self.last_run = timeutils.utcnow(True).isoformat()
-
- resources = []
- for instance in self.instances.values():
- addresses = instance.addresses.get(
- self.conf.hardware.tripleo_network_name)
- if addresses is None:
- # NOTE(sileht): This is not a tripleo undercloud instance, this
- # is a cheap detection if ironic node deployed by tripleo, but
- # nova don't expose anything more useful and we must not log a
- # ERROR when the instance is not a tripleo undercloud one.
- continue
- try:
- ip_address = addresses[0].get('addr')
- final_address = self._make_resource_url(ip_address)
- resource = {
- 'resource_id': instance.id,
- 'resource_url': final_address,
- 'mac_addr': addresses[0].get('OS-EXT-IPS-MAC:mac_addr'),
- 'image_id': instance.image['id'],
- 'flavor_id': instance.flavor['id']
- }
-
- resources.append(resource)
- except KeyError:
- LOG.error("Couldn't obtain IP address of "
- "instance %s" % instance.id)
-
- return resources
diff --git a/ceilometer/hardware/inspector/__init__.py b/ceilometer/hardware/inspector/__init__.py
deleted file mode 100644
index 7e83d028..00000000
--- a/ceilometer/hardware/inspector/__init__.py
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# Copyright 2014 Intel Corp.
-#
-# 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 stevedore import driver
-
-
-def get_inspector(parsed_url, namespace='ceilometer.hardware.inspectors'):
- """Get inspector driver and load it.
-
- :param parsed_url: urlparse.SplitResult object for the inspector
- :param namespace: Namespace to use to look for drivers.
- """
- loaded_driver = driver.DriverManager(namespace, parsed_url.scheme)
- return loaded_driver.driver()
diff --git a/ceilometer/hardware/inspector/base.py b/ceilometer/hardware/inspector/base.py
deleted file mode 100644
index 7ac6e070..00000000
--- a/ceilometer/hardware/inspector/base.py
+++ /dev/null
@@ -1,40 +0,0 @@
-#
-# Copyright 2014 ZHAW SoE
-#
-# 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.
-"""Inspector abstraction for read-only access to hardware components"""
-
-import abc
-
-
-class Inspector(object, metaclass=abc.ABCMeta):
- @abc.abstractmethod
- def inspect_generic(self, host, cache, extra_metadata, param):
- """A generic inspect function.
-
- :param host: the target host
- :param cache: cache passed from the pollster
- :param extra_metadata: extra dict to be used as metadata
- :param param: a dict of inspector specific param
- :return: an iterator of (value, metadata, extra) containing the sample
- value, metadata dict to construct sample's metadata, and
- extra dict of extra metadata to help constructing sample
- """
-
- def prepare_params(self, param):
- """Parse the params to a format which the inspector itself recognizes.
-
- :param param: inspector params from meter definition file
- :return: a dict of param which the inspector recognized
- """
- return {}
diff --git a/ceilometer/hardware/inspector/snmp.py b/ceilometer/hardware/inspector/snmp.py
deleted file mode 100644
index a3fb4fd3..00000000
--- a/ceilometer/hardware/inspector/snmp.py
+++ /dev/null
@@ -1,346 +0,0 @@
-#
-# Copyright 2014 ZHAW SoE
-# Copyright 2014 Intel Corp
-#
-# 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.
-"""Inspector for collecting data over SNMP"""
-
-import copy
-
-from oslo_log import log
-from pysnmp.entity.rfc3413.oneliner import cmdgen
-from pysnmp.proto import rfc1905
-
-from urllib import parse as urlparse
-
-from ceilometer.hardware.inspector import base
-
-
-LOG = log.getLogger(__name__)
-
-
-class SNMPException(Exception):
- pass
-
-
-def parse_snmp_return(ret, is_bulk=False):
- """Check the return value of snmp operations
-
- :param ret: a tuple of (errorIndication, errorStatus, errorIndex, data)
- returned by pysnmp
- :param is_bulk: True if the ret value is from GetBulkRequest
- :return: a tuple of (err, data)
- err: True if error found, or False if no error found
- data: a string of error description if error found, or the
- actual return data of the snmp operation
- """
- err = True
- (errIndication, errStatus, errIdx, varBinds) = ret
- if errIndication:
- data = errIndication
- elif errStatus:
- if is_bulk:
- varBinds = varBinds[-1]
- data = "%s at %s" % (errStatus.prettyPrint(),
- errIdx and varBinds[int(errIdx) - 1] or "?")
- else:
- err = False
- data = varBinds
- return err, data
-
-
-EXACT = 'type_exact'
-PREFIX = 'type_prefix'
-
-_auth_proto_mapping = {
- 'md5': cmdgen.usmHMACMD5AuthProtocol,
- 'sha': cmdgen.usmHMACSHAAuthProtocol,
-}
-_priv_proto_mapping = {
- 'des': cmdgen.usmDESPrivProtocol,
- 'aes128': cmdgen.usmAesCfb128Protocol,
- '3des': cmdgen.usm3DESEDEPrivProtocol,
- 'aes192': cmdgen.usmAesCfb192Protocol,
- 'aes256': cmdgen.usmAesCfb256Protocol,
-}
-_usm_proto_mapping = {
- 'auth_proto': ('authProtocol', _auth_proto_mapping),
- 'priv_proto': ('privProtocol', _priv_proto_mapping),
-}
-
-
-class SNMPInspector(base.Inspector):
- # Default port
- _port = 161
-
- _CACHE_KEY_OID = "snmp_cached_oid"
-
- # NOTE: The following mapping has been moved to the yaml file identified
- # by the config options hardware.meter_definitions_file. However, we still
- # keep the description here for code reading purpose.
-
- """
-
- The following mapping define how to construct
- (value, metadata, extra) returned by inspect_generic
- MAPPING = {
- 'identifier: {
- 'matching_type': EXACT or PREFIX,
- 'metric_oid': (oid, value_converter)
- 'metadata': {
- metadata_name1: (oid1, value_converter),
- metadata_name2: (oid2, value_converter),
- },
- 'post_op': special func to modify the return data,
- },
- }
-
- For matching_type of EXACT, each item in the above mapping will
- return exact one (value, metadata, extra) tuple. The value would be
- returned from SNMP request GetRequest for oid of 'metric_oid', the
- metadata dict would be constructed based on the returning from SNMP
- GetRequest for oids of 'metadata'.
-
- For matching_type of PREFIX, SNMP request GetBulkRequest
- would be sent to get values for oids of 'metric_oid' and
- 'metadata' of each item in the above mapping. And each item might
- return multiple (value, metadata, extra) tuples, e.g.
- Suppose we have the following mapping:
- MAPPING = {
- 'disk.size.total': {
- 'matching_type': PREFIX,
- 'metric_oid': ("1.3.6.1.4.1.2021.9.1.6", int)
- 'metadata': {
- 'device': ("1.3.6.1.4.1.2021.9.1.3", str),
- 'path': ("1.3.6.1.4.1.2021.9.1.2", str),
- },
- 'post_op': None,
- },
- and the SNMP have the following oid/value(s):
- {
- '1.3.6.1.4.1.2021.9.1.6.1': 19222656,
- '1.3.6.1.4.1.2021.9.1.3.1': "/dev/sda2",
- '1.3.6.1.4.1.2021.9.1.2.1': "/"
- '1.3.6.1.4.1.2021.9.1.6.2': 808112,
- '1.3.6.1.4.1.2021.9.1.3.2': "tmpfs",
- '1.3.6.1.4.1.2021.9.1.2.2': "/run",
- }
- So here we'll return 2 instances of (value, metadata, extra):
- (19222656, {'device': "/dev/sda2", 'path': "/"}, None)
- (808112, {'device': "tmpfs", 'path': "/run"}, None)
-
- The post_op is assumed to be implemented by new metric developer. It
- could be used to add additional special metadata(e.g. ip address), or
- it could be used to add information into extra dict to be returned
- to construct the pollster how to build final sample, e.g.
- extra.update('project_id': xy, 'user_id': zw)
- """
-
- def _query_oids(self, host, oids, cache, is_bulk):
- # send GetRequest or GetBulkRequest to get oids values and
- # populate the values into cache
- authData = self._get_auth_strategy(host)
- transport = cmdgen.UdpTransportTarget((host.hostname,
- host.port or self._port))
- oid_cache = cache.setdefault(self._CACHE_KEY_OID, {})
-
- cmd_runner = cmdgen.CommandGenerator()
- if is_bulk:
- ret = cmd_runner.bulkCmd(authData, transport, 0, 100, *oids,
- lookupValues=True)
- else:
- ret = cmd_runner.getCmd(authData, transport, *oids,
- lookupValues=True)
- (error, data) = parse_snmp_return(ret, is_bulk)
- if error:
- raise SNMPException("An error occurred, oids %(oid)s, "
- "host %(host)s, %(err)s" %
- dict(oid=oids,
- host=host.hostname,
- err=data))
- # save result into cache
- if is_bulk:
- for var_bind_table_row in data:
- for name, val in var_bind_table_row:
- oid_cache[str(name)] = val
- else:
- for name, val in data:
- oid_cache[str(name)] = val
-
- @staticmethod
- def find_matching_oids(oid_cache, oid, match_type, find_one=True):
- matched = []
- if match_type == PREFIX:
- for key in oid_cache.keys():
- if key.startswith(oid):
- matched.append(key)
- if find_one:
- break
- else:
- if oid in oid_cache:
- matched.append(oid)
- return matched
-
- @staticmethod
- def get_oid_value(oid_cache, oid_def, suffix='', host=None):
- oid, converter = oid_def
- value = oid_cache[oid + suffix]
- if isinstance(value, (rfc1905.NoSuchObject, rfc1905.NoSuchInstance)):
- LOG.debug("OID %s%s has no value" % (
- oid, " on %s" % host.hostname if host else ""))
- return None
- if converter:
- value = converter(value)
- return value
-
- @classmethod
- def construct_metadata(cls, oid_cache, meta_defs, suffix='', host=None):
- metadata = {}
- for key, oid_def in meta_defs.items():
- metadata[key] = cls.get_oid_value(oid_cache, oid_def, suffix, host)
- return metadata
-
- @classmethod
- def _find_missing_oids(cls, meter_def, cache):
- # find oids have not been queried and cached
- new_oids = []
- oid_cache = cache.setdefault(cls._CACHE_KEY_OID, {})
- # check metric_oid
- if not cls.find_matching_oids(oid_cache,
- meter_def['metric_oid'][0],
- meter_def['matching_type']):
- new_oids.append(meter_def['metric_oid'][0])
- for metadata in meter_def['metadata'].values():
- if not cls.find_matching_oids(oid_cache,
- metadata[0],
- meter_def['matching_type']):
- new_oids.append(metadata[0])
- return new_oids
-
- def inspect_generic(self, host, cache, extra_metadata, param):
- # the snmp definition for the corresponding meter
- meter_def = param
- # collect oids that needs to be queried
- oids_to_query = self._find_missing_oids(meter_def, cache)
- # query oids and populate into caches
- if oids_to_query:
- self._query_oids(host, oids_to_query, cache,
- meter_def['matching_type'] == PREFIX)
- # construct (value, metadata, extra)
- oid_cache = cache[self._CACHE_KEY_OID]
- # find all oids which needed to construct final sample values
- # for matching type of EXACT, only 1 sample would be generated
- # for matching type of PREFIX, multiple samples could be generated
- oids_for_sample_values = self.find_matching_oids(
- oid_cache,
- meter_def['metric_oid'][0],
- meter_def['matching_type'],
- False)
- input_extra_metadata = extra_metadata
-
- for oid in oids_for_sample_values:
- suffix = oid[len(meter_def['metric_oid'][0]):]
- value = self.get_oid_value(oid_cache,
- meter_def['metric_oid'],
- suffix, host)
- # get the metadata for this sample value
- metadata = self.construct_metadata(oid_cache,
- meter_def['metadata'],
- suffix, host)
- extra_metadata = copy.deepcopy(input_extra_metadata) or {}
- # call post_op for special cases
- if meter_def['post_op']:
- func = getattr(self, meter_def['post_op'], None)
- if func:
- value = func(host, cache, meter_def,
- value, metadata, extra_metadata,
- suffix)
- yield (value, metadata, extra_metadata)
-
- def _post_op_memory_avail_to_used(self, host, cache, meter_def,
- value, metadata, extra, suffix):
- _memory_total_oid = "1.3.6.1.4.1.2021.4.5.0"
- if _memory_total_oid not in cache[self._CACHE_KEY_OID]:
- self._query_oids(host, [_memory_total_oid], cache, False)
-
- total_value = self.get_oid_value(cache[self._CACHE_KEY_OID],
- (_memory_total_oid, int))
- if total_value is None:
- return None
- return total_value - value
-
- def _post_op_net(self, host, cache, meter_def,
- value, metadata, extra, suffix):
- # add ip address into metadata
- _interface_ip_oid = "1.3.6.1.2.1.4.20.1.2"
- oid_cache = cache.setdefault(self._CACHE_KEY_OID, {})
- if not self.find_matching_oids(oid_cache,
- _interface_ip_oid,
- PREFIX):
- # populate the oid into cache
- self._query_oids(host, [_interface_ip_oid], cache, True)
- ip_addr = ''
- for k, v in oid_cache.items():
- if k.startswith(_interface_ip_oid) and v == int(suffix[1:]):
- ip_addr = k.replace(_interface_ip_oid + ".", "")
- metadata.update(ip=ip_addr)
- # update resource_id for each nic interface
- self._suffix_resource_id(host, metadata, 'name', extra)
- return value
-
- def _post_op_disk(self, host, cache, meter_def,
- value, metadata, extra, suffix):
- self._suffix_resource_id(host, metadata, 'device', extra)
- return value
-
- @staticmethod
- def _suffix_resource_id(host, metadata, key, extra):
- prefix = metadata.get(key)
- if prefix:
- res_id = extra.get('resource_id') or host.hostname
- res_id = res_id + ".%s" % metadata.get(key)
- extra.update(resource_id=res_id)
-
- @staticmethod
- def _get_auth_strategy(host):
- options = urlparse.parse_qs(host.query)
- kwargs = {}
-
- for key in _usm_proto_mapping:
- opt = options.get(key, [None])[-1]
- value = _usm_proto_mapping[key][1].get(opt)
- if value:
- kwargs[_usm_proto_mapping[key][0]] = value
-
- priv_pass = options.get('priv_password', [None])[-1]
- if priv_pass:
- kwargs['privKey'] = priv_pass
- if host.password:
- kwargs['authKey'] = host.password
-
- if kwargs:
- auth_strategy = cmdgen.UsmUserData(host.username,
- **kwargs)
- else:
- auth_strategy = cmdgen.CommunityData(host.username or 'public')
- return auth_strategy
-
- def prepare_params(self, param):
- processed = {}
- processed['matching_type'] = param['matching_type']
- processed['metric_oid'] = (param['oid'], eval(param['type']))
- processed['post_op'] = param.get('post_op', None)
- processed['metadata'] = {}
- for k, v in param.get('metadata', {}).items():
- processed['metadata'][k] = (v['oid'], eval(v['type']))
- return processed
diff --git a/ceilometer/hardware/pollsters/__init__.py b/ceilometer/hardware/pollsters/__init__.py
deleted file mode 100644
index e69de29b..00000000
--- a/ceilometer/hardware/pollsters/__init__.py
+++ /dev/null
diff --git a/ceilometer/hardware/pollsters/data/snmp.yaml b/ceilometer/hardware/pollsters/data/snmp.yaml
deleted file mode 100644
index 3e7e518d..00000000
--- a/ceilometer/hardware/pollsters/data/snmp.yaml
+++ /dev/null
@@ -1,287 +0,0 @@
----
-# see http://www.circitor.fr/Mibs/Html/U/UCD-SNMP-MIB.php for reference.
-# http://www.circitor.fr/Mibs/Html/U/UCD-DISKIO-MIB.php for disk metrics
-
-metric:
-# cpu
- - name: hardware.cpu.load.1min
- unit: process
- type: gauge
- snmp_inspector:
- matching_type: "type_exact"
- oid: "1.3.6.1.4.1.2021.10.1.3.1"
- type: "lambda x: float(str(x))"
-
- - name: hardware.cpu.load.5min
- unit: process
- type: gauge
- snmp_inspector:
- matching_type: "type_exact"
- oid: "1.3.6.1.4.1.2021.10.1.3.2"
- type: "lambda x: float(str(x))"
-
- - name: hardware.cpu.load.15min
- unit: process
- type: gauge
- snmp_inspector:
- matching_type: "type_exact"
- oid: "1.3.6.1.4.1.2021.10.1.3.3"
- type: "lambda x: float(str(x))"
-
- # hardware.cpu.util is deprecated
- - name: hardware.cpu.util
- unit: "%"
- type: gauge
- snmp_inspector:
- matching_type: "type_exact"
- oid: "1.3.6.1.4.1.2021.11.9.0"
- type: "int"
-
- - name: hardware.cpu.user
- unit: tick
- type: gauge
- snmp_inspector:
- matching_type: "type_exact"
- oid: "1.3.6.1.4.1.2021.11.50.0"
- type: "int"
- - name: hardware.cpu.nice
- unit: tick
- type: gauge
- snmp_inspector:
- matching_type: "type_exact"
- oid: "1.3.6.1.4.1.2021.11.51.0"
- type: "int"
- - name: hardware.cpu.system
- unit: tick
- type: gauge
- snmp_inspector:
- matching_type: "type_exact"
- oid: "1.3.6.1.4.1.2021.11.52.0"
- type: "int"
- - name: hardware.cpu.idle
- unit: tick
- type: gauge
- snmp_inspector:
- matching_type: "type_exact"
- oid: "1.3.6.1.4.1.2021.11.53.0"
- type: "int"
- - name: hardware.cpu.wait
- unit: tick
- type: gauge
- snmp_inspector:
- matching_type: "type_exact"
- oid: "1.3.6.1.4.1.2021.11.54.0"
- type: "int"
- - name: hardware.cpu.kernel
- unit: tick
- type: gauge
- snmp_inspector:
- matching_type: "type_exact"
- oid: "1.3.6.1.4.1.2021.11.55.0"
- type: "int"
- - name: hardware.cpu.interrupt
- unit: tick
- type: gauge
- snmp_inspector:
- matching_type: "type_exact"
- oid: "1.3.6.1.4.1.2021.11.56.0"
- type: "int"
-
-# disk
- - name: hardware.disk.size.total
- unit: KB
- type: gauge
- snmp_inspector:
- matching_type: "type_prefix"
- oid: "1.3.6.1.4.1.2021.9.1.6"
- type: "int"
- metadata: &disk_metadata
- path:
- oid: "1.3.6.1.4.1.2021.9.1.2"
- type: "str"
- device:
- oid: "1.3.6.1.4.1.2021.9.1.3"
- type: "str"
- post_op: "_post_op_disk"
-
- - name: hardware.disk.size.used
- unit: KB
- type: gauge
- snmp_inspector:
- matching_type: "type_prefix"
- oid: "1.3.6.1.4.1.2021.9.1.8"
- type: "int"
- metadata: *disk_metadata
- post_op: "_post_op_disk"
-
- - name: hardware.disk.read.bytes
- unit: B
- type: gauge
- snmp_inspector:
- matching_type: "type_prefix"
- oid: "1.3.6.1.4.1.2021.13.15.1.1.3"
- type: "int"
- metadata: &diskio_metadata
- device:
- oid: "1.3.6.1.4.1.2021.13.15.1.1.2"
- post_op: "_post_op_disk"
-
- - name: hardware.disk.write.bytes
- unit: B
- type: gauge
- snmp_inspector:
- matching_type: "type_prefix"
- oid: "1.3.6.1.4.1.2021.13.15.1.1.4"
- type: "int"
- <<: *diskio_metadata
- post_op: "_post_op_disk"
-
- - name: hardware.disk.read.requests
- unit: requests
- type: gauge
- snmp_inspector:
- matching_type: "type_prefix"
- oid: "1.3.6.1.4.1.2021.13.15.1.1.5"
- type: "int"
- <<: *diskio_metadata
- post_op: "_post_op_disk"
-
- - name: hardware.disk.write.requests
- unit: requests
- type: gauge
- snmp_inspector:
- matching_type: "type_prefix"
- oid: "1.3.6.1.4.1.2021.13.15.1.1.6"
- type: "int"
- <<: *diskio_metadata
- post_op: "_post_op_disk"
-
-# memory
- - name: hardware.memory.total
- unit: KB
- type: gauge
- snmp_inspector:
- matching_type: "type_exact"
- oid: "1.3.6.1.4.1.2021.4.5.0"
- type: "int"
-
- - name: hardware.memory.used
- unit: KB
- type: gauge
- snmp_inspector:
- matching_type: "type_exact"
- oid: "1.3.6.1.4.1.2021.4.6.0"
- type: "int"
- post_op: "_post_op_memory_avail_to_used"
-
- - name: hardware.memory.swap.total
- unit: KB
- type: gauge
- snmp_inspector:
- matching_type: "type_exact"
- oid: "1.3.6.1.4.1.2021.4.3.0"
- type: "int"
-
- - name: hardware.memory.swap.avail
- unit: KB
- type: gauge
- snmp_inspector:
- matching_type: "type_exact"
- oid: "1.3.6.1.4.1.2021.4.4.0"
- type: "int"
-
- - name: hardware.memory.buffer
- unit: KB
- type: gauge
- snmp_inspector:
- matching_type: "type_exact"
- oid: "1.3.6.1.4.1.2021.4.14.0"
- type: "int"
-
- - name: hardware.memory.cached
- unit: KB
- type: gauge
- snmp_inspector:
- matching_type: "type_exact"
- oid: "1.3.6.1.4.1.2021.4.15.0"
- type: "int"
-# network interface
- - name: hardware.network.incoming.bytes
- unit: B
- type: cumulative
- snmp_inspector:
- matching_type: "type_prefix"
- oid: "1.3.6.1.2.1.2.2.1.10"
- type: "int"
- metadata: &net_metadata
- name:
- oid: "1.3.6.1.2.1.2.2.1.2"
- type: "str"
- speed:
- oid: "1.3.6.1.2.1.2.2.1.5"
- type: "lambda x: int(x) / 8"
- mac:
- oid: "1.3.6.1.2.1.2.2.1.6"
- type: "lambda x: x.prettyPrint().replace('0x', '')"
- post_op: "_post_op_net"
-
- - name: hardware.network.outgoing.bytes
- unit: B
- type: cumulative
- snmp_inspector:
- matching_type: "type_prefix"
- oid: "1.3.6.1.2.1.2.2.1.16"
- type: "int"
- metadata: *net_metadata
- post_op: "_post_op_net"
-
- - name: hardware.network.outgoing.errors
- unit: packet
- type: cumulative
- snmp_inspector:
- matching_type: "type_prefix"
- oid: "1.3.6.1.2.1.2.2.1.20"
- type: "int"
- metadata: *net_metadata
- post_op: "_post_op_net"
-#network aggregate
- - name: hardware.network.ip.outgoing.datagrams
- unit: datagrams
- type: cumulative
- snmp_inspector:
- matching_type: "type_exact"
- oid: "1.3.6.1.2.1.4.10.0"
- type: "int"
-
- - name: hardware.network.ip.incoming.datagrams
- unit: datagrams
- type: cumulative
- snmp_inspector:
- matching_type: "type_exact"
- oid: "1.3.6.1.2.1.4.3.0"
- type: "int"
-#system stats
- # hardware.system_stats.cpu.idle is deprecated
- - name: hardware.system_stats.cpu.idle
- unit: "%"
- type: gauge
- snmp_inspector:
- matching_type: "type_exact"
- oid: "1.3.6.1.4.1.2021.11.11.0"
- type: "int"
-
- - name: hardware.system_stats.io.outgoing.blocks
- unit: blocks
- type: cumulative
- snmp_inspector:
- matching_type: "type_exact"
- oid: "1.3.6.1.4.1.2021.11.57.0"
- type: "int"
-
- - name: hardware.system_stats.io.incoming.blocks
- unit: blocks
- type: cumulative
- snmp_inspector:
- matching_type: "type_exact"
- oid: "1.3.6.1.4.1.2021.11.58.0"
- type: "int"
diff --git a/ceilometer/hardware/pollsters/generic.py b/ceilometer/hardware/pollsters/generic.py
deleted file mode 100644
index c94bca04..00000000
--- a/ceilometer/hardware/pollsters/generic.py
+++ /dev/null
@@ -1,225 +0,0 @@
-#
-# Copyright 2015 Intel Corp.
-#
-# 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.
-
-import itertools
-import pkg_resources
-import warnings
-
-from oslo_config import cfg
-from oslo_log import log
-from oslo_utils import netutils
-
-from ceilometer import declarative
-from ceilometer.hardware import inspector as insloader
-from ceilometer.hardware.pollsters import util
-from ceilometer.i18n import _
-from ceilometer.polling import plugin_base
-from ceilometer import sample
-
-OPTS = [
- cfg.StrOpt('meter_definitions_file',
- default="snmp.yaml",
- deprecated_for_removal=True,
- help="Configuration file for defining hardware snmp meters."
- ),
-]
-
-LOG = log.getLogger(__name__)
-
-
-class MeterDefinition(object):
- required_fields = ['name', 'unit', 'type']
-
- def __init__(self, definition_cfg):
- self.cfg = definition_cfg
- for fname, fval in self.cfg.items():
- if (isinstance(fname, str) and
- (fname in self.required_fields or
- fname.endswith('_inspector'))):
- setattr(self, fname, fval)
- else:
- LOG.warning("Ignore unrecognized field %s", fname)
- for fname in self.required_fields:
- if not getattr(self, fname, None):
- raise declarative.MeterDefinitionException(
- _("Missing field %s") % fname, self.cfg)
- if self.type not in sample.TYPES:
- raise declarative.MeterDefinitionException(
- _("Unrecognized type value %s") % self.type, self.cfg)
-
-
-class GenericHardwareDeclarativePollster(plugin_base.PollsterBase):
- CACHE_KEY = 'hardware.generic'
- mapping = None
-
- def __init__(self, conf):
- super(GenericHardwareDeclarativePollster, self).__init__(conf)
- self.inspectors = {}
-
- warnings.warn('GenericHardwareDeclarativePollster has been deprecated '
- 'and will be removed in a future release.',
- category=DeprecationWarning, stacklevel=3)
-
- def _update_meter_definition(self, definition):
- self.meter_definition = definition
- self.cached_inspector_params = {}
-
- @property
- def default_discovery(self):
- return 'tripleo_overcloud_nodes'
-
- @staticmethod
- def _parse_resource(res):
- """Parse resource from discovery.
-
- Either URL can be given or dict. Dict has to contain at least
- keys 'resource_id' and 'resource_url', all the dict keys will be stored
- as metadata.
-
- :param res: URL or dict containing all resource info.
- :return: parsed_url, resource_id, metadata Returns parsed URL used for
- SNMP query, unique identifier of the resource and metadata
- of the resource.
- """
- parsed_url, resource_id, metadata = (None, None, None)
- if isinstance(res, dict):
- if 'resource_url' not in res or 'resource_id' not in res:
- LOG.error('Passed resource dict must contain keys '
- 'resource_id and resource_url.')
- else:
- metadata = res
- parsed_url = netutils.urlsplit(res['resource_url'])
- resource_id = res['resource_id']
- else:
- metadata = {}
- parsed_url = netutils.urlsplit(res)
- resource_id = res
-
- return parsed_url, resource_id, metadata
-
- def _get_inspector(self, parsed_url):
- if parsed_url.scheme not in self.inspectors:
- try:
- driver = insloader.get_inspector(parsed_url)
- self.inspectors[parsed_url.scheme] = driver
- except Exception as err:
- LOG.exception("Cannot load inspector %(name)s: %(err)s",
- dict(name=parsed_url.scheme,
- err=err))
- raise
- return self.inspectors[parsed_url.scheme]
-
- def get_samples(self, manager, cache, resources=None):
- """Return an iterable of Sample instances from polling the resources.
-
- :param manager: The service manager invoking the plugin
- :param cache: A dictionary for passing data between plugins
- :param resources: end point to poll data from
- """
- resources = resources or []
- h_cache = cache.setdefault(self.CACHE_KEY, {})
- sample_iters = []
-
- # Get the meter identifiers to poll
- identifier = self.meter_definition.name
-
- for resource in resources:
- parsed_url, res, extra_metadata = self._parse_resource(resource)
- if parsed_url is None:
- LOG.error("Skip invalid resource %s", resource)
- continue
- ins = self._get_inspector(parsed_url)
- try:
- # Call hardware inspector to poll for the data
- i_cache = h_cache.setdefault(res, {})
-
- # Prepare inspector parameters and cache it for performance
- param_key = parsed_url.scheme + '.' + identifier
- inspector_param = self.cached_inspector_params.get(param_key)
- if not inspector_param:
- param = getattr(self.meter_definition,
- parsed_url.scheme + '_inspector', {})
- inspector_param = ins.prepare_params(param)
- self.cached_inspector_params[param_key] = inspector_param
-
- if identifier not in i_cache:
- i_cache[identifier] = list(ins.inspect_generic(
- host=parsed_url,
- cache=i_cache,
- extra_metadata=extra_metadata,
- param=inspector_param))
- # Generate samples
- if i_cache[identifier]:
- sample_iters.append(self.generate_samples(
- parsed_url,
- i_cache[identifier]))
- except Exception as err:
- msg = ('inspector call failed for %(ident)s '
- 'host %(host)s: %(err)s' %
- dict(ident=identifier,
- host=parsed_url.hostname,
- err=err))
- if "timeout" in str(err):
- LOG.warning(msg)
- else:
- LOG.exception(msg)
- return itertools.chain(*sample_iters)
-
- def generate_samples(self, host_url, data):
- """Generate a list of Sample from the data returned by inspector
-
- :param host_url: host url of the endpoint
- :param data: list of data returned by the corresponding inspector
- """
- samples = []
- definition = self.meter_definition
- for (value, metadata, extra) in data:
- s = util.make_sample_from_host(host_url,
- name=definition.name,
- sample_type=definition.type,
- unit=definition.unit,
- volume=value,
- res_metadata=metadata,
- extra=extra,
- name_prefix=None)
- samples.append(s)
- return samples
-
- @classmethod
- def build_pollsters(cls, conf):
- if not cls.mapping:
- definition_cfg = declarative.load_definitions(
- conf, {}, conf.hardware.meter_definitions_file,
- pkg_resources.resource_filename(__name__, "data/snmp.yaml"))
- cls.mapping = load_definition(definition_cfg)
-
- pollsters = []
- for name in cls.mapping:
- pollster = cls(conf)
- pollster._update_meter_definition(cls.mapping[name])
- pollsters.append((name, pollster))
- return pollsters
-
-
-def load_definition(config_def):
- mappings = {}
- for meter_def in config_def.get('metric', []):
- try:
- meter = MeterDefinition(meter_def)
- mappings[meter.name] = meter
- except declarative.DefinitionException as e:
- errmsg = "Error loading meter definition: %s"
- LOG.error(errmsg, e.brief_message)
- return mappings
diff --git a/ceilometer/hardware/pollsters/util.py b/ceilometer/hardware/pollsters/util.py
deleted file mode 100644
index 7f1a76ab..00000000
--- a/ceilometer/hardware/pollsters/util.py
+++ /dev/null
@@ -1,59 +0,0 @@
-#
-# Copyright 2013 ZHAW SoE
-# Copyright 2014 Intel Corp.
-#
-# 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.
-
-import copy
-
-from urllib import parse as urlparse
-
-from ceilometer import sample
-
-
-def get_metadata_from_host(host_url):
- return {'resource_url': urlparse.urlunsplit(host_url)}
-
-
-def make_resource_metadata(res_metadata=None, host_url=None):
- resource_metadata = dict()
- if res_metadata is not None:
- metadata = copy.copy(res_metadata)
- resource_metadata.update(metadata)
- resource_metadata.update(get_metadata_from_host(host_url))
- return resource_metadata
-
-
-def make_sample_from_host(host_url, name, sample_type, unit, volume,
- project_id=None, user_id=None, resource_id=None,
- res_metadata=None, extra=None,
- name_prefix='hardware'):
-
- extra = extra or {}
- resource_metadata = make_resource_metadata(res_metadata, host_url)
- resource_metadata.update(extra)
-
- res_id = resource_id or extra.get('resource_id') or host_url.hostname
- if name_prefix:
- name = name_prefix + '.' + name
- return sample.Sample(
- name=name,
- type=sample_type,
- unit=unit,
- volume=volume,
- user_id=user_id or extra.get('user_id'),
- project_id=project_id or extra.get('project_id'),
- resource_id=res_id,
- resource_metadata=resource_metadata,
- source='hardware',
- )
diff --git a/ceilometer/locale/de/LC_MESSAGES/ceilometer.po b/ceilometer/locale/de/LC_MESSAGES/ceilometer.po
index 1f2c1666..631c6dd1 100644
--- a/ceilometer/locale/de/LC_MESSAGES/ceilometer.po
+++ b/ceilometer/locale/de/LC_MESSAGES/ceilometer.po
@@ -13,7 +13,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ceilometer VERSION\n"
"Report-Msgid-Bugs-To: https://bugs.launchpad.net/openstack-i18n/\n"
-"POT-Creation-Date: 2021-09-15 14:12+0000\n"
+"POT-Creation-Date: 2022-08-22 19:15+0000\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -84,10 +84,6 @@ msgid "Invalid type %s specified"
msgstr "Ungültiger Typ %s angegeben"
#, python-format
-msgid "Missing field %s"
-msgstr "Fehlendes Feld %s"
-
-#, python-format
msgid "No plugin named %(plugin)s available for %(name)s"
msgstr "Kein Plug-in mit dem Namen %(plugin)s verfügbar für %(name)s."
@@ -161,53 +157,18 @@ msgid "Unable to send sample over UDP"
msgstr "Beispiel kann nicht über UDP gesendet werden"
#, python-format
-msgid ""
-"Unknown status %(stat)s received on Load Balancer %(id)s, skipping sample"
-msgstr ""
-"Unbekannten Status %(stat)s erhalten für Loadbalancer %(id)s; Beispiel wird "
-"übersprungen"
-
-#, python-format
msgid "Unknown status %(stat)s received on fw %(id)s,skipping sample"
msgstr ""
"Unbekannten Status %(stat)s erhalten für Firewall %(id)s; Beispiel wird "
"übersprungen"
#, python-format
-msgid "Unknown status %(stat)s received on listener %(id)s, skipping sample"
-msgstr ""
-"Unbekannten Status %(stat)s erhalten für Listener %(id)s; Beispiel wird "
-"übersprungen"
-
-#, python-format
-msgid "Unknown status %(stat)s received on member %(id)s, skipping sample"
-msgstr ""
-"Unbekannten Status %(stat)s erhalten für Mitglied %(id)s; Beispiel wird "
-"übersprungen"
-
-#, python-format
-msgid "Unknown status %(stat)s received on pool %(id)s, skipping sample"
-msgstr ""
-"Unbekannten Status %(stat)s erhalten für Pool %(id)s; Beispiel wird "
-"übersprungen"
-
-#, python-format
-msgid "Unknown status %(stat)s received on vip %(id)s, skipping sample"
-msgstr ""
-"Unbekannten Status %(stat)s erhalten für VIP %(id)s; Beispiel wird "
-"übersprungen"
-
-#, python-format
msgid "Unknown status %(stat)s received on vpn %(id)s, skipping sample"
msgstr ""
"Unbekannten Status %(stat)s erhalten für VPN %(id)s; Beispiel wird "
"übersprungen"
#, python-format
-msgid "Unrecognized type value %s"
-msgstr "Nicht erkannter Typwert %s"
-
-#, python-format
msgid "VM %s is poweredOff in VMware vSphere"
msgstr "VM %s ist ausgeschaltet in VMware vSphere"
diff --git a/ceilometer/locale/en_GB/LC_MESSAGES/ceilometer.po b/ceilometer/locale/en_GB/LC_MESSAGES/ceilometer.po
index 7d78d887..983a00a7 100644
--- a/ceilometer/locale/en_GB/LC_MESSAGES/ceilometer.po
+++ b/ceilometer/locale/en_GB/LC_MESSAGES/ceilometer.po
@@ -12,7 +12,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ceilometer VERSION\n"
"Report-Msgid-Bugs-To: https://bugs.launchpad.net/openstack-i18n/\n"
-"POT-Creation-Date: 2021-09-15 14:12+0000\n"
+"POT-Creation-Date: 2022-08-22 19:15+0000\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -89,10 +89,6 @@ msgid "Invalid type %s specified"
msgstr "Invalid type %s specified"
#, python-format
-msgid "Missing field %s"
-msgstr "Missing field %s"
-
-#, python-format
msgid "No plugin named %(plugin)s available for %(name)s"
msgstr "No plugin named %(plugin)s available for %(name)s"
@@ -166,40 +162,14 @@ msgid "Unable to send sample over UDP"
msgstr "Unable to send sample over UDP"
#, python-format
-msgid ""
-"Unknown status %(stat)s received on Load Balancer %(id)s, skipping sample"
-msgstr ""
-"Unknown status %(stat)s received on Load Balancer %(id)s, skipping sample"
-
-#, python-format
msgid "Unknown status %(stat)s received on fw %(id)s,skipping sample"
msgstr "Unknown status %(stat)s received on fw %(id)s,skipping sample"
#, python-format
-msgid "Unknown status %(stat)s received on listener %(id)s, skipping sample"
-msgstr "Unknown status %(stat)s received on listener %(id)s, skipping sample"
-
-#, python-format
-msgid "Unknown status %(stat)s received on member %(id)s, skipping sample"
-msgstr "Unknown status %(stat)s received on member %(id)s, skipping sample"
-
-#, python-format
-msgid "Unknown status %(stat)s received on pool %(id)s, skipping sample"
-msgstr "Unknown status %(stat)s received on pool %(id)s, skipping sample"
-
-#, python-format
-msgid "Unknown status %(stat)s received on vip %(id)s, skipping sample"
-msgstr "Unknown status %(stat)s received on vip %(id)s, skipping sample"
-
-#, python-format
msgid "Unknown status %(stat)s received on vpn %(id)s, skipping sample"
msgstr "Unknown status %(stat)s received on vpn %(id)s, skipping sample"
#, python-format
-msgid "Unrecognized type value %s"
-msgstr "Unrecognised type value %s"
-
-#, python-format
msgid "VM %s is poweredOff in VMware vSphere"
msgstr "VM %s is poweredOff in VMware vSphere"
diff --git a/ceilometer/locale/es/LC_MESSAGES/ceilometer.po b/ceilometer/locale/es/LC_MESSAGES/ceilometer.po
index feea6a1d..0848d853 100644
--- a/ceilometer/locale/es/LC_MESSAGES/ceilometer.po
+++ b/ceilometer/locale/es/LC_MESSAGES/ceilometer.po
@@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ceilometer VERSION\n"
"Report-Msgid-Bugs-To: https://bugs.launchpad.net/openstack-i18n/\n"
-"POT-Creation-Date: 2021-09-15 14:12+0000\n"
+"POT-Creation-Date: 2022-08-22 19:15+0000\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -126,43 +126,12 @@ msgid "Unable to send sample over UDP"
msgstr "No se ha podido enviar una muestra sobre UDP"
#, python-format
-msgid ""
-"Unknown status %(stat)s received on Load Balancer %(id)s, skipping sample"
-msgstr ""
-"Se ha recibido un estado desconocido %(stat)s en el equilibrador de carga "
-"%(id)s, se omitirá el ejemplo"
-
-#, python-format
msgid "Unknown status %(stat)s received on fw %(id)s,skipping sample"
msgstr ""
"Se ha recibido un estado desconocido %(stat)s en fw %(id)s, se omitirá el "
"ejemplo"
#, python-format
-msgid "Unknown status %(stat)s received on listener %(id)s, skipping sample"
-msgstr ""
-"Se ha recibido un estado desconocido %(stat)s en el escucha %(id)s, se "
-"omitirá el ejemplo"
-
-#, python-format
-msgid "Unknown status %(stat)s received on member %(id)s, skipping sample"
-msgstr ""
-"Se ha recibido un estado desconocido %(stat)s en el miembro %(id)s, se "
-"omitirá el ejemplo"
-
-#, python-format
-msgid "Unknown status %(stat)s received on pool %(id)s, skipping sample"
-msgstr ""
-"Se ha recibido un estado desconocido %(stat)s en la agrupación %(id)s, se "
-"omitirá el ejemplo"
-
-#, python-format
-msgid "Unknown status %(stat)s received on vip %(id)s, skipping sample"
-msgstr ""
-"Se ha recibido un estado desconocido %(stat)s en vip %(id)s, se omitirá el "
-"ejemplo"
-
-#, python-format
msgid "Unknown status %(stat)s received on vpn %(id)s, skipping sample"
msgstr ""
"Se ha recibido un estado desconocido %(stat)s en vpn %(id)s, se omitirá el "
diff --git a/ceilometer/locale/fr/LC_MESSAGES/ceilometer.po b/ceilometer/locale/fr/LC_MESSAGES/ceilometer.po
index 21bbcf91..d60101aa 100644
--- a/ceilometer/locale/fr/LC_MESSAGES/ceilometer.po
+++ b/ceilometer/locale/fr/LC_MESSAGES/ceilometer.po
@@ -26,7 +26,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ceilometer VERSION\n"
"Report-Msgid-Bugs-To: https://bugs.launchpad.net/openstack-i18n/\n"
-"POT-Creation-Date: 2021-09-15 14:12+0000\n"
+"POT-Creation-Date: 2022-08-22 19:15+0000\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -141,33 +141,10 @@ msgid "Unable to send sample over UDP"
msgstr "Impossible d'envoyer l'échantillon en UDP"
#, python-format
-msgid ""
-"Unknown status %(stat)s received on Load Balancer %(id)s, skipping sample"
-msgstr ""
-"Statut %(stat)s inconnu reçu sur le Load Balancer %(id)s, échantillon ignoré"
-
-#, python-format
msgid "Unknown status %(stat)s received on fw %(id)s,skipping sample"
msgstr "Etat %(stat)s inconnu reçu sur le pare-feu %(id)s, échantillon ignoré"
#, python-format
-msgid "Unknown status %(stat)s received on listener %(id)s, skipping sample"
-msgstr "Etat %(stat)s inconnu reçu sur le listener %(id)s, échantillon ignoré"
-
-#, python-format
-msgid "Unknown status %(stat)s received on member %(id)s, skipping sample"
-msgstr "Etat %(stat)s inconnu reçu sur le membre %(id)s, échantillon ignoré"
-
-#, python-format
-msgid "Unknown status %(stat)s received on pool %(id)s, skipping sample"
-msgstr "Etat %(stat)s inconnu reçu sur le pool %(id)s, échantillon ignoré"
-
-#, python-format
-msgid "Unknown status %(stat)s received on vip %(id)s, skipping sample"
-msgstr ""
-"Etat %(stat)s inconnu reçu sur l'IP virtuelle %(id)s, échantillon ignoré"
-
-#, python-format
msgid "Unknown status %(stat)s received on vpn %(id)s, skipping sample"
msgstr "Etat %(stat)s inconnu reçu sur le vpn %(id)s, échantillon ignoré"
diff --git a/ceilometer/locale/it/LC_MESSAGES/ceilometer.po b/ceilometer/locale/it/LC_MESSAGES/ceilometer.po
index 315ba148..a5267ffc 100644
--- a/ceilometer/locale/it/LC_MESSAGES/ceilometer.po
+++ b/ceilometer/locale/it/LC_MESSAGES/ceilometer.po
@@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ceilometer VERSION\n"
"Report-Msgid-Bugs-To: https://bugs.launchpad.net/openstack-i18n/\n"
-"POT-Creation-Date: 2021-09-15 14:12+0000\n"
+"POT-Creation-Date: 2022-08-22 19:15+0000\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -125,37 +125,10 @@ msgid "Unable to send sample over UDP"
msgstr "Impossibile inviare l'esempio su UDP"
#, python-format
-msgid ""
-"Unknown status %(stat)s received on Load Balancer %(id)s, skipping sample"
-msgstr ""
-"Stato non conosciuto %(stat)s ricevuto su bilanciatore del carico %(id)s, "
-"ignorare l'esempio"
-
-#, python-format
msgid "Unknown status %(stat)s received on fw %(id)s,skipping sample"
msgstr "Stato non conosciuto %(stat)s ricevuto su fw %(id)s,ignorare l'esempio"
#, python-format
-msgid "Unknown status %(stat)s received on listener %(id)s, skipping sample"
-msgstr ""
-"Stato non conosciuto %(stat)s ricevuto su listener %(id)s, ignorare l'esempio"
-
-#, python-format
-msgid "Unknown status %(stat)s received on member %(id)s, skipping sample"
-msgstr ""
-"Stato non conosciuto %(stat)s ricevuto su membro %(id)s, ignorare l'esempio"
-
-#, python-format
-msgid "Unknown status %(stat)s received on pool %(id)s, skipping sample"
-msgstr ""
-"Stato non conosciuto %(stat)s ricevuto sul pool %(id)s, ignorare l'esempio"
-
-#, python-format
-msgid "Unknown status %(stat)s received on vip %(id)s, skipping sample"
-msgstr ""
-"Stato non conosciuto %(stat)s ricevuto su vip %(id)s, ignorare l'esempio"
-
-#, python-format
msgid "Unknown status %(stat)s received on vpn %(id)s, skipping sample"
msgstr ""
"Stato non conosciuto %(stat)s ricevuto su vpn %(id)s, ignorare l'esempio"
diff --git a/ceilometer/locale/ja/LC_MESSAGES/ceilometer.po b/ceilometer/locale/ja/LC_MESSAGES/ceilometer.po
index 1bb73f29..bc7d8d0d 100644
--- a/ceilometer/locale/ja/LC_MESSAGES/ceilometer.po
+++ b/ceilometer/locale/ja/LC_MESSAGES/ceilometer.po
@@ -10,7 +10,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ceilometer VERSION\n"
"Report-Msgid-Bugs-To: https://bugs.launchpad.net/openstack-i18n/\n"
-"POT-Creation-Date: 2021-09-15 14:12+0000\n"
+"POT-Creation-Date: 2022-08-22 19:15+0000\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -123,41 +123,12 @@ msgid "Unable to send sample over UDP"
msgstr "UDP 経由でサンプルを送信できません"
#, python-format
-msgid ""
-"Unknown status %(stat)s received on Load Balancer %(id)s, skipping sample"
-msgstr ""
-"ロードバランサー %(id)s で不明な状態 %(stat)s を受信しました。サンプルをス"
-"キップします"
-
-#, python-format
msgid "Unknown status %(stat)s received on fw %(id)s,skipping sample"
msgstr ""
"ファイアウォール %(id)s で不明な状態 %(stat)s を受信しました。サンプルをス"
"キップします"
#, python-format
-msgid "Unknown status %(stat)s received on listener %(id)s, skipping sample"
-msgstr ""
-"リスナー %(id)s で不明な状態 %(stat)s を受信しました。サンプルをスキップしま"
-"す"
-
-#, python-format
-msgid "Unknown status %(stat)s received on member %(id)s, skipping sample"
-msgstr ""
-"メンバー %(id)s で不明な状態 %(stat)s を受信しました。サンプルをスキップしま"
-"す"
-
-#, python-format
-msgid "Unknown status %(stat)s received on pool %(id)s, skipping sample"
-msgstr ""
-"プール %(id)s で不明な状態 %(stat)s を受信しました。サンプルをスキップします"
-
-#, python-format
-msgid "Unknown status %(stat)s received on vip %(id)s, skipping sample"
-msgstr ""
-"仮想 IP %(id)s で不明な状態 %(stat)s を受信しました。サンプルをスキップします"
-
-#, python-format
msgid "Unknown status %(stat)s received on vpn %(id)s, skipping sample"
msgstr ""
"vpn %(id)s で不明な状態 %(stat)s を受信しました。サンプルをスキップします"
diff --git a/ceilometer/locale/ko_KR/LC_MESSAGES/ceilometer.po b/ceilometer/locale/ko_KR/LC_MESSAGES/ceilometer.po
index c52d66d1..baa7b39e 100644
--- a/ceilometer/locale/ko_KR/LC_MESSAGES/ceilometer.po
+++ b/ceilometer/locale/ko_KR/LC_MESSAGES/ceilometer.po
@@ -14,7 +14,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ceilometer VERSION\n"
"Report-Msgid-Bugs-To: https://bugs.launchpad.net/openstack-i18n/\n"
-"POT-Creation-Date: 2021-09-15 14:12+0000\n"
+"POT-Creation-Date: 2022-08-22 19:15+0000\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -135,44 +135,15 @@ msgid "Unable to send sample over UDP"
msgstr "UDP를 통해 샘플을 전송할 수 없음"
#, python-format
-msgid ""
-"Unknown status %(stat)s received on Load Balancer %(id)s, skipping sample"
-msgstr ""
-"로드 밸런서 %(id)s에서 알 수 없는 상태 %(stat)s이(가) 수신됨. 샘플 건너뛰기"
-
-#, python-format
msgid "Unknown status %(stat)s received on fw %(id)s,skipping sample"
msgstr ""
"fw %(id)s에서 알 수 없는 상태 %(stat)s이(가) 수신됨. 샘플을 건너뛰는 중"
#, python-format
-msgid "Unknown status %(stat)s received on listener %(id)s, skipping sample"
-msgstr "리스너 %(id)s에서 알 수 없는 상태 %(stat)s이(가) 수신됨. 샘플 건너뛰기"
-
-#, python-format
-msgid "Unknown status %(stat)s received on member %(id)s, skipping sample"
-msgstr ""
-"멤버 %(id)s에서 알 수 없는 상태 %(stat)s이(가) 수신됨. 샘플을 건너뛰는 중"
-
-#, python-format
-msgid "Unknown status %(stat)s received on pool %(id)s, skipping sample"
-msgstr ""
-"풀 %(id)s에서 알 수 없는 상태 %(stat)s이(가) 수신됨. 샘플을 건너뛰는 중"
-
-#, python-format
-msgid "Unknown status %(stat)s received on vip %(id)s, skipping sample"
-msgstr ""
-"vip %(id)s에서 알 수 없는 상태 %(stat)s이(가) 수신됨. 샘플을 건너뛰는 중"
-
-#, python-format
msgid "Unknown status %(stat)s received on vpn %(id)s, skipping sample"
msgstr "vpn%(id)s에서 알 수 없는 상태 %(stat)s이(가) 수신됨. 샘플 건너뛰기"
#, python-format
-msgid "Unrecognized type value %s"
-msgstr "인식되지 않은 유형 값 %s"
-
-#, python-format
msgid "VM %s is poweredOff in VMware vSphere"
msgstr "VM %s is poweredOff in VMware vSphere "
diff --git a/ceilometer/locale/pt_BR/LC_MESSAGES/ceilometer.po b/ceilometer/locale/pt_BR/LC_MESSAGES/ceilometer.po
index c631ffee..5a21ca22 100644
--- a/ceilometer/locale/pt_BR/LC_MESSAGES/ceilometer.po
+++ b/ceilometer/locale/pt_BR/LC_MESSAGES/ceilometer.po
@@ -10,7 +10,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ceilometer VERSION\n"
"Report-Msgid-Bugs-To: https://bugs.launchpad.net/openstack-i18n/\n"
-"POT-Creation-Date: 2021-09-15 14:12+0000\n"
+"POT-Creation-Date: 2022-08-22 19:15+0000\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -123,39 +123,12 @@ msgid "Unable to send sample over UDP"
msgstr "Não é possível enviar amostra sobre UDP"
#, python-format
-msgid ""
-"Unknown status %(stat)s received on Load Balancer %(id)s, skipping sample"
-msgstr ""
-"Status desconhecido %(stat)s recebido no Balanceador de Carga %(id)s, "
-"ignorando a amostra"
-
-#, python-format
msgid "Unknown status %(stat)s received on fw %(id)s,skipping sample"
msgstr ""
"Status desconhecido %(stat)s recebido na largura da fonte %(id)s, ignorando "
"a amostra"
#, python-format
-msgid "Unknown status %(stat)s received on listener %(id)s, skipping sample"
-msgstr ""
-"Status desconhecido %(stat)s recebido no listener %(id)s, ignorando a amostra"
-
-#, python-format
-msgid "Unknown status %(stat)s received on member %(id)s, skipping sample"
-msgstr ""
-"Status desconhecido %(stat)s recebido no membro %(id)s, ignorando a amostra"
-
-#, python-format
-msgid "Unknown status %(stat)s received on pool %(id)s, skipping sample"
-msgstr ""
-"Status desconhecido %(stat)s recebido no conjunto %(id)s, ignorando amostras"
-
-#, python-format
-msgid "Unknown status %(stat)s received on vip %(id)s, skipping sample"
-msgstr ""
-"Status desconhecido %(stat)s recebido em vip %(id)s, ignorando a amostra"
-
-#, python-format
msgid "Unknown status %(stat)s received on vpn %(id)s, skipping sample"
msgstr ""
"Status desconhecido %(stat)s recebido recebido no vpn %(id)s, ignorando a "
diff --git a/ceilometer/locale/ru/LC_MESSAGES/ceilometer.po b/ceilometer/locale/ru/LC_MESSAGES/ceilometer.po
index ca955f10..90adfa9b 100644
--- a/ceilometer/locale/ru/LC_MESSAGES/ceilometer.po
+++ b/ceilometer/locale/ru/LC_MESSAGES/ceilometer.po
@@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ceilometer VERSION\n"
"Report-Msgid-Bugs-To: https://bugs.launchpad.net/openstack-i18n/\n"
-"POT-Creation-Date: 2021-09-15 14:12+0000\n"
+"POT-Creation-Date: 2022-08-22 19:15+0000\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -88,10 +88,6 @@ msgid "Invalid type %s specified"
msgstr "Указан недопустимый тип %s"
#, python-format
-msgid "Missing field %s"
-msgstr "Отсутствует поле %s"
-
-#, python-format
msgid "No plugin named %(plugin)s available for %(name)s"
msgstr "Нет доступного модуля %(plugin)s для %(name)s"
@@ -166,49 +162,16 @@ msgid "Unable to send sample over UDP"
msgstr "Не удалось отправить образец по UDP"
#, python-format
-msgid ""
-"Unknown status %(stat)s received on Load Balancer %(id)s, skipping sample"
-msgstr ""
-"В балансировщике нагрузки %(id)s получено неизвестное состояние %(stat)s, "
-"пример пропускается"
-
-#, python-format
msgid "Unknown status %(stat)s received on fw %(id)s,skipping sample"
msgstr ""
"В fw %(id)s получено неизвестное состояние %(stat)s,пример пропускается"
#, python-format
-msgid "Unknown status %(stat)s received on listener %(id)s, skipping sample"
-msgstr ""
-"В обработчике %(id)s получено неизвестное состояние %(stat)s, пример "
-"пропускается"
-
-#, python-format
-msgid "Unknown status %(stat)s received on member %(id)s, skipping sample"
-msgstr ""
-"В участнике %(id)s получено неизвестное состояние %(stat)s, пример "
-"пропускается"
-
-#, python-format
-msgid "Unknown status %(stat)s received on pool %(id)s, skipping sample"
-msgstr ""
-"В пуле %(id)s получено неизвестное состояние %(stat)s,пример пропускается"
-
-#, python-format
-msgid "Unknown status %(stat)s received on vip %(id)s, skipping sample"
-msgstr ""
-"В vip %(id)s получено неизвестное состояние %(stat)s,пример пропускается"
-
-#, python-format
msgid "Unknown status %(stat)s received on vpn %(id)s, skipping sample"
msgstr ""
"В VPN %(id)s получено неизвестное состояние %(stat)s, пример пропускается"
#, python-format
-msgid "Unrecognized type value %s"
-msgstr "Нераспознанный тип значения '%s'"
-
-#, python-format
msgid "VM %s is poweredOff in VMware vSphere"
msgstr "Виртуальная машина %s выключена в VMware vSphere"
diff --git a/ceilometer/locale/zh_CN/LC_MESSAGES/ceilometer.po b/ceilometer/locale/zh_CN/LC_MESSAGES/ceilometer.po
index 3bda8eb7..9e678b6d 100644
--- a/ceilometer/locale/zh_CN/LC_MESSAGES/ceilometer.po
+++ b/ceilometer/locale/zh_CN/LC_MESSAGES/ceilometer.po
@@ -17,7 +17,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ceilometer VERSION\n"
"Report-Msgid-Bugs-To: https://bugs.launchpad.net/openstack-i18n/\n"
-"POT-Creation-Date: 2021-09-15 14:12+0000\n"
+"POT-Creation-Date: 2022-08-22 19:15+0000\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -123,31 +123,10 @@ msgid "Unable to send sample over UDP"
msgstr "无法通过UDP发送采样"
#, python-format
-msgid ""
-"Unknown status %(stat)s received on Load Balancer %(id)s, skipping sample"
-msgstr "在负载均衡器 %(id)s 上接收到未知状态 %(stat)s,正在跳过样本"
-
-#, python-format
msgid "Unknown status %(stat)s received on fw %(id)s,skipping sample"
msgstr "从fw %(id)s收到未知的状态%(stat)s,跳过该采样数据"
#, python-format
-msgid "Unknown status %(stat)s received on listener %(id)s, skipping sample"
-msgstr "在侦听器 %(id)s 上接收到未知状态 %(stat)s,正在跳过样本"
-
-#, python-format
-msgid "Unknown status %(stat)s received on member %(id)s, skipping sample"
-msgstr "在成员 %(id)s 上接收到未知状态 %(stat)s,正在跳过样本"
-
-#, python-format
-msgid "Unknown status %(stat)s received on pool %(id)s, skipping sample"
-msgstr "从pool %(id)s收到未知的状态%(stat)s,跳过该采样数据"
-
-#, python-format
-msgid "Unknown status %(stat)s received on vip %(id)s, skipping sample"
-msgstr "从vip %(id)s收到未知的状态%(stat)s,跳过该采样数据"
-
-#, python-format
msgid "Unknown status %(stat)s received on vpn %(id)s, skipping sample"
msgstr "在 VPN %(id)s 上接收到未知状态 %(stat)s,正在跳过样本"
diff --git a/ceilometer/locale/zh_TW/LC_MESSAGES/ceilometer.po b/ceilometer/locale/zh_TW/LC_MESSAGES/ceilometer.po
index 6a40652f..508afef1 100644
--- a/ceilometer/locale/zh_TW/LC_MESSAGES/ceilometer.po
+++ b/ceilometer/locale/zh_TW/LC_MESSAGES/ceilometer.po
@@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ceilometer VERSION\n"
"Report-Msgid-Bugs-To: https://bugs.launchpad.net/openstack-i18n/\n"
-"POT-Creation-Date: 2021-09-15 14:12+0000\n"
+"POT-Creation-Date: 2022-08-22 19:15+0000\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -114,31 +114,10 @@ msgid "Unable to send sample over UDP"
msgstr "無法透過 UDP 來傳送樣本"
#, python-format
-msgid ""
-"Unknown status %(stat)s received on Load Balancer %(id)s, skipping sample"
-msgstr "在負載平衡器 %(id)s 上接收到不明狀態 %(stat)s,正在跳過範例"
-
-#, python-format
msgid "Unknown status %(stat)s received on fw %(id)s,skipping sample"
msgstr "在防火牆 %(id)s 上接收到不明狀態 %(stat)s,正在跳過範例"
#, python-format
-msgid "Unknown status %(stat)s received on listener %(id)s, skipping sample"
-msgstr "在接聽器 %(id)s 上接收到不明狀態 %(stat)s,正在跳過範例"
-
-#, python-format
-msgid "Unknown status %(stat)s received on member %(id)s, skipping sample"
-msgstr "在成員 %(id)s 上接收到不明狀態 %(stat)s,正在跳過範例"
-
-#, python-format
-msgid "Unknown status %(stat)s received on pool %(id)s, skipping sample"
-msgstr "在儲存區 %(id)s 上接收到不明狀態 %(stat)s,正在跳過範例"
-
-#, python-format
-msgid "Unknown status %(stat)s received on vip %(id)s, skipping sample"
-msgstr "在 VIP %(id)s 上接收到不明狀態 %(stat)s,正在跳過範例"
-
-#, python-format
msgid "Unknown status %(stat)s received on vpn %(id)s, skipping sample"
msgstr "在 VPN %(id)s 上接收到不明狀態 %(stat)s,正在跳過範例"
diff --git a/ceilometer/network/statistics/__init__.py b/ceilometer/network/statistics/__init__.py
index b427b889..3ef8af01 100644
--- a/ceilometer/network/statistics/__init__.py
+++ b/ceilometer/network/statistics/__init__.py
@@ -35,15 +35,18 @@ class _Base(plugin_base.PollsterBase, metaclass=abc.ABCMeta):
# pipeline configuration
return None
- @abc.abstractproperty
+ @property
+ @abc.abstractmethod
def meter_name(self):
"""Return a Meter Name."""
- @abc.abstractproperty
+ @property
+ @abc.abstractmethod
def meter_type(self):
"""Return a Meter Type."""
- @abc.abstractproperty
+ @property
+ @abc.abstractmethod
def meter_unit(self):
"""Return a Meter Unit."""
diff --git a/ceilometer/network/statistics/opendaylight/client.py b/ceilometer/network/statistics/opendaylight/client.py
index da14be2f..ad46fd1c 100644
--- a/ceilometer/network/statistics/opendaylight/client.py
+++ b/ceilometer/network/statistics/opendaylight/client.py
@@ -27,7 +27,8 @@ LOG = log.getLogger(__name__)
class _Base(object, metaclass=abc.ABCMeta):
"""Base class of OpenDaylight REST APIs Clients."""
- @abc.abstractproperty
+ @property
+ @abc.abstractmethod
def base_url(self):
"""Returns base url for each REST API."""
diff --git a/ceilometer/opts.py b/ceilometer/opts.py
index 496de95c..1c7c2d97 100644
--- a/ceilometer/opts.py
+++ b/ceilometer/opts.py
@@ -22,8 +22,6 @@ import ceilometer.compute.virt.inspector
import ceilometer.compute.virt.libvirt.utils
import ceilometer.compute.virt.vmware.inspector
import ceilometer.event.converter
-import ceilometer.hardware.discovery
-import ceilometer.hardware.pollsters.generic
import ceilometer.image.discovery
import ceilometer.ipmi.platform.intel_node_manager
import ceilometer.ipmi.pollsters
@@ -88,9 +86,6 @@ def list_opts():
'single instance of that service is running.')
]),
('event', ceilometer.event.converter.OPTS),
- ('hardware', itertools.chain(
- ceilometer.hardware.discovery.OPTS,
- ceilometer.hardware.pollsters.generic.OPTS)),
('ipmi',
itertools.chain(ceilometer.ipmi.platform.intel_node_manager.OPTS,
ceilometer.ipmi.pollsters.OPTS)),
diff --git a/ceilometer/pipeline/base.py b/ceilometer/pipeline/base.py
index 56100add..2473e487 100644
--- a/ceilometer/pipeline/base.py
+++ b/ceilometer/pipeline/base.py
@@ -275,19 +275,23 @@ class PipelineManager(agent.ConfigManagerBase):
self.pipelines.append(pipe)
unique_names.clear()
- @abc.abstractproperty
+ @property
+ @abc.abstractmethod
def pm_type(self):
"""Pipeline manager type."""
- @abc.abstractproperty
+ @property
+ @abc.abstractmethod
def pm_pipeline(self):
"""Pipeline class"""
- @abc.abstractproperty
+ @property
+ @abc.abstractmethod
def pm_source(self):
"""Pipeline source class"""
- @abc.abstractproperty
+ @property
+ @abc.abstractmethod
def pm_sink(self):
"""Pipeline sink class"""
diff --git a/ceilometer/polling/dynamic_pollster.py b/ceilometer/polling/dynamic_pollster.py
index d7803d32..0030c607 100644
--- a/ceilometer/polling/dynamic_pollster.py
+++ b/ceilometer/polling/dynamic_pollster.py
@@ -1034,6 +1034,9 @@ class NonOpenStackApisSamplesGatherer(PollsterSampleGatherer):
if override_credentials:
credentials = override_credentials
+ if not isinstance(credentials, str):
+ credentials = self.normalize_credentials_to_string(credentials)
+
url = self.get_request_linked_samples_url(kwargs, definitions)
authenticator_module_name = definitions['module']
@@ -1062,6 +1065,17 @@ class NonOpenStackApisSamplesGatherer(PollsterSampleGatherer):
return resp, url
+ @staticmethod
+ def normalize_credentials_to_string(credentials):
+ if isinstance(credentials, bytes):
+ credentials = credentials.decode('utf-8')
+ else:
+ credentials = str(credentials)
+ LOG.debug("Credentials [%s] were not defined as a string. "
+ "Therefore, we converted it to a string like object.",
+ credentials)
+ return credentials
+
def create_request_arguments(self, definitions):
request_arguments = super(
NonOpenStackApisSamplesGatherer, self).create_request_arguments(
diff --git a/ceilometer/polling/manager.py b/ceilometer/polling/manager.py
index 6b9289d1..3545801f 100644
--- a/ceilometer/polling/manager.py
+++ b/ceilometer/polling/manager.py
@@ -35,6 +35,7 @@ from tooz import coordination
from urllib import parse as urlparse
from ceilometer import agent
+from ceilometer import cache_utils
from ceilometer import declarative
from ceilometer import keystone_client
from ceilometer import messaging
@@ -45,6 +46,8 @@ from ceilometer import utils
LOG = log.getLogger(__name__)
+CACHE_DURATION = 3600
+
POLLING_OPTS = [
cfg.StrOpt('cfg_file',
default="polling.yaml",
@@ -64,7 +67,18 @@ POLLING_OPTS = [
cfg.MultiStrOpt('pollsters_definitions_dirs',
default=["/etc/ceilometer/pollsters.d"],
help="List of directories with YAML files used "
- "to created pollsters.")
+ "to created pollsters."),
+ cfg.BoolOpt('tenant_name_discovery',
+ default=False,
+ help="Identify project and user names from polled samples"
+ "By default, collecting these values is disabled due"
+ "to the fact that it could overwhelm keystone service"
+ "with lots of continuous requests depending upon the"
+ "number of projects, users and samples polled from"
+ "the environment. While using this feature, it is"
+ "recommended that ceilometer be configured with a"
+ "caching backend to reduce the number of calls"
+ "made to keystone"),
]
@@ -138,11 +152,39 @@ class PollingTask(object):
self._telemetry_secret = self.manager.conf.publisher.telemetry_secret
+ self.ks_client = self.manager.keystone
+
+ self.cache_client = cache_utils.get_client(
+ self.manager.conf,
+ expiration_time=CACHE_DURATION
+ )
+
def add(self, pollster, source):
self.pollster_matches[source.name].add(pollster)
key = Resources.key(source.name, pollster)
self.resources[key].setup(source)
+ def resolve_uuid_from_cache(self, attr, uuid):
+ if self.cache_client:
+ name = self.cache_client.get(uuid)
+ if name:
+ return name
+ name = self.resolve_uuid_from_keystone(attr, uuid)
+ self.cache_client.set(uuid, name)
+ return name
+
+ # Retrieve project and user names from Keystone only
+ # if ceilometer doesn't have a caching backend
+ return self.resolve_uuid_from_keystone(attr, uuid)
+
+ def resolve_uuid_from_keystone(self, attr, uuid):
+ try:
+ return getattr(self.ks_client, attr).get(uuid).name
+ except AttributeError as e:
+ LOG.warning("Found '%s' while resolving uuid %s to name", e, uuid)
+ except ka_exceptions.NotFound as e:
+ LOG.warning(e.message)
+
def poll_and_notify(self):
"""Polling sample and notify."""
cache = {}
@@ -194,6 +236,25 @@ class PollingTask(object):
for sample in samples:
# Note(yuywz): Unify the timestamp of polled samples
sample.set_timestamp(polling_timestamp)
+
+ if self.manager.conf.tenant_name_discovery:
+
+ # Try to resolve project UUIDs from cache first,
+ # and then keystone
+ if sample.project_id:
+ sample.project_name = \
+ self.resolve_uuid_from_cache(
+ "projects", sample.project_id
+ )
+
+ # Try to resolve user UUIDs from cache first,
+ # and then keystone
+ if sample.user_id:
+ sample.user_name = \
+ self.resolve_uuid_from_cache(
+ "users", sample.user_id
+ )
+
sample_dict = (
publisher_utils.meter_message_from_counter(
sample, self._telemetry_secret
@@ -253,7 +314,8 @@ class AgentManager(cotyledon.Service):
for namespace in namespaces)
# Create dynamic pollsters
- extensions_dynamic_pollsters = self.create_dynamic_pollsters()
+ extensions_dynamic_pollsters = self.create_dynamic_pollsters(
+ namespaces)
self.extensions = list(itertools.chain(*list(extensions))) + list(
itertools.chain(*list(extensions_fb))) + list(
@@ -291,15 +353,18 @@ class AgentManager(cotyledon.Service):
self._keystone = None
self._keystone_last_exception = None
- def create_dynamic_pollsters(self):
+ def create_dynamic_pollsters(self, namespaces):
"""Creates dynamic pollsters
This method Creates dynamic pollsters based on configurations placed on
'pollsters_definitions_dirs'
+ :param namespaces: The namespaces we are running on to validate if
+ the pollster should be instantiated or not.
:return: a list with the dynamic pollsters defined by the operator.
"""
+ namespaces_set = set(namespaces)
pollsters_definitions_dirs = self.conf.pollsters_definitions_dirs
if not pollsters_definitions_dirs:
LOG.info("Variable 'pollsters_definitions_dirs' not defined.")
@@ -333,6 +398,21 @@ class AgentManager(cotyledon.Service):
for pollster_cfg in pollsters_cfg:
pollster_name = pollster_cfg['name']
+ pollster_namespaces = pollster_cfg.get(
+ 'namespaces', ['central'])
+ if isinstance(pollster_namespaces, list):
+ pollster_namespaces = set(pollster_namespaces)
+ else:
+ pollster_namespaces = {pollster_namespaces}
+
+ if not bool(namespaces_set & pollster_namespaces):
+ LOG.info("The pollster [%s] is not configured to run in "
+ "these namespaces %s, the configured namespaces "
+ "for this pollster are %s. Therefore, we are "
+ "skipping it.", pollster_name, namespaces_set,
+ pollster_namespaces)
+ continue
+
if pollster_name not in pollsters_definitions:
LOG.info("Loading dynamic pollster [%s] from file [%s].",
pollster_name, pollsters_definitions_file)
diff --git a/ceilometer/polling/plugin_base.py b/ceilometer/polling/plugin_base.py
index be275614..e75a35a6 100644
--- a/ceilometer/polling/plugin_base.py
+++ b/ceilometer/polling/plugin_base.py
@@ -63,7 +63,8 @@ class PollsterBase(object, metaclass=abc.ABCMeta):
except Exception as err:
raise ExtensionLoadError(err)
- @abc.abstractproperty
+ @property
+ @abc.abstractmethod
def default_discovery(self):
"""Default discovery to use for this pollster.
diff --git a/ceilometer/publisher/data/gnocchi_resources.yaml b/ceilometer/publisher/data/gnocchi_resources.yaml
index 2bf3c729..b9d7eaef 100644
--- a/ceilometer/publisher/data/gnocchi_resources.yaml
+++ b/ceilometer/publisher/data/gnocchi_resources.yaml
@@ -275,61 +275,6 @@ resources:
attributes:
provider: resource_metadata.provider
- - resource_type: host
- metrics:
- hardware.cpu.load.1min:
- hardware.cpu.load.5min:
- hardware.cpu.load.15min:
- hardware.cpu.util:
- hardware.cpu.user:
- archive_policy_name: ceilometer-low-rate
- hardware.cpu.nice:
- archive_policy_name: ceilometer-low-rate
- hardware.cpu.system:
- archive_policy_name: ceilometer-low-rate
- hardware.cpu.idle:
- archive_policy_name: ceilometer-low-rate
- hardware.cpu.wait:
- archive_policy_name: ceilometer-low-rate
- hardware.cpu.kernel:
- archive_policy_name: ceilometer-low-rate
- hardware.cpu.interrupt:
- archive_policy_name: ceilometer-low-rate
- hardware.memory.total:
- hardware.memory.used:
- hardware.memory.swap.total:
- hardware.memory.swap.avail:
- hardware.memory.buffer:
- hardware.memory.cached:
- hardware.network.ip.outgoing.datagrams:
- hardware.network.ip.incoming.datagrams:
- hardware.system_stats.cpu.idle:
- hardware.system_stats.io.outgoing.blocks:
- hardware.system_stats.io.incoming.blocks:
- attributes:
- host_name: resource_metadata.resource_url
-
- - resource_type: host_disk
- metrics:
- hardware.disk.size.total:
- hardware.disk.size.used:
- hardware.disk.read.bytes:
- hardware.disk.write.bytes:
- hardware.disk.read.requests:
- hardware.disk.write.requests:
- attributes:
- host_name: resource_metadata.resource_url
- device_name: resource_metadata.device
-
- - resource_type: host_network_interface
- metrics:
- hardware.network.incoming.bytes:
- hardware.network.outgoing.bytes:
- hardware.network.outgoing.errors:
- attributes:
- host_name: resource_metadata.resource_url
- device_name: resource_metadata.name
-
- resource_type: nova_compute
metrics:
compute.node.cpu.frequency:
diff --git a/ceilometer/publisher/gnocchi.py b/ceilometer/publisher/gnocchi.py
index 19d7d54b..27e499f5 100644
--- a/ceilometer/publisher/gnocchi.py
+++ b/ceilometer/publisher/gnocchi.py
@@ -24,6 +24,7 @@ import uuid
from gnocchiclient import exceptions as gnocchi_exc
from keystoneauth1 import exceptions as ka_exceptions
+import oslo_cache
from oslo_log import log
from oslo_utils import timeutils
from stevedore import extension
@@ -214,7 +215,6 @@ class GnocchiPublisher(publisher.ConfigPublisherBase):
self.cache = None
try:
- import oslo_cache
oslo_cache.configure(conf)
# NOTE(cdent): The default cache backend is a real but
# noop backend. We don't want to use that here because
@@ -225,8 +225,6 @@ class GnocchiPublisher(publisher.ConfigPublisherBase):
self.cache = oslo_cache.configure_cache_region(
conf, cache_region)
self.cache.key_mangler = cache_key_mangler
- except ImportError:
- pass
except oslo_cache.exception.ConfigurationError as exc:
LOG.warning('unable to configure oslo_cache: %s', exc)
diff --git a/ceilometer/publisher/utils.py b/ceilometer/publisher/utils.py
index 75df2b70..0d1e7be0 100644
--- a/ceilometer/publisher/utils.py
+++ b/ceilometer/publisher/utils.py
@@ -126,7 +126,9 @@ def meter_message_from_counter(sample, secret):
'counter_unit': sample.unit,
'counter_volume': sample.volume,
'user_id': sample.user_id,
+ 'user_name': sample.user_name,
'project_id': sample.project_id,
+ 'project_name': sample.project_name,
'resource_id': sample.resource_id,
'timestamp': sample.timestamp,
'resource_metadata': sample.resource_metadata,
diff --git a/ceilometer/sample.py b/ceilometer/sample.py
index c86caa35..536b561d 100644
--- a/ceilometer/sample.py
+++ b/ceilometer/sample.py
@@ -94,13 +94,16 @@ class Sample(object):
def __init__(self, name, type, unit, volume, user_id, project_id,
resource_id, timestamp=None, resource_metadata=None,
- source=None, id=None, monotonic_time=None):
+ source=None, id=None, monotonic_time=None,
+ user_name=None, project_name=None):
self.name = name
self.type = type
self.unit = unit
self.volume = volume
self.user_id = user_id
+ self.user_name = user_name
self.project_id = project_id
+ self.project_name = project_name
self.resource_id = resource_id
self.timestamp = timestamp
self.resource_metadata = resource_metadata or {}
diff --git a/ceilometer/tests/unit/event/test_endpoint.py b/ceilometer/tests/unit/event/test_endpoint.py
index 05583950..6011d456 100644
--- a/ceilometer/tests/unit/event/test_endpoint.py
+++ b/ceilometer/tests/unit/event/test_endpoint.py
@@ -28,54 +28,54 @@ from ceilometer.tests import base as tests_base
TEST_NOTICE_CTXT = {
- u'auth_token': u'3d8b13de1b7d499587dfc69b77dc09c2',
- u'is_admin': True,
- u'project_id': u'7c150a59fe714e6f9263774af9688f0e',
- u'quota_class': None,
- u'read_deleted': u'no',
- u'remote_address': u'10.0.2.15',
- u'request_id': u'req-d68b36e0-9233-467f-9afb-d81435d64d66',
- u'roles': [u'admin'],
- u'timestamp': u'2012-05-08T20:23:41.425105',
- u'user_id': u'1e3ce043029547f1a61c1996d1a531a2',
+ 'auth_token': '3d8b13de1b7d499587dfc69b77dc09c2',
+ 'is_admin': True,
+ 'project_id': '7c150a59fe714e6f9263774af9688f0e',
+ 'quota_class': None,
+ 'read_deleted': 'no',
+ 'remote_address': '10.0.2.15',
+ 'request_id': 'req-d68b36e0-9233-467f-9afb-d81435d64d66',
+ 'roles': ['admin'],
+ 'timestamp': '2012-05-08T20:23:41.425105',
+ 'user_id': '1e3ce043029547f1a61c1996d1a531a2',
}
TEST_NOTICE_METADATA = {
- u'message_id': u'dae6f69c-00e0-41c0-b371-41ec3b7f4451',
- u'timestamp': u'2012-05-08 20:23:48.028195',
+ 'message_id': 'dae6f69c-00e0-41c0-b371-41ec3b7f4451',
+ 'timestamp': '2012-05-08 20:23:48.028195',
}
TEST_NOTICE_PAYLOAD = {
- u'created_at': u'2012-05-08 20:23:41',
- u'deleted_at': u'',
- u'disk_gb': 0,
- u'display_name': u'testme',
- u'fixed_ips': [{u'address': u'10.0.0.2',
- u'floating_ips': [],
- u'meta': {},
- u'type': u'fixed',
- u'version': 4}],
- u'image_ref_url': u'http://10.0.2.15:9292/images/UUID',
- u'instance_id': u'9f9d01b9-4a58-4271-9e27-398b21ab20d1',
- u'instance_type': u'm1.tiny',
- u'instance_type_id': 2,
- u'launched_at': u'2012-05-08 20:23:47.985999',
- u'memory_mb': 512,
- u'state': u'active',
- u'state_description': u'',
- u'tenant_id': u'7c150a59fe714e6f9263774af9688f0e',
- u'user_id': u'1e3ce043029547f1a61c1996d1a531a2',
- u'reservation_id': u'1e3ce043029547f1a61c1996d1a531a3',
- u'vcpus': 1,
- u'root_gb': 0,
- u'ephemeral_gb': 0,
- u'host': u'compute-host-name',
- u'availability_zone': u'1e3ce043029547f1a61c1996d1a531a4',
- u'os_type': u'linux?',
- u'architecture': u'x86',
- u'image_ref': u'UUID',
- u'kernel_id': u'1e3ce043029547f1a61c1996d1a531a5',
- u'ramdisk_id': u'1e3ce043029547f1a61c1996d1a531a6',
+ 'created_at': '2012-05-08 20:23:41',
+ 'deleted_at': '',
+ 'disk_gb': 0,
+ 'display_name': 'testme',
+ 'fixed_ips': [{'address': '10.0.0.2',
+ 'floating_ips': [],
+ 'meta': {},
+ 'type': 'fixed',
+ 'version': 4}],
+ 'image_ref_url': 'http://10.0.2.15:9292/images/UUID',
+ 'instance_id': '9f9d01b9-4a58-4271-9e27-398b21ab20d1',
+ 'instance_type': 'm1.tiny',
+ 'instance_type_id': 2,
+ 'launched_at': '2012-05-08 20:23:47.985999',
+ 'memory_mb': 512,
+ 'state': 'active',
+ 'state_description': '',
+ 'tenant_id': '7c150a59fe714e6f9263774af9688f0e',
+ 'user_id': '1e3ce043029547f1a61c1996d1a531a2',
+ 'reservation_id': '1e3ce043029547f1a61c1996d1a531a3',
+ 'vcpus': 1,
+ 'root_gb': 0,
+ 'ephemeral_gb': 0,
+ 'host': 'compute-host-name',
+ 'availability_zone': '1e3ce043029547f1a61c1996d1a531a4',
+ 'os_type': 'linux?',
+ 'architecture': 'x86',
+ 'image_ref': 'UUID',
+ 'kernel_id': '1e3ce043029547f1a61c1996d1a531a5',
+ 'ramdisk_id': '1e3ce043029547f1a61c1996d1a531a6',
}
diff --git a/ceilometer/tests/unit/hardware/__init__.py b/ceilometer/tests/unit/hardware/__init__.py
deleted file mode 100644
index e69de29b..00000000
--- a/ceilometer/tests/unit/hardware/__init__.py
+++ /dev/null
diff --git a/ceilometer/tests/unit/hardware/inspector/__init__.py b/ceilometer/tests/unit/hardware/inspector/__init__.py
deleted file mode 100644
index e69de29b..00000000
--- a/ceilometer/tests/unit/hardware/inspector/__init__.py
+++ /dev/null
diff --git a/ceilometer/tests/unit/hardware/inspector/test_inspector.py b/ceilometer/tests/unit/hardware/inspector/test_inspector.py
deleted file mode 100644
index 931154b9..00000000
--- a/ceilometer/tests/unit/hardware/inspector/test_inspector.py
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# Copyright 2014 Intel Corp
-#
-# 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_utils import netutils
-
-from ceilometer.hardware import inspector
-from ceilometer.tests import base
-
-
-class TestHardwareInspector(base.BaseTestCase):
- def test_get_inspector(self):
- url = netutils.urlsplit("snmp://")
- driver = inspector.get_inspector(url)
- self.assertTrue(driver)
-
- def test_get_inspector_illegal(self):
- url = netutils.urlsplit("illegal://")
- self.assertRaises(RuntimeError,
- inspector.get_inspector,
- url)
diff --git a/ceilometer/tests/unit/hardware/inspector/test_snmp.py b/ceilometer/tests/unit/hardware/inspector/test_snmp.py
deleted file mode 100644
index 37447ecc..00000000
--- a/ceilometer/tests/unit/hardware/inspector/test_snmp.py
+++ /dev/null
@@ -1,271 +0,0 @@
-#
-# Copyright 2013 Intel Corp
-#
-# 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.
-"""Tests for ceilometer/hardware/inspector/snmp/inspector.py"""
-from unittest import mock
-
-import fixtures
-from oslo_utils import netutils
-from pysnmp.proto import rfc1905
-
-from ceilometer.hardware.inspector import snmp
-from ceilometer.tests import base as test_base
-
-ins = snmp.SNMPInspector
-
-
-class FakeObjectName(object):
- def __init__(self, name):
- self.name = name
-
- def __str__(self):
- return str(self.name)
-
-
-class FakeCommandGenerator(object):
- def getCmd(self, authData, transportTarget, *oids, **kwargs):
- emptyOIDs = {
- '1.3.6.1.4.1.2021.4.14.0': rfc1905.noSuchObject,
- '1.3.6.1.4.1.2021.4.14.1': rfc1905.noSuchInstance,
- }
- varBinds = [
- (FakeObjectName(oid), int(oid.split('.')[-1]))
- for oid in oids
- if oid not in emptyOIDs
- ]
- for emptyOID, exc in emptyOIDs.items():
- if emptyOID in oids:
- varBinds += [(FakeObjectName(emptyOID), exc)]
- return (None, None, 0, varBinds)
-
- def bulkCmd(authData, transportTarget, nonRepeaters, maxRepetitions,
- *oids, **kwargs):
- varBindTable = [
- [(FakeObjectName("%s.%d" % (oid, i)), i) for i in range(1, 3)]
- for oid in oids
- ]
- return (None, None, 0, varBindTable)
-
-
-class TestSNMPInspector(test_base.BaseTestCase):
- mapping = {
- 'test_exact': {
- 'matching_type': snmp.EXACT,
- 'metric_oid': ('1.3.6.1.4.1.2021.10.1.3.1', int),
- 'metadata': {
- 'meta': ('1.3.6.1.4.1.2021.10.1.3.8', int)
- },
- 'post_op': '_fake_post_op',
- },
- 'test_prefix': {
- 'matching_type': snmp.PREFIX,
- 'metric_oid': ('1.3.6.1.4.1.2021.9.1.8', int),
- 'metadata': {
- 'meta': ('1.3.6.1.4.1.2021.9.1.3', int)
- },
- 'post_op': None,
- },
- 'test_nosuch': {
- 'matching_type': snmp.EXACT,
- 'metric_oid': ('1.3.6.1.4.1.2021.4.14.0', int),
- 'metadata': {},
- 'post_op': None,
- },
- 'test_nosuch_instance': {
- 'matching_type': snmp.EXACT,
- 'metric_oid': ('1.3.6.1.4.1.2021.4.14.1', int),
- 'metadata': {},
- 'post_op': None,
- },
-
- }
-
- def setUp(self):
- super(TestSNMPInspector, self).setUp()
- self.inspector = snmp.SNMPInspector()
- self.host = netutils.urlsplit("snmp://localhost")
- self.useFixture(fixtures.MockPatchObject(
- snmp.cmdgen, 'CommandGenerator',
- return_value=FakeCommandGenerator()))
-
- def test_snmp_error(self):
- def get_list(func, *args, **kwargs):
- return list(func(*args, **kwargs))
-
- def faux_parse(ret, is_bulk):
- return (True, 'forced error')
-
- self.useFixture(fixtures.MockPatchObject(
- snmp, 'parse_snmp_return', new=faux_parse))
-
- self.assertRaises(snmp.SNMPException,
- get_list,
- self.inspector.inspect_generic,
- host=self.host,
- cache={},
- extra_metadata={},
- param=self.mapping['test_exact'])
-
- @staticmethod
- def _fake_post_op(host, cache, meter_def, value, metadata, extra, suffix):
- metadata.update(post_op_meta=4)
- extra.update(project_id=2)
- return value
-
- def test_inspect_no_such_object(self):
- cache = {}
- try:
- # inspect_generic() is a generator, so we explicitly need to
- # iterate through it in order to trigger the exception.
- list(self.inspector.inspect_generic(self.host,
- cache,
- {},
- self.mapping['test_nosuch']))
- except ValueError:
- self.fail("got ValueError when interpreting NoSuchObject return")
-
- def test_inspect_no_such_instance(self):
- cache = {}
- try:
- # inspect_generic() is a generator, so we explicitly need to
- # iterate through it in order to trigger the exception.
- list(self.inspector.inspect_generic(self.host,
- cache,
- {},
- self.mapping['test_nosuch']))
- except ValueError:
- self.fail("got ValueError when interpreting NoSuchInstance return")
-
- def test_inspect_generic_exact(self):
- self.inspector._fake_post_op = self._fake_post_op
- cache = {}
- ret = list(self.inspector.inspect_generic(self.host,
- cache,
- {},
- self.mapping['test_exact']))
- keys = cache[ins._CACHE_KEY_OID].keys()
- self.assertIn('1.3.6.1.4.1.2021.10.1.3.1', keys)
- self.assertIn('1.3.6.1.4.1.2021.10.1.3.8', keys)
- self.assertEqual(1, len(ret))
- self.assertEqual(1, ret[0][0])
- self.assertEqual(8, ret[0][1]['meta'])
- self.assertEqual(4, ret[0][1]['post_op_meta'])
- self.assertEqual(2, ret[0][2]['project_id'])
-
- def test_inspect_generic_prefix(self):
- cache = {}
- ret = list(self.inspector.inspect_generic(self.host,
- cache,
- {},
- self.mapping['test_prefix']))
- keys = cache[ins._CACHE_KEY_OID].keys()
- self.assertIn('1.3.6.1.4.1.2021.9.1.8' + '.1', keys)
- self.assertIn('1.3.6.1.4.1.2021.9.1.8' + '.2', keys)
- self.assertIn('1.3.6.1.4.1.2021.9.1.3' + '.1', keys)
- self.assertIn('1.3.6.1.4.1.2021.9.1.3' + '.2', keys)
- self.assertEqual(2, len(ret))
- self.assertIn(ret[0][0], (1, 2))
- self.assertEqual(ret[0][0], ret[0][1]['meta'])
-
- def test_post_op_net(self):
- cache = {}
- metadata = dict(name='lo',
- speed=0,
- mac='ba21e43302fe')
- extra = {}
- ret = self.inspector._post_op_net(self.host, cache, None,
- value=8,
- metadata=metadata,
- extra=extra,
- suffix=".2")
- self.assertEqual(8, ret)
- self.assertIn('ip', metadata)
- self.assertIn("2", metadata['ip'])
- self.assertIn('resource_id', extra)
- self.assertEqual("localhost.lo", extra['resource_id'])
-
- def test_post_op_disk(self):
- cache = {}
- metadata = dict(device='/dev/sda1',
- path='/')
- extra = {}
- ret = self.inspector._post_op_disk(self.host, cache, None,
- value=8,
- metadata=metadata,
- extra=extra,
- suffix=None)
- self.assertEqual(8, ret)
- self.assertIn('resource_id', extra)
- self.assertEqual("localhost./dev/sda1", extra['resource_id'])
-
- def test_prepare_params(self):
- param = {'post_op': '_post_op_disk',
- 'oid': '1.3.6.1.4.1.2021.9.1.6',
- 'type': 'int',
- 'matching_type': 'type_prefix',
- 'metadata': {
- 'device': {'oid': '1.3.6.1.4.1.2021.9.1.3',
- 'type': 'str'},
- 'path': {'oid': '1.3.6.1.4.1.2021.9.1.2',
- 'type': "lambda x: str(x)"}}}
- processed = self.inspector.prepare_params(param)
- self.assertEqual('_post_op_disk', processed['post_op'])
- self.assertEqual('1.3.6.1.4.1.2021.9.1.6', processed['metric_oid'][0])
- self.assertEqual(int, processed['metric_oid'][1])
- self.assertEqual(snmp.PREFIX, processed['matching_type'])
- self.assertEqual(2, len(processed['metadata'].keys()))
- self.assertEqual('1.3.6.1.4.1.2021.9.1.2',
- processed['metadata']['path'][0])
- self.assertEqual("4",
- processed['metadata']['path'][1](4))
-
- def test_pysnmp_ver43(self):
- # Test pysnmp version >=4.3 compatibility of ObjectIdentifier
- from distutils import version
- import pysnmp
-
- has43 = (version.StrictVersion(pysnmp.__version__) >=
- version.StrictVersion('4.3.0'))
- oid = '1.3.6.4.1.2021.11.57.0'
-
- if has43:
- from pysnmp.entity import engine
- from pysnmp.smi import rfc1902
- from pysnmp.smi import view
- snmp_engine = engine.SnmpEngine()
- mvc = view.MibViewController(snmp_engine.getMibBuilder())
- name = rfc1902.ObjectIdentity(oid)
- name.resolveWithMib(mvc)
- else:
- from pysnmp.proto import rfc1902
- name = rfc1902.ObjectName(oid)
-
- self.assertEqual(oid, str(name))
-
- @mock.patch.object(snmp.cmdgen, 'UsmUserData')
- def test_auth_strategy(self, mock_method):
- host = ''.join(['snmp://a:b@foo?auth_proto=sha',
- '&priv_password=pass&priv_proto=aes256'])
- host = netutils.urlsplit(host)
- self.inspector._get_auth_strategy(host)
- mock_method.assert_called_with(
- 'a', authKey='b',
- authProtocol=snmp.cmdgen.usmHMACSHAAuthProtocol,
- privProtocol=snmp.cmdgen.usmAesCfb256Protocol,
- privKey='pass')
-
- host2 = 'snmp://a:b@foo?&priv_password=pass'
- host2 = netutils.urlsplit(host2)
- self.inspector._get_auth_strategy(host2)
- mock_method.assert_called_with('a', authKey='b', privKey='pass')
diff --git a/ceilometer/tests/unit/hardware/pollsters/__init__.py b/ceilometer/tests/unit/hardware/pollsters/__init__.py
deleted file mode 100644
index e69de29b..00000000
--- a/ceilometer/tests/unit/hardware/pollsters/__init__.py
+++ /dev/null
diff --git a/ceilometer/tests/unit/hardware/pollsters/test_generic.py b/ceilometer/tests/unit/hardware/pollsters/test_generic.py
deleted file mode 100644
index 99ac2bfb..00000000
--- a/ceilometer/tests/unit/hardware/pollsters/test_generic.py
+++ /dev/null
@@ -1,193 +0,0 @@
-#
-# Copyright 2015 Intel Corp.
-#
-# 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 unittest import mock
-
-import fixtures
-from oslo_utils import fileutils
-import yaml
-
-from ceilometer import declarative
-from ceilometer.hardware.inspector import base as inspector_base
-from ceilometer.hardware.pollsters import generic
-from ceilometer import sample
-from ceilometer import service
-from ceilometer.tests import base as test_base
-
-
-class TestMeterDefinition(test_base.BaseTestCase):
- def test_config_definition(self):
- cfg = dict(name='test',
- type='gauge',
- unit='B',
- snmp_inspector={})
- definition = generic.MeterDefinition(cfg)
- self.assertEqual('test', definition.name)
- self.assertEqual('gauge', definition.type)
- self.assertEqual('B', definition.unit)
- self.assertEqual({}, definition.snmp_inspector)
-
- def test_config_missing_field(self):
- cfg = dict(name='test', type='gauge')
- try:
- generic.MeterDefinition(cfg)
- except declarative.MeterDefinitionException as e:
- self.assertEqual("Missing field unit", e.brief_message)
-
- def test_config_invalid_field(self):
- cfg = dict(name='test',
- type='gauge',
- unit='B',
- invalid={})
- definition = generic.MeterDefinition(cfg)
- self.assertEqual("foobar", getattr(definition, 'invalid', 'foobar'))
-
- def test_config_invalid_type_field(self):
- cfg = dict(name='test',
- type='invalid',
- unit='B',
- snmp_inspector={})
- try:
- generic.MeterDefinition(cfg)
- except declarative.MeterDefinitionException as e:
- self.assertEqual("Unrecognized type value invalid",
- e.brief_message)
-
- def test_config_missing_unit_field(self):
- cfg = dict(name='hardware.cpu.user',
- snmp_inspector={"matching_type": "type_exact",
- "oid": "1.3.6.1.4.1.2021.11.50.0",
- "type": "int"})
- try:
- generic.MeterDefinition(cfg)
- except declarative.MeterDefinitionException as e:
- self.assertEqual("Missing field unit",
- e.brief_message)
-
- @mock.patch('ceilometer.hardware.pollsters.generic.LOG')
- def test_bad_metric_skip(self, LOG):
- cfg = {'metric': [dict(name='test1',
- type='gauge',
- unit='B',
- snmp_inspector={}),
- dict(name='test_bad',
- type='invalid',
- unit='B',
- snmp_inspector={}),
- dict(name='test2',
- type='gauge',
- unit='B',
- snmp_inspector={})]}
- data = generic.load_definition(cfg)
- self.assertEqual(2, len(data))
- LOG.error.assert_called_with(
- "Error loading meter definition: %s",
- "Unrecognized type value invalid")
-
-
-class FakeInspector(inspector_base.Inspector):
- net_metadata = dict(name='test.teest',
- mac='001122334455',
- ip='10.0.0.2',
- speed=1000)
- DATA = {
- 'test': (0.99, {}, {}),
- 'test2': (90, net_metadata, {}),
- }
-
- def inspect_generic(self, host, cache,
- extra_metadata=None, param=None):
- yield self.DATA[host.hostname]
-
-
-class TestGenericPollsters(test_base.BaseTestCase):
- @staticmethod
- def faux_get_inspector(url, namespace=None):
- return FakeInspector()
-
- def setUp(self):
- super(TestGenericPollsters, self).setUp()
- self.conf = service.prepare_service([], [])
- self.resources = ["snmp://test", "snmp://test2"]
- self.useFixture(fixtures.MockPatch(
- 'ceilometer.hardware.inspector.get_inspector',
- self.faux_get_inspector))
- self.pollster = generic.GenericHardwareDeclarativePollster(self.conf)
-
- def _setup_meter_def_file(self, cfg):
- cfg = cfg.encode('utf-8')
- meter_cfg_file = fileutils.write_to_tempfile(content=cfg,
- prefix="snmp",
- suffix="yaml")
- self.conf.set_override(
- 'meter_definitions_file',
- meter_cfg_file, group='hardware')
- cfg = declarative.load_definitions(
- self.conf, {}, self.conf.hardware.meter_definitions_file)
- return cfg
-
- def _check_get_samples(self, name, definition,
- expected_value, expected_type, expected_unit=None):
- self.pollster._update_meter_definition(definition)
- cache = {}
- samples = list(self.pollster.get_samples(None, cache,
- self.resources))
- self.assertTrue(samples)
- self.assertIn(self.pollster.CACHE_KEY, cache)
- for resource in self.resources:
- self.assertIn(resource, cache[self.pollster.CACHE_KEY])
-
- self.assertEqual(set([name]),
- set([s.name for s in samples]))
- match = [s for s in samples if s.name == name]
- self.assertEqual(expected_value, match[0].volume)
- self.assertEqual(expected_type, match[0].type)
- if expected_unit:
- self.assertEqual(expected_unit, match[0].unit)
-
- def test_get_samples(self):
- param = dict(matching_type='type_exact',
- oid='1.3.6.1.4.1.2021.10.1.3.1',
- type='lambda x: float(str(x))')
- meter_def = generic.MeterDefinition(dict(type='gauge',
- name='hardware.test1',
- unit='process',
- snmp_inspector=param))
- self._check_get_samples('hardware.test1',
- meter_def,
- 0.99, sample.TYPE_GAUGE,
- expected_unit='process')
-
- def test_get_pollsters_extensions(self):
- param = dict(matching_type='type_exact',
- oid='1.3.6.1.4.1.2021.10.1.3.1',
- type='lambda x: float(str(x))')
- meter_cfg = yaml.dump(
- {'metric': [dict(type='gauge',
- name='hardware.test1',
- unit='process',
- snmp_inspector=param),
- dict(type='gauge',
- name='hardware.test2.abc',
- unit='process',
- snmp_inspector=param)]})
- self._setup_meter_def_file(meter_cfg)
- pollster = generic.GenericHardwareDeclarativePollster
- # Clear cached mapping
- pollster.mapping = None
- exts = pollster.get_pollsters_extensions(self.conf)
- self.assertEqual(2, len(exts))
- self.assertIn(exts[0].name, ['hardware.test1', 'hardware.test2.abc'])
- self.assertIn(exts[1].name, ['hardware.test1', 'hardware.test2.abc'])
diff --git a/ceilometer/tests/unit/hardware/pollsters/test_util.py b/ceilometer/tests/unit/hardware/pollsters/test_util.py
deleted file mode 100644
index 5a3f9694..00000000
--- a/ceilometer/tests/unit/hardware/pollsters/test_util.py
+++ /dev/null
@@ -1,59 +0,0 @@
-#
-# Copyright 2013 Intel Corp
-#
-# 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_utils import netutils
-
-from ceilometer.hardware.pollsters import util
-from ceilometer import sample
-from ceilometer.tests import base as test_base
-
-
-class TestPollsterUtils(test_base.BaseTestCase):
- def setUp(self):
- super(TestPollsterUtils, self).setUp()
- self.host_url = netutils.urlsplit("snmp://127.0.0.1:161")
-
- def test_make_sample(self):
- s = util.make_sample_from_host(self.host_url,
- name='test',
- sample_type=sample.TYPE_GAUGE,
- unit='B',
- volume=1,
- res_metadata={
- 'metakey': 'metaval',
- })
- self.assertEqual('127.0.0.1', s.resource_id)
- self.assertIn('snmp://127.0.0.1:161', s.resource_metadata.values())
- self.assertIn('metakey', s.resource_metadata.keys())
-
- def test_make_sample_extra(self):
- extra = {
- 'project_id': 'project',
- 'resource_id': 'resource'
- }
- s = util.make_sample_from_host(self.host_url,
- name='test',
- sample_type=sample.TYPE_GAUGE,
- unit='B',
- volume=1,
- extra=extra)
- self.assertIsNone(s.user_id)
- self.assertEqual('project', s.project_id)
- self.assertEqual('resource', s.resource_id)
- self.assertEqual({'resource_url': 'snmp://127.0.0.1:161',
- 'project_id': 'project',
- 'resource_id':
- 'resource'},
- s.resource_metadata)
diff --git a/ceilometer/tests/unit/image/test_glance.py b/ceilometer/tests/unit/image/test_glance.py
index 48d35960..423eb481 100644
--- a/ceilometer/tests/unit/image/test_glance.py
+++ b/ceilometer/tests/unit/image/test_glance.py
@@ -20,64 +20,64 @@ import ceilometer.tests.base as base
IMAGE_LIST = [
type('Image', (object,),
- {u'status': u'active',
- u'tags': [],
- u'kernel_id': u'fd24d91a-dfd5-4a3c-b990-d4563eb27396',
- u'container_format': u'ami',
- u'min_ram': 0,
- u'ramdisk_id': u'd629522b-ebaa-4c92-9514-9e31fe760d18',
- u'updated_at': u'2016-06-20T13: 34: 41Z',
- u'visibility': u'public',
- u'owner': u'6824974c08974d4db864bbaa6bc08303',
- u'file': u'/v2/images/fda54a44-3f96-40bf-ab07-0a4ce9e1761d/file',
- u'min_disk': 0,
- u'virtual_size': None,
- u'id': u'fda54a44-3f96-40bf-ab07-0a4ce9e1761d',
- u'size': 25165824,
- u'name': u'cirros-0.3.4-x86_64-uec',
- u'checksum': u'eb9139e4942121f22bbc2afc0400b2a4',
- u'created_at': u'2016-06-20T13: 34: 40Z',
- u'disk_format': u'ami',
- u'protected': False,
- u'schema': u'/v2/schemas/image'}),
+ {'status': 'active',
+ 'tags': [],
+ 'kernel_id': 'fd24d91a-dfd5-4a3c-b990-d4563eb27396',
+ 'container_format': 'ami',
+ 'min_ram': 0,
+ 'ramdisk_id': 'd629522b-ebaa-4c92-9514-9e31fe760d18',
+ 'updated_at': '2016-06-20T13: 34: 41Z',
+ 'visibility': 'public',
+ 'owner': '6824974c08974d4db864bbaa6bc08303',
+ 'file': '/v2/images/fda54a44-3f96-40bf-ab07-0a4ce9e1761d/file',
+ 'min_disk': 0,
+ 'virtual_size': None,
+ 'id': 'fda54a44-3f96-40bf-ab07-0a4ce9e1761d',
+ 'size': 25165824,
+ 'name': 'cirros-0.3.4-x86_64-uec',
+ 'checksum': 'eb9139e4942121f22bbc2afc0400b2a4',
+ 'created_at': '2016-06-20T13: 34: 40Z',
+ 'disk_format': 'ami',
+ 'protected': False,
+ 'schema': '/v2/schemas/image'}),
type('Image', (object,),
- {u'status': u'active',
- u'tags': [],
- u'container_format': u'ari',
- u'min_ram': 0,
- u'updated_at': u'2016-06-20T13: 34: 38Z',
- u'visibility': u'public',
- u'owner': u'6824974c08974d4db864bbaa6bc08303',
- u'file': u'/v2/images/d629522b-ebaa-4c92-9514-9e31fe760d18/file',
- u'min_disk': 0,
- u'virtual_size': None,
- u'id': u'd629522b-ebaa-4c92-9514-9e31fe760d18',
- u'size': 3740163,
- u'name': u'cirros-0.3.4-x86_64-uec-ramdisk',
- u'checksum': u'be575a2b939972276ef675752936977f',
- u'created_at': u'2016-06-20T13: 34: 37Z',
- u'disk_format': u'ari',
- u'protected': False,
- u'schema': u'/v2/schemas/image'}),
+ {'status': 'active',
+ 'tags': [],
+ 'container_format': 'ari',
+ 'min_ram': 0,
+ 'updated_at': '2016-06-20T13: 34: 38Z',
+ 'visibility': 'public',
+ 'owner': '6824974c08974d4db864bbaa6bc08303',
+ 'file': '/v2/images/d629522b-ebaa-4c92-9514-9e31fe760d18/file',
+ 'min_disk': 0,
+ 'virtual_size': None,
+ 'id': 'd629522b-ebaa-4c92-9514-9e31fe760d18',
+ 'size': 3740163,
+ 'name': 'cirros-0.3.4-x86_64-uec-ramdisk',
+ 'checksum': 'be575a2b939972276ef675752936977f',
+ 'created_at': '2016-06-20T13: 34: 37Z',
+ 'disk_format': 'ari',
+ 'protected': False,
+ 'schema': '/v2/schemas/image'}),
type('Image', (object,),
- {u'status': u'active',
- u'tags': [],
- u'container_format': u'aki',
- u'min_ram': 0,
- u'updated_at': u'2016-06-20T13: 34: 35Z',
- u'visibility': u'public',
- u'owner': u'6824974c08974d4db864bbaa6bc08303',
- u'file': u'/v2/images/fd24d91a-dfd5-4a3c-b990-d4563eb27396/file',
- u'min_disk': 0,
- u'virtual_size': None,
- u'id': u'fd24d91a-dfd5-4a3c-b990-d4563eb27396',
- u'size': 4979632,
- u'name': u'cirros-0.3.4-x86_64-uec-kernel',
- u'checksum': u'8a40c862b5735975d82605c1dd395796',
- u'created_at': u'2016-06-20T13: 34: 35Z',
- u'disk_format': u'aki',
- u'protected': False,
- u'schema': u'/v2/schemas/image'}),
+ {'status': 'active',
+ 'tags': [],
+ 'container_format': 'aki',
+ 'min_ram': 0,
+ 'updated_at': '2016-06-20T13: 34: 35Z',
+ 'visibility': 'public',
+ 'owner': '6824974c08974d4db864bbaa6bc08303',
+ 'file': '/v2/images/fd24d91a-dfd5-4a3c-b990-d4563eb27396/file',
+ 'min_disk': 0,
+ 'virtual_size': None,
+ 'id': 'fd24d91a-dfd5-4a3c-b990-d4563eb27396',
+ 'size': 4979632,
+ 'name': 'cirros-0.3.4-x86_64-uec-kernel',
+ 'checksum': '8a40c862b5735975d82605c1dd395796',
+ 'created_at': '2016-06-20T13: 34: 35Z',
+ 'disk_format': 'aki',
+ 'protected': False,
+ 'schema': '/v2/schemas/image'}),
]
diff --git a/ceilometer/tests/unit/meter/test_notifications.py b/ceilometer/tests/unit/meter/test_notifications.py
index ea3299c3..d1dec075 100644
--- a/ceilometer/tests/unit/meter/test_notifications.py
+++ b/ceilometer/tests/unit/meter/test_notifications.py
@@ -25,71 +25,71 @@ from ceilometer import service as ceilometer_service
from ceilometer.tests import base as test
NOTIFICATION = {
- 'event_type': u'test.create',
- 'metadata': {'timestamp': u'2015-06-19T09:19:35.786893',
- 'message_id': u'939823de-c242-45a2-a399-083f4d6a8c3e'},
- 'payload': {u'user_id': u'e1d870e51c7340cb9d555b15cbfcaec2',
- u'resource_id': u'bea70e51c7340cb9d555b15cbfcaec23',
- u'timestamp': u'2015-06-19T09:19:35.785330',
- u'created_at': u'2015-06-19T09:25:35.785330',
- u'launched_at': u'2015-06-19T09:25:40.785330',
- u'message_signature': u'fake_signature1',
- u'resource_metadata': {u'foo': u'bar'},
- u'source': u'30be1fc9a03c4e94ab05c403a8a377f2: openstack',
- u'volume': 1.0,
- u'project_id': u'30be1fc9a03c4e94ab05c403a8a377f2',
+ 'event_type': 'test.create',
+ 'metadata': {'timestamp': '2015-06-19T09:19:35.786893',
+ 'message_id': '939823de-c242-45a2-a399-083f4d6a8c3e'},
+ 'payload': {'user_id': 'e1d870e51c7340cb9d555b15cbfcaec2',
+ 'resource_id': 'bea70e51c7340cb9d555b15cbfcaec23',
+ 'timestamp': '2015-06-19T09:19:35.785330',
+ 'created_at': '2015-06-19T09:25:35.785330',
+ 'launched_at': '2015-06-19T09:25:40.785330',
+ 'message_signature': 'fake_signature1',
+ 'resource_metadata': {'foo': 'bar'},
+ 'source': '30be1fc9a03c4e94ab05c403a8a377f2: openstack',
+ 'volume': 1.0,
+ 'project_id': '30be1fc9a03c4e94ab05c403a8a377f2',
},
- 'ctxt': {u'tenant': u'30be1fc9a03c4e94ab05c403a8a377f2',
- u'request_id': u'req-da91b4bf-d2b5-43ae-8b66-c7752e72726d',
- u'user': u'e1d870e51c7340cb9d555b15cbfcaec2'},
+ 'ctxt': {'tenant': '30be1fc9a03c4e94ab05c403a8a377f2',
+ 'request_id': 'req-da91b4bf-d2b5-43ae-8b66-c7752e72726d',
+ 'user': 'e1d870e51c7340cb9d555b15cbfcaec2'},
'publisher_id': "foo123"
}
USER_META = {
- 'event_type': u'test.create',
- 'metadata': {'timestamp': u'2015-06-19T09:19:35.786893',
- 'message_id': u'939823de-c242-45a2-a399-083f4d6a8c3e'},
- 'payload': {u'user_id': u'e1d870e51c7340cb9d555b15cbfcaec2',
- u'resource_id': u'bea70e51c7340cb9d555b15cbfcaec23',
- u'timestamp': u'2015-06-19T09:19:35.785330',
- u'created_at': u'2015-06-19T09:25:35.785330',
- u'launched_at': u'2015-06-19T09:25:40.785330',
- u'message_signature': u'fake_signature1',
- u'resource_metadata': {u'foo': u'bar'},
- u'source': u'30be1fc9a03c4e94ab05c403a8a377f2: openstack',
- u'volume': 1.0,
- u'project_id': u'30be1fc9a03c4e94ab05c403a8a377f2',
- u'metadata': {u'metering.xyz': u'abc', u'ignore': u'this'},
+ 'event_type': 'test.create',
+ 'metadata': {'timestamp': '2015-06-19T09:19:35.786893',
+ 'message_id': '939823de-c242-45a2-a399-083f4d6a8c3e'},
+ 'payload': {'user_id': 'e1d870e51c7340cb9d555b15cbfcaec2',
+ 'resource_id': 'bea70e51c7340cb9d555b15cbfcaec23',
+ 'timestamp': '2015-06-19T09:19:35.785330',
+ 'created_at': '2015-06-19T09:25:35.785330',
+ 'launched_at': '2015-06-19T09:25:40.785330',
+ 'message_signature': 'fake_signature1',
+ 'resource_metadata': {'foo': 'bar'},
+ 'source': '30be1fc9a03c4e94ab05c403a8a377f2: openstack',
+ 'volume': 1.0,
+ 'project_id': '30be1fc9a03c4e94ab05c403a8a377f2',
+ 'metadata': {'metering.xyz': 'abc', 'ignore': 'this'},
},
- 'ctxt': {u'tenant': u'30be1fc9a03c4e94ab05c403a8a377f2',
- u'request_id': u'req-da91b4bf-d2b5-43ae-8b66-c7752e72726d',
- u'user': u'e1d870e51c7340cb9d555b15cbfcaec2'},
+ 'ctxt': {'tenant': '30be1fc9a03c4e94ab05c403a8a377f2',
+ 'request_id': 'req-da91b4bf-d2b5-43ae-8b66-c7752e72726d',
+ 'user': 'e1d870e51c7340cb9d555b15cbfcaec2'},
'publisher_id': "foo123"
}
MIDDLEWARE_EVENT = {
- u'ctxt': {u'request_id': u'req-a8bfa89b-d28b-4b95-9e4b-7d7875275650',
- u'quota_class': None,
- u'service_catalog': [],
- u'auth_token': None,
- u'user_id': None,
- u'is_admin': True,
- u'user': None,
- u'remote_address': None,
- u'roles': [],
- u'timestamp': u'2013-07-29T06:51:34.348091',
- u'project_name': None,
- u'read_deleted': u'no',
- u'tenant': None,
- u'instance_lock_checked': False,
- u'project_id': None,
- u'user_name': None},
- u'event_type': u'objectstore.http.request',
- u'publisher_id': u'ceilometermiddleware',
- u'metadata': {u'message_id': u'6eccedba-120e-4db8-9735-2ad5f061e5ee',
- u'timestamp': u'2013-07-29T06:51:34.474815+00:00',
- u'_unique_id': u'0ee26117077648e18d88ac76e28a72e2'},
- u'payload': {
+ 'ctxt': {'request_id': 'req-a8bfa89b-d28b-4b95-9e4b-7d7875275650',
+ 'quota_class': None,
+ 'service_catalog': [],
+ 'auth_token': None,
+ 'user_id': None,
+ 'is_admin': True,
+ 'user': None,
+ 'remote_address': None,
+ 'roles': [],
+ 'timestamp': '2013-07-29T06:51:34.348091',
+ 'project_name': None,
+ 'read_deleted': 'no',
+ 'tenant': None,
+ 'instance_lock_checked': False,
+ 'project_id': None,
+ 'user_name': None},
+ 'event_type': 'objectstore.http.request',
+ 'publisher_id': 'ceilometermiddleware',
+ 'metadata': {'message_id': '6eccedba-120e-4db8-9735-2ad5f061e5ee',
+ 'timestamp': '2013-07-29T06:51:34.474815+00:00',
+ '_unique_id': '0ee26117077648e18d88ac76e28a72e2'},
+ 'payload': {
'typeURI': 'http: //schemas.dmtf.org/cloud/audit/1.0/event',
'eventTime': '2013-07-29T06:51:34.474815+00:00',
'target': {
@@ -137,99 +137,99 @@ MIDDLEWARE_EVENT = {
}
FULL_MULTI_MSG = {
- 'event_type': u'full.sample',
+ 'event_type': 'full.sample',
'payload': [{
- u'counter_name': u'instance1',
- u'user_id': u'user1',
- u'resource_id': u'res1',
- u'counter_unit': u'ns',
- u'counter_volume': 28.0,
- u'project_id': u'proj1',
- u'counter_type': u'gauge'
+ 'counter_name': 'instance1',
+ 'user_id': 'user1',
+ 'resource_id': 'res1',
+ 'counter_unit': 'ns',
+ 'counter_volume': 28.0,
+ 'project_id': 'proj1',
+ 'counter_type': 'gauge'
},
{
- u'counter_name': u'instance2',
- u'user_id': u'user2',
- u'resource_id': u'res2',
- u'counter_unit': u'%',
- u'counter_volume': 1.0,
- u'project_id': u'proj2',
- u'counter_type': u'delta'
+ 'counter_name': 'instance2',
+ 'user_id': 'user2',
+ 'resource_id': 'res2',
+ 'counter_unit': '%',
+ 'counter_volume': 1.0,
+ 'project_id': 'proj2',
+ 'counter_type': 'delta'
}],
- u'ctxt': {u'domain': None,
- u'request_id': u'req-da91b4bf-d2b5-43ae-8b66-c7752e72726d',
- u'auth_token': None,
- u'read_only': False,
- u'resource_uuid': None,
- u'user_identity': u'fake_user_identity---',
- u'show_deleted': False,
- u'tenant': u'30be1fc9a03c4e94ab05c403a8a377f2',
- u'is_admin': True,
- u'project_domain': None,
- u'user': u'e1d870e51c7340cb9d555b15cbfcaec2',
- u'user_domain': None},
- 'publisher_id': u'ceilometer.api',
- 'metadata': {'message_id': u'939823de-c242-45a2-a399-083f4d6a8c3e',
- 'timestamp': u'2015-06-19T09:19:35.786893'},
+ 'ctxt': {'domain': None,
+ 'request_id': 'req-da91b4bf-d2b5-43ae-8b66-c7752e72726d',
+ 'auth_token': None,
+ 'read_only': False,
+ 'resource_uuid': None,
+ 'user_identity': 'fake_user_identity---',
+ 'show_deleted': False,
+ 'tenant': '30be1fc9a03c4e94ab05c403a8a377f2',
+ 'is_admin': True,
+ 'project_domain': None,
+ 'user': 'e1d870e51c7340cb9d555b15cbfcaec2',
+ 'user_domain': None},
+ 'publisher_id': 'ceilometer.api',
+ 'metadata': {'message_id': '939823de-c242-45a2-a399-083f4d6a8c3e',
+ 'timestamp': '2015-06-19T09:19:35.786893'},
}
METRICS_UPDATE = {
- u'event_type': u'compute.metrics.update',
- u'payload': {
- u'metrics': [
- {'timestamp': u'2013-07-29T06:51:34.472416',
+ 'event_type': 'compute.metrics.update',
+ 'payload': {
+ 'metrics': [
+ {'timestamp': '2013-07-29T06:51:34.472416',
'name': 'cpu.frequency', 'value': 1600,
'source': 'libvirt.LibvirtDriver'},
- {'timestamp': u'2013-07-29T06:51:34.472416',
+ {'timestamp': '2013-07-29T06:51:34.472416',
'name': 'cpu.user.time', 'value': 17421440000000,
'source': 'libvirt.LibvirtDriver'},
- {'timestamp': u'2013-07-29T06:51:34.472416',
+ {'timestamp': '2013-07-29T06:51:34.472416',
'name': 'cpu.kernel.time', 'value': 7852600000000,
'source': 'libvirt.LibvirtDriver'},
- {'timestamp': u'2013-07-29T06:51:34.472416',
+ {'timestamp': '2013-07-29T06:51:34.472416',
'name': 'cpu.idle.time', 'value': 1307374400000000,
'source': 'libvirt.LibvirtDriver'},
- {'timestamp': u'2013-07-29T06:51:34.472416',
+ {'timestamp': '2013-07-29T06:51:34.472416',
'name': 'cpu.iowait.time', 'value': 11697470000000,
'source': 'libvirt.LibvirtDriver'},
- {'timestamp': u'2013-07-29T06:51:34.472416',
+ {'timestamp': '2013-07-29T06:51:34.472416',
'name': 'cpu.user.percent', 'value': 0.012959045637294348,
'source': 'libvirt.LibvirtDriver'},
- {'timestamp': u'2013-07-29T06:51:34.472416',
+ {'timestamp': '2013-07-29T06:51:34.472416',
'name': 'cpu.kernel.percent', 'value': 0.005841204961898534,
'source': 'libvirt.LibvirtDriver'},
- {'timestamp': u'2013-07-29T06:51:34.472416',
+ {'timestamp': '2013-07-29T06:51:34.472416',
'name': 'cpu.idle.percent', 'value': 0.9724985141658965,
'source': 'libvirt.LibvirtDriver'},
- {'timestamp': u'2013-07-29T06:51:34.472416',
+ {'timestamp': '2013-07-29T06:51:34.472416',
'name': 'cpu.iowait.percent', 'value': 0.008701235234910634,
'source': 'libvirt.LibvirtDriver'},
- {'timestamp': u'2013-07-29T06:51:34.472416',
+ {'timestamp': '2013-07-29T06:51:34.472416',
'name': 'cpu.percent', 'value': 0.027501485834103515,
'source': 'libvirt.LibvirtDriver'}],
- u'nodename': u'tianst.sh.intel.com',
- u'host': u'tianst',
- u'host_id': u'10.0.1.1'},
- u'publisher_id': u'compute.tianst.sh.intel.com',
- u'metadata': {u'message_id': u'6eccedba-120e-4db8-9735-2ad5f061e5ee',
- u'timestamp': u'2013-07-29 06:51:34.474815',
- u'_unique_id': u'0ee26117077648e18d88ac76e28a72e2'},
- u'ctxt': {u'request_id': u'req-a8bfa89b-d28b-4b95-9e4b-7d7875275650',
- u'quota_class': None,
- u'service_catalog': [],
- u'auth_token': None,
- u'user_id': None,
- u'is_admin': True,
- u'user': None,
- u'remote_address': None,
- u'roles': [],
- u'timestamp': u'2013-07-29T06:51:34.348091',
- u'project_name': None,
- u'read_deleted': u'no',
- u'tenant': None,
- u'instance_lock_checked': False,
- u'project_id': None,
- u'user_name': None}
+ 'nodename': 'tianst.sh.intel.com',
+ 'host': 'tianst',
+ 'host_id': '10.0.1.1'},
+ 'publisher_id': 'compute.tianst.sh.intel.com',
+ 'metadata': {'message_id': '6eccedba-120e-4db8-9735-2ad5f061e5ee',
+ 'timestamp': '2013-07-29 06:51:34.474815',
+ '_unique_id': '0ee26117077648e18d88ac76e28a72e2'},
+ 'ctxt': {'request_id': 'req-a8bfa89b-d28b-4b95-9e4b-7d7875275650',
+ 'quota_class': None,
+ 'service_catalog': [],
+ 'auth_token': None,
+ 'user_id': None,
+ 'is_admin': True,
+ 'user': None,
+ 'remote_address': None,
+ 'roles': [],
+ 'timestamp': '2013-07-29T06:51:34.348091',
+ 'project_name': None,
+ 'read_deleted': 'no',
+ 'tenant': None,
+ 'instance_lock_checked': False,
+ 'project_id': None,
+ 'user_name': None}
}
diff --git a/ceilometer/tests/unit/network/statistics/opendaylight/test_driver.py b/ceilometer/tests/unit/network/statistics/opendaylight/test_driver.py
index ae95c4b8..b40d5a0c 100644
--- a/ceilometer/tests/unit/network/statistics/opendaylight/test_driver.py
+++ b/ceilometer/tests/unit/network/statistics/opendaylight/test_driver.py
@@ -24,35 +24,43 @@ from ceilometer import service
class _Base(base.BaseTestCase, metaclass=abc.ABCMeta):
- @abc.abstractproperty
+ @property
+ @abc.abstractmethod
def flow_data(self):
pass
- @abc.abstractproperty
+ @property
+ @abc.abstractmethod
def port_data(self):
pass
- @abc.abstractproperty
+ @property
+ @abc.abstractmethod
def table_data(self):
pass
- @abc.abstractproperty
+ @property
+ @abc.abstractmethod
def topology_data(self):
pass
- @abc.abstractproperty
+ @property
+ @abc.abstractmethod
def switch_data(self):
pass
- @abc.abstractproperty
+ @property
+ @abc.abstractmethod
def user_links_data(self):
pass
- @abc.abstractproperty
+ @property
+ @abc.abstractmethod
def active_hosts_data(self):
pass
- @abc.abstractproperty
+ @property
+ @abc.abstractmethod
def inactive_hosts_data(self):
pass
diff --git a/ceilometer/tests/unit/polling/test_discovery.py b/ceilometer/tests/unit/polling/test_discovery.py
index bedbe5c0..6414c874 100644
--- a/ceilometer/tests/unit/polling/test_discovery.py
+++ b/ceilometer/tests/unit/polling/test_discovery.py
@@ -18,7 +18,6 @@ from unittest import mock
from oslotest import base
-from ceilometer.hardware import discovery as hardware
from ceilometer.polling.discovery import endpoint
from ceilometer.polling.discovery import localnode
from ceilometer.polling.discovery import tenant as project
@@ -78,15 +77,15 @@ class TestProjectDiscovery(base.BaseTestCase):
domain_heat.name = 'heat'
domain_heat.enabled = True
domain_heat.links = {
- u'self': u'http://192.168.1.1/identity/v3/domains/'
- u'2f42ab40b7ad4140815ef830d816a16c'}
+ 'self': 'http://192.168.1.1/identity/v3/domains/'
+ '2f42ab40b7ad4140815ef830d816a16c'}
domain_default = mock.MagicMock()
domain_default.id = 'default'
domain_default.name = 'Default'
domain_default.enabled = True
domain_default.links = {
- u'self': u'http://192.168.1.1/identity/v3/domains/default'}
+ 'self': 'http://192.168.1.1/identity/v3/domains/default'}
project_admin = mock.MagicMock()
project_admin.id = '2ce92449a23145ef9c539f3327960ce3'
@@ -96,8 +95,8 @@ class TestProjectDiscovery(base.BaseTestCase):
project_admin.is_domain = False
project_admin.enabled = True
project_admin.links = {
- u'self': u'http://192.168.4.46/identity/v3/projects/'
- u'2ce92449a23145ef9c539f3327960ce3'},
+ 'self': 'http://192.168.4.46/identity/v3/projects/'
+ '2ce92449a23145ef9c539f3327960ce3'},
project_service = mock.MagicMock()
project_service.id = '9bf93b86bca04e3b815f86a5de083adc'
@@ -107,8 +106,8 @@ class TestProjectDiscovery(base.BaseTestCase):
project_service.is_domain = False
project_service.enabled = True
project_service.links = {
- u'self': u'http://192.168.4.46/identity/v3/projects/'
- u'9bf93b86bca04e3b815f86a5de083adc'}
+ 'self': 'http://192.168.4.46/identity/v3/projects/'
+ '9bf93b86bca04e3b815f86a5de083adc'}
project_demo = mock.MagicMock()
project_demo.id = '57d96b9af18d43bb9d047f436279b0be'
@@ -118,8 +117,8 @@ class TestProjectDiscovery(base.BaseTestCase):
project_demo.is_domain = False
project_demo.enabled = True
project_demo.links = {
- u'self': u'http://192.168.4.46/identity/v3/projects/'
- u'57d96b9af18d43bb9d047f436279b0be'}
+ 'self': 'http://192.168.4.46/identity/v3/projects/'
+ '57d96b9af18d43bb9d047f436279b0be'}
self.domains = [domain_heat, domain_default]
self.default_domain_projects = [project_admin, project_service]
@@ -146,63 +145,3 @@ class TestProjectDiscovery(base.BaseTestCase):
result = self.discovery.discover(self.manager)
self.assertEqual(len(result), 3)
self.assertEqual(self.manager.keystone.projects.list.call_count, 2)
-
-
-class TestHardwareDiscovery(base.BaseTestCase):
- class MockInstance(object):
- addresses = {'ctlplane': [
- {'addr': '0.0.0.0',
- 'OS-EXT-IPS-MAC:mac_addr': '01-23-45-67-89-ab'}
- ]}
- id = 'resource_id'
- image = {'id': 'image_id'}
- flavor = {'id': 'flavor_id'}
-
- expected = {
- 'resource_id': 'resource_id',
- 'resource_url': 'snmp://ro_snmp_user:password@0.0.0.0',
- 'mac_addr': '01-23-45-67-89-ab',
- 'image_id': 'image_id',
- 'flavor_id': 'flavor_id',
- }
-
- expected_usm = {
- 'resource_id': 'resource_id',
- 'resource_url': ''.join(['snmp://ro_snmp_user:password@0.0.0.0',
- '?priv_proto=aes192',
- '&priv_password=priv_pass']),
- 'mac_addr': '01-23-45-67-89-ab',
- 'image_id': 'image_id',
- 'flavor_id': 'flavor_id',
- }
-
- def setUp(self):
- super(TestHardwareDiscovery, self).setUp()
- self.CONF = service.prepare_service([], [])
- self.discovery = hardware.NodesDiscoveryTripleO(self.CONF)
- self.discovery.nova_cli = mock.MagicMock()
- self.manager = mock.MagicMock()
-
- def test_hardware_discovery(self):
- self.discovery.nova_cli.instance_get_all.return_value = [
- self.MockInstance()]
- resources = self.discovery.discover(self.manager)
- self.assertEqual(1, len(resources))
- self.assertEqual(self.expected, resources[0])
-
- def test_hardware_discovery_without_flavor(self):
- instance = self.MockInstance()
- instance.flavor = {}
- self.discovery.nova_cli.instance_get_all.return_value = [instance]
- resources = self.discovery.discover(self.manager)
- self.assertEqual(0, len(resources))
-
- def test_hardware_discovery_usm(self):
- self.CONF.set_override('readonly_user_priv_proto', 'aes192',
- group='hardware')
- self.CONF.set_override('readonly_user_priv_password', 'priv_pass',
- group='hardware')
- self.discovery.nova_cli.instance_get_all.return_value = [
- self.MockInstance()]
- resources = self.discovery.discover(self.manager)
- self.assertEqual(self.expected_usm, resources[0])
diff --git a/ceilometer/tests/unit/polling/test_manager.py b/ceilometer/tests/unit/polling/test_manager.py
index d041393c..8cab92dc 100644
--- a/ceilometer/tests/unit/polling/test_manager.py
+++ b/ceilometer/tests/unit/polling/test_manager.py
@@ -25,7 +25,6 @@ from keystoneauth1 import exceptions as ka_exceptions
from stevedore import extension
from ceilometer.compute import discovery as nova_discover
-from ceilometer.hardware import discovery
from ceilometer.polling.dynamic_pollster import DynamicPollster
from ceilometer.polling.dynamic_pollster import \
NonOpenStackApisPollsterDefinition
@@ -379,6 +378,17 @@ class TestPollingAgent(BaseAgent):
super(TestPollingAgent, self).setUp()
self.mgr = self.create_manager()
self.mgr.extensions = self.create_extension_list()
+ ks_client = mock.Mock(auth_token='fake_token')
+ ks_client.projects.get.return_value = mock.Mock(
+ name='admin', id='4465ecd1438b4d23a866cf8447387a7b'
+ )
+ ks_client.users.get.return_value = mock.Mock(
+ name='admin', id='c0c935468e654d5a8baae1a08adf4dfb'
+ )
+ self.useFixture(fixtures.MockPatch(
+ 'ceilometer.keystone_client.get_client',
+ return_value=ks_client))
+ self.ks_client = ks_client
self.setup_polling()
@mock.patch('ceilometer.polling.manager.PollingManager')
@@ -423,6 +433,76 @@ class TestPollingAgent(BaseAgent):
self.assertIn(60, polling_tasks.keys())
self.assertNotIn(10, polling_tasks.keys())
+ @mock.patch('glob.glob')
+ @mock.patch('ceilometer.declarative.load_definitions')
+ def test_setup_polling_dynamic_pollster_namespace(self, load_mock,
+ glob_mock):
+ glob_mock.return_value = ['test.yml']
+ load_mock.return_value = [{
+ 'name': "test.dynamic.pollster",
+ 'namespaces': "dynamic",
+ 'sample_type': 'gauge',
+ 'unit': 'test',
+ 'endpoint_type': 'test',
+ 'url_path': 'test',
+ 'value_attribute': 'test'
+ }, {
+ 'name': "test.compute.central.pollster",
+ 'sample_type': 'gauge',
+ 'namespaces': ["compute", "central"],
+ 'unit': 'test',
+ 'endpoint_type': 'test',
+ 'url_path': 'test',
+ 'value_attribute': 'test'
+ }, {
+ 'name': "test.compute.pollster",
+ 'namespaces': ["compute"],
+ 'sample_type': 'gauge',
+ 'unit': 'test',
+ 'endpoint_type': 'test',
+ 'url_path': 'test',
+ 'value_attribute': 'test'
+ }, {
+ 'name': "test.central.pollster",
+ 'sample_type': 'gauge',
+ 'unit': 'test',
+ 'endpoint_type': 'test',
+ 'url_path': 'test',
+ 'value_attribute': 'test'
+ }]
+ mgr = manager.AgentManager(0, self.CONF, namespaces=['dynamic'])
+ self.assertEqual(len(mgr.extensions), 1)
+ self.assertEqual(
+ mgr.extensions[0].definitions.configurations['name'],
+ 'test.dynamic.pollster')
+
+ mgr = manager.AgentManager(0, self.CONF)
+ self.assertEqual(
+ mgr.extensions[-3].definitions.configurations['name'],
+ 'test.compute.central.pollster')
+ self.assertEqual(
+ mgr.extensions[-2].definitions.configurations['name'],
+ 'test.compute.pollster')
+ self.assertEqual(
+ mgr.extensions[-1].definitions.configurations['name'],
+ 'test.central.pollster')
+
+ mgr = manager.AgentManager(0, self.CONF, namespaces=['compute'])
+ self.assertEqual(
+ mgr.extensions[-2].definitions.configurations['name'],
+ 'test.compute.central.pollster')
+ self.assertEqual(
+ mgr.extensions[-1].definitions.configurations['name'],
+ 'test.compute.pollster')
+
+ mgr = manager.AgentManager(0, self.CONF, ['central'])
+ self.assertEqual(
+ mgr.extensions[-2].definitions.configurations['name'],
+ 'test.compute.central.pollster')
+ self.assertEqual(
+ mgr.extensions[-1].definitions.configurations['name'],
+ 'test.central.pollster')
+
def test_setup_polling_task_same_interval(self):
self.polling_cfg['sources'].append({
'name': 'test_polling_1',
@@ -690,48 +770,6 @@ class TestPollingAgent(BaseAgent):
self.assertFalse(self.notified_samples)
@mock.patch('ceilometer.polling.manager.LOG')
- @mock.patch('ceilometer.nova_client.LOG')
- def test_hardware_discover_fail_minimize_logs(self, novalog, baselog):
- class PollsterHardware(TestPollster):
- discovery = 'tripleo_overcloud_nodes'
-
- class PollsterHardwareAnother(TestPollster):
- discovery = 'tripleo_overcloud_nodes'
-
- self.mgr.extensions.extend([
- extension.Extension('testhardware',
- None,
- None,
- PollsterHardware(self.CONF), ),
- extension.Extension('testhardware2',
- None,
- None,
- PollsterHardwareAnother(self.CONF), )
- ])
- ext = extension.Extension('tripleo_overcloud_nodes',
- None,
- None,
- discovery.NodesDiscoveryTripleO(self.CONF))
- self.mgr.discoveries = (extension.ExtensionManager
- .make_test_instance([ext]))
-
- poll_cfg = {
- 'sources': [{
- 'name': "test_hardware",
- 'interval': 10,
- 'meters': ['testhardware', 'testhardware2'],
- 'sinks': ['test_sink']}],
- 'sinks': [{
- 'name': 'test_sink',
- 'publishers': ["test"]}]
- }
- self.setup_polling(poll_cfg)
- polling_tasks = self.mgr.setup_polling_tasks()
- self.mgr.interval_task(list(polling_tasks.values())[0])
- self.assertEqual(1, novalog.exception.call_count)
- self.assertFalse(baselog.exception.called)
-
- @mock.patch('ceilometer.polling.manager.LOG')
def test_polling_exception(self, LOG):
source_name = 'test_pollingexception'
res_list = ['test://']
diff --git a/ceilometer/tests/unit/publisher/test_gnocchi.py b/ceilometer/tests/unit/publisher/test_gnocchi.py
index dcaf8c11..236da69b 100644
--- a/ceilometer/tests/unit/publisher/test_gnocchi.py
+++ b/ceilometer/tests/unit/publisher/test_gnocchi.py
@@ -38,162 +38,162 @@ from ceilometer.tests import base
load_tests = testscenarios.load_tests_apply_scenarios
INSTANCE_DELETE_START = models.Event(
- event_type=u'compute.instance.delete.start',
- traits=[models.Trait('state', 1, u'active'),
+ event_type='compute.instance.delete.start',
+ traits=[models.Trait('state', 1, 'active'),
models.Trait(
- 'user_id', 1, u'1e3ce043029547f1a61c1996d1a531a2'),
- models.Trait('service', 1, u'compute'),
- models.Trait('availability_zone', 1, u'zone1'),
+ 'user_id', 1, '1e3ce043029547f1a61c1996d1a531a2'),
+ models.Trait('service', 1, 'compute'),
+ models.Trait('availability_zone', 1, 'zone1'),
models.Trait('disk_gb', 2, 0),
- models.Trait('instance_type', 1, u'm1.tiny'),
- models.Trait('tenant_id', 1, u'7c150a59fe714e6f9263774af9688f0e'),
+ models.Trait('instance_type', 1, 'm1.tiny'),
+ models.Trait('tenant_id', 1, '7c150a59fe714e6f9263774af9688f0e'),
models.Trait('root_gb', 2, 0),
models.Trait('ephemeral_gb', 2, 0),
- models.Trait('instance_type_id', 2, u'2'),
+ models.Trait('instance_type_id', 2, '2'),
models.Trait('vcpus', 2, 1),
models.Trait('memory_mb', 2, 512),
models.Trait(
- 'instance_id', 1, u'9f9d01b9-4a58-4271-9e27-398b21ab20d1'),
- models.Trait('host', 1, u'vagrant-precise'),
+ 'instance_id', 1, '9f9d01b9-4a58-4271-9e27-398b21ab20d1'),
+ models.Trait('host', 1, 'vagrant-precise'),
models.Trait(
- 'request_id', 1, u'req-fb3c4546-a2e5-49b7-9fd2-a63bd658bc39'),
- models.Trait('project_id', 1, u'7c150a59fe714e6f9263774af9688f0e'),
+ 'request_id', 1, 'req-fb3c4546-a2e5-49b7-9fd2-a63bd658bc39'),
+ models.Trait('project_id', 1, '7c150a59fe714e6f9263774af9688f0e'),
models.Trait('launched_at', 4, '2012-05-08T20:23:47')],
raw={},
generated='2012-05-08T20:24:14.824743',
- message_id=u'a15b94ee-cb8e-4c71-9abe-14aa80055fb4',
+ message_id='a15b94ee-cb8e-4c71-9abe-14aa80055fb4',
)
INSTANCE_CREATE_END = models.Event(
- event_type=u'compute.instance.create.end',
- traits=[models.Trait('state', 1, u'active'),
+ event_type='compute.instance.create.end',
+ traits=[models.Trait('state', 1, 'active'),
models.Trait(
- 'user_id', 1, u'1e3ce043029547f1a61c1996d1a531a2'),
- models.Trait('service', 1, u'compute'),
- models.Trait('availability_zone', 1, u'zone1'),
+ 'user_id', 1, '1e3ce043029547f1a61c1996d1a531a2'),
+ models.Trait('service', 1, 'compute'),
+ models.Trait('availability_zone', 1, 'zone1'),
models.Trait('disk_gb', 2, 0),
- models.Trait('instance_type', 1, u'm1.tiny'),
- models.Trait('tenant_id', 1, u'7c150a59fe714e6f9263774af9688f0e'),
+ models.Trait('instance_type', 1, 'm1.tiny'),
+ models.Trait('tenant_id', 1, '7c150a59fe714e6f9263774af9688f0e'),
models.Trait('root_gb', 2, 0),
models.Trait('ephemeral_gb', 2, 0),
- models.Trait('instance_type_id', 2, u'2'),
+ models.Trait('instance_type_id', 2, '2'),
models.Trait('vcpus', 2, 1),
models.Trait('memory_mb', 2, 512),
models.Trait(
- 'instance_id', 1, u'9f9d01b9-4a58-4271-9e27-398b21ab20d1'),
- models.Trait('host', 1, u'vagrant-precise'),
+ 'instance_id', 1, '9f9d01b9-4a58-4271-9e27-398b21ab20d1'),
+ models.Trait('host', 1, 'vagrant-precise'),
models.Trait(
- 'request_id', 1, u'req-fb3c4546-a2e5-49b7-9fd2-a63bd658bc39'),
- models.Trait('project_id', 1, u'7c150a59fe714e6f9263774af9688f0e'),
+ 'request_id', 1, 'req-fb3c4546-a2e5-49b7-9fd2-a63bd658bc39'),
+ models.Trait('project_id', 1, '7c150a59fe714e6f9263774af9688f0e'),
models.Trait('launched_at', 4, '2012-05-08T20:23:47')],
raw={},
generated='2012-05-08T20:24:14.824743',
- message_id=u'202f745e-4913-11e9-affe-9797342bd3a8',
+ message_id='202f745e-4913-11e9-affe-9797342bd3a8',
)
IMAGE_DELETE_START = models.Event(
- event_type=u'image.delete',
- traits=[models.Trait(u'status', 1, u'deleted'),
- models.Trait(u'deleted_at', 1, u'2016-11-04T04:25:56Z'),
- models.Trait(u'user_id', 1, u'e97ef33a20ed4843b520d223f3cc33d4'),
- models.Trait(u'name', 1, u'cirros'),
- models.Trait(u'service', 1, u'image.localhost'),
+ event_type='image.delete',
+ traits=[models.Trait('status', 1, 'deleted'),
+ models.Trait('deleted_at', 1, '2016-11-04T04:25:56Z'),
+ models.Trait('user_id', 1, 'e97ef33a20ed4843b520d223f3cc33d4'),
+ models.Trait('name', 1, 'cirros'),
+ models.Trait('service', 1, 'image.localhost'),
models.Trait(
- u'resource_id', 1, u'dc337359-de70-4044-8e2c-80573ba6e577'),
- models.Trait(u'created_at', 1, u'2016-11-04T04:24:36Z'),
+ 'resource_id', 1, 'dc337359-de70-4044-8e2c-80573ba6e577'),
+ models.Trait('created_at', 1, '2016-11-04T04:24:36Z'),
models.Trait(
- u'project_id', 1, u'e97ef33a20ed4843b520d223f3cc33d4'),
- models.Trait(u'size', 1, u'13287936')],
+ 'project_id', 1, 'e97ef33a20ed4843b520d223f3cc33d4'),
+ models.Trait('size', 1, '13287936')],
raw={},
- generated=u'2016-11-04T04:25:56.493820',
- message_id=u'7f5280f7-1d10-46a5-ba58-4d5508e49f99'
+ generated='2016-11-04T04:25:56.493820',
+ message_id='7f5280f7-1d10-46a5-ba58-4d5508e49f99'
)
VOLUME_DELETE_END = models.Event(
- event_type=u'volume.delete.end',
- traits=[models.Trait(u'availability_zone', 1, u'nova'),
- models.Trait(u'created_at', 1, u'2016-11-28T13:19:53+00:00'),
- models.Trait(u'display_name', 1, u'vol-001'),
+ event_type='volume.delete.end',
+ traits=[models.Trait('availability_zone', 1, 'nova'),
+ models.Trait('created_at', 1, '2016-11-28T13:19:53+00:00'),
+ models.Trait('display_name', 1, 'vol-001'),
models.Trait(
- u'host', 1, u'zhangguoqing-dev@lvmdriver-1#lvmdriver-1'),
+ 'host', 1, 'zhangguoqing-dev@lvmdriver-1#lvmdriver-1'),
models.Trait(
- u'project_id', 1, u'd53fcc7dc53c4662ad77822c36a21f00'),
- models.Trait(u'replication_status', 1, u'disabled'),
+ 'project_id', 1, 'd53fcc7dc53c4662ad77822c36a21f00'),
+ models.Trait('replication_status', 1, 'disabled'),
models.Trait(
- u'request_id', 1, u'req-f44df096-50d4-4211-95ea-64be6f5e4f60'),
+ 'request_id', 1, 'req-f44df096-50d4-4211-95ea-64be6f5e4f60'),
models.Trait(
- u'resource_id', 1, u'6cc6e7dd-d17d-460f-ae79-7e08a216ce96'),
+ 'resource_id', 1, '6cc6e7dd-d17d-460f-ae79-7e08a216ce96'),
models.Trait(
- u'service', 1, u'volume.zhangguoqing-dev@lvmdriver-1'),
- models.Trait(u'size', 1, u'1'),
- models.Trait(u'status', 1, u'deleting'),
- models.Trait(u'tenant_id', 1, u'd53fcc7dc53c4662ad77822c36a21f00'),
- models.Trait(u'type', 1, u'af6271fa-13c4-44e6-9246-754ce9dc7df8'),
- models.Trait(u'user_id', 1, u'819bbd28f5374506b8502521c89430b5')],
+ 'service', 1, 'volume.zhangguoqing-dev@lvmdriver-1'),
+ models.Trait('size', 1, '1'),
+ models.Trait('status', 1, 'deleting'),
+ models.Trait('tenant_id', 1, 'd53fcc7dc53c4662ad77822c36a21f00'),
+ models.Trait('type', 1, 'af6271fa-13c4-44e6-9246-754ce9dc7df8'),
+ models.Trait('user_id', 1, '819bbd28f5374506b8502521c89430b5')],
raw={},
generated='2016-11-28T13:42:15.484674',
- message_id=u'a15b94ee-cb8e-4c71-9abe-14aa80055fb4',
+ message_id='a15b94ee-cb8e-4c71-9abe-14aa80055fb4',
)
FLOATINGIP_DELETE_END = models.Event(
- event_type=u'floatingip.delete.end',
- traits=[models.Trait(u'service', 1, u'network.zhangguoqing-dev'),
+ event_type='floatingip.delete.end',
+ traits=[models.Trait('service', 1, 'network.zhangguoqing-dev'),
models.Trait(
- u'project_id', 1, u'd53fcc7dc53c4662ad77822c36a21f00'),
+ 'project_id', 1, 'd53fcc7dc53c4662ad77822c36a21f00'),
models.Trait(
- u'request_id', 1, 'req-443ddb77-31f7-41fe-abbf-921107dd9f00'),
+ 'request_id', 1, 'req-443ddb77-31f7-41fe-abbf-921107dd9f00'),
models.Trait(
- u'resource_id', 1, u'705e2c08-08e8-45cb-8673-5c5be955569b'),
- models.Trait(u'tenant_id', 1, u'd53fcc7dc53c4662ad77822c36a21f00'),
- models.Trait(u'user_id', 1, u'819bbd28f5374506b8502521c89430b5')],
+ 'resource_id', 1, '705e2c08-08e8-45cb-8673-5c5be955569b'),
+ models.Trait('tenant_id', 1, 'd53fcc7dc53c4662ad77822c36a21f00'),
+ models.Trait('user_id', 1, '819bbd28f5374506b8502521c89430b5')],
raw={},
generated='2016-11-29T09:25:55.474710',
- message_id=u'a15b94ee-cb8e-4c71-9abe-14aa80055fb4'
+ message_id='a15b94ee-cb8e-4c71-9abe-14aa80055fb4'
)
VOLUME_TRANSFER_ACCEPT_END = models.Event(
event_type='volume.transfer.accept.end',
- traits=[models.Trait(u'tenant_id', 1, '945e7d09220e4308abe4b3b734bf5fce>'),
- models.Trait(u'project_id', 1, '85bc015f7a2342348593077a927c4aaa'),
- models.Trait(u'user_id', 1, '945e7d09220e4308abe4b3b734bf5fce'),
- models.Trait(u'service', 1, 'volume.controller-0'),
+ traits=[models.Trait('tenant_id', 1, '945e7d09220e4308abe4b3b734bf5fce>'),
+ models.Trait('project_id', 1, '85bc015f7a2342348593077a927c4aaa'),
+ models.Trait('user_id', 1, '945e7d09220e4308abe4b3b734bf5fce'),
+ models.Trait('service', 1, 'volume.controller-0'),
models.Trait(
- u'request_id', 1, 'req-71dd1ae4-81ca-431a-b9fd-ac833eba889f'),
+ 'request_id', 1, 'req-71dd1ae4-81ca-431a-b9fd-ac833eba889f'),
models.Trait(
- u'resource_id', 1, '156b8d3f-ad99-429b-b84c-3f263fb2a801'),
+ 'resource_id', 1, '156b8d3f-ad99-429b-b84c-3f263fb2a801'),
models.Trait(
- u'display_name', 1, 'test-vol'),
+ 'display_name', 1, 'test-vol'),
models.Trait(
- u'type', 1, 'req-71dd1ae4-81ca-431a-b9fd-ac833eba889f'),
- models.Trait(u'host', 1, 'hostgroup@tripleo_iscsi#tripleo_iscsi'),
- models.Trait(u'created_at', 4, '2020-08-28 12:51:52'),
- models.Trait(u'size', 2, 1)],
+ 'type', 1, 'req-71dd1ae4-81ca-431a-b9fd-ac833eba889f'),
+ models.Trait('host', 1, 'hostgroup@tripleo_iscsi#tripleo_iscsi'),
+ models.Trait('created_at', 4, '2020-08-28 12:51:52'),
+ models.Trait('size', 2, 1)],
raw={},
generated='2020-08-28T12:52:22.930413',
- message_id=u'9fc4ceee-d980-4098-a685-2ad660838ac1'
+ message_id='9fc4ceee-d980-4098-a685-2ad660838ac1'
)
SNAPSHOT_TRANSFER_ACCEPT_END = models.Event(
event_type='snapshot.transfer.accept.end',
- traits=[models.Trait(u'tenant_id', 1, '945e7d09220e4308abe4b3b734bf5fce>'),
- models.Trait(u'project_id', 1, '85bc015f7a2342348593077a927c4aaa'),
- models.Trait(u'user_id', 1, '945e7d09220e4308abe4b3b734bf5fce'),
- models.Trait(u'service', 1, 'volume.controller-0'),
+ traits=[models.Trait('tenant_id', 1, '945e7d09220e4308abe4b3b734bf5fce>'),
+ models.Trait('project_id', 1, '85bc015f7a2342348593077a927c4aaa'),
+ models.Trait('user_id', 1, '945e7d09220e4308abe4b3b734bf5fce'),
+ models.Trait('service', 1, 'volume.controller-0'),
models.Trait(
- u'request_id', 1, 'req-71dd1ae4-81ca-431a-b9fd-ac833eba889f'),
+ 'request_id', 1, 'req-71dd1ae4-81ca-431a-b9fd-ac833eba889f'),
models.Trait(
- u'resource_id', 1, '156b8d3f-ad99-429b-b84c-3f263fb2a801'),
+ 'resource_id', 1, '156b8d3f-ad99-429b-b84c-3f263fb2a801'),
models.Trait(
- u'display_name', 1, 'test-vol'),
+ 'display_name', 1, 'test-vol'),
models.Trait(
- u'type', 1, 'req-71dd1ae4-81ca-431a-b9fd-ac833eba889f'),
- models.Trait(u'host', 1, 'hostgroup@tripleo_iscsi#tripleo_iscsi'),
- models.Trait(u'created_at', 4, '2020-08-28 12:51:52'),
- models.Trait(u'size', 2, 1)],
+ 'type', 1, 'req-71dd1ae4-81ca-431a-b9fd-ac833eba889f'),
+ models.Trait('host', 1, 'hostgroup@tripleo_iscsi#tripleo_iscsi'),
+ models.Trait('created_at', 4, '2020-08-28 12:51:52'),
+ models.Trait('size', 2, 1)],
raw={},
generated='2020-08-28T12:52:22.930413',
- message_id=u'9fc4ceee-d980-4098-a685-2ad660838ac1'
+ message_id='9fc4ceee-d980-4098-a685-2ad660838ac1'
)
diff --git a/ceilometer/tests/unit/publisher/test_utils.py b/ceilometer/tests/unit/publisher/test_utils.py
index 2f1dfe77..6f15eb97 100644
--- a/ceilometer/tests/unit/publisher/test_utils.py
+++ b/ceilometer/tests/unit/publisher/test_utils.py
@@ -78,7 +78,7 @@ class TestSignature(base.BaseTestCase):
def test_verify_signature_unicode(self):
data = {'a': 'A', 'b': 'B',
- 'message_signature': u''}
+ 'message_signature': ''}
self.assertFalse(utils.verify_signature(data, 'not-so-secret'))
def test_verify_signature_nested(self):
@@ -109,8 +109,8 @@ class TestSignature(base.BaseTestCase):
self.assertTrue(utils.verify_signature(jsondata, 'not-so-secret'))
def test_verify_unicode_symbols(self):
- data = {u'a\xe9\u0437': 'A',
- 'b': u'B\xe9\u0437'
+ data = {'a\xe9\u0437': 'A',
+ 'b': 'B\xe9\u0437'
}
data['message_signature'] = utils.compute_signature(
data,
diff --git a/ceilometer/tests/unit/test_middleware.py b/ceilometer/tests/unit/test_middleware.py
index 81017b84..3344ee06 100644
--- a/ceilometer/tests/unit/test_middleware.py
+++ b/ceilometer/tests/unit/test_middleware.py
@@ -20,48 +20,48 @@ from ceilometer.tests import base
HTTP_REQUEST = {
- u'ctxt': {u'auth_token': u'3d8b13de1b7d499587dfc69b77dc09c2',
- u'is_admin': True,
- u'project_id': u'7c150a59fe714e6f9263774af9688f0e',
- u'quota_class': None,
- u'read_deleted': u'no',
- u'remote_address': u'10.0.2.15',
- u'request_id': u'req-d68b36e0-9233-467f-9afb-d81435d64d66',
- u'roles': [u'admin'],
- u'timestamp': u'2012-05-08T20:23:41.425105',
- u'user_id': u'1e3ce043029547f1a61c1996d1a531a2'},
- u'event_type': u'http.request',
- u'payload': {u'request': {'HTTP_X_FOOBAR': 'foobaz',
- 'HTTP_X_USER_ID': 'jd-x32',
- 'HTTP_X_PROJECT_ID': 'project-id',
- 'HTTP_X_SERVICE_NAME': 'nova'}},
- u'priority': u'INFO',
- u'publisher_id': u'compute.vagrant-precise',
- u'metadata': {u'message_id': u'dae6f69c-00e0-41c0-b371-41ec3b7f4451',
- u'timestamp': u'2012-05-08 20:23:48.028195'},
+ 'ctxt': {'auth_token': '3d8b13de1b7d499587dfc69b77dc09c2',
+ 'is_admin': True,
+ 'project_id': '7c150a59fe714e6f9263774af9688f0e',
+ 'quota_class': None,
+ 'read_deleted': 'no',
+ 'remote_address': '10.0.2.15',
+ 'request_id': 'req-d68b36e0-9233-467f-9afb-d81435d64d66',
+ 'roles': ['admin'],
+ 'timestamp': '2012-05-08T20:23:41.425105',
+ 'user_id': '1e3ce043029547f1a61c1996d1a531a2'},
+ 'event_type': 'http.request',
+ 'payload': {'request': {'HTTP_X_FOOBAR': 'foobaz',
+ 'HTTP_X_USER_ID': 'jd-x32',
+ 'HTTP_X_PROJECT_ID': 'project-id',
+ 'HTTP_X_SERVICE_NAME': 'nova'}},
+ 'priority': 'INFO',
+ 'publisher_id': 'compute.vagrant-precise',
+ 'metadata': {'message_id': 'dae6f69c-00e0-41c0-b371-41ec3b7f4451',
+ 'timestamp': '2012-05-08 20:23:48.028195'},
}
HTTP_RESPONSE = {
- u'ctxt': {u'auth_token': u'3d8b13de1b7d499587dfc69b77dc09c2',
- u'is_admin': True,
- u'project_id': u'7c150a59fe714e6f9263774af9688f0e',
- u'quota_class': None,
- u'read_deleted': u'no',
- u'remote_address': u'10.0.2.15',
- u'request_id': u'req-d68b36e0-9233-467f-9afb-d81435d64d66',
- u'roles': [u'admin'],
- u'timestamp': u'2012-05-08T20:23:41.425105',
- u'user_id': u'1e3ce043029547f1a61c1996d1a531a2'},
- u'event_type': u'http.response',
- u'payload': {u'request': {'HTTP_X_FOOBAR': 'foobaz',
- 'HTTP_X_USER_ID': 'jd-x32',
- 'HTTP_X_PROJECT_ID': 'project-id',
- 'HTTP_X_SERVICE_NAME': 'nova'},
- u'response': {'status': '200 OK'}},
- u'priority': u'INFO',
- u'publisher_id': u'compute.vagrant-precise',
- u'metadata': {u'message_id': u'dae6f69c-00e0-41c0-b371-41ec3b7f4451',
- u'timestamp': u'2012-05-08 20:23:48.028195'},
+ 'ctxt': {'auth_token': '3d8b13de1b7d499587dfc69b77dc09c2',
+ 'is_admin': True,
+ 'project_id': '7c150a59fe714e6f9263774af9688f0e',
+ 'quota_class': None,
+ 'read_deleted': 'no',
+ 'remote_address': '10.0.2.15',
+ 'request_id': 'req-d68b36e0-9233-467f-9afb-d81435d64d66',
+ 'roles': ['admin'],
+ 'timestamp': '2012-05-08T20:23:41.425105',
+ 'user_id': '1e3ce043029547f1a61c1996d1a531a2'},
+ 'event_type': 'http.response',
+ 'payload': {'request': {'HTTP_X_FOOBAR': 'foobaz',
+ 'HTTP_X_USER_ID': 'jd-x32',
+ 'HTTP_X_PROJECT_ID': 'project-id',
+ 'HTTP_X_SERVICE_NAME': 'nova'},
+ 'response': {'status': '200 OK'}},
+ 'priority': 'INFO',
+ 'publisher_id': 'compute.vagrant-precise',
+ 'metadata': {'message_id': 'dae6f69c-00e0-41c0-b371-41ec3b7f4451',
+ 'timestamp': '2012-05-08 20:23:48.028195'},
}
diff --git a/ceilometer/tests/unit/test_neutronclient.py b/ceilometer/tests/unit/test_neutronclient.py
index b48a249f..97c04ed4 100644
--- a/ceilometer/tests/unit/test_neutronclient.py
+++ b/ceilometer/tests/unit/test_neutronclient.py
@@ -64,6 +64,6 @@ class TestNeutronClient(base.BaseTestCase):
'router:external': True,
'shared': False,
'status': 'ACTIVE',
- 'subnets': [u'c4b6f5b8-3508-4896-b238-a441f25fb492'],
+ 'subnets': ['c4b6f5b8-3508-4896-b238-a441f25fb492'],
'tenant_id': '62d6f08bbd3a44f6ad6f00ca15cce4e5'},
]}
diff --git a/ceilometer/tests/unit/test_notification.py b/ceilometer/tests/unit/test_notification.py
index 2c6dffc1..5b5fa38b 100644
--- a/ceilometer/tests/unit/test_notification.py
+++ b/ceilometer/tests/unit/test_notification.py
@@ -27,54 +27,54 @@ from ceilometer import service
from ceilometer.tests import base as tests_base
TEST_NOTICE_CTXT = {
- u'auth_token': u'3d8b13de1b7d499587dfc69b77dc09c2',
- u'is_admin': True,
- u'project_id': u'7c150a59fe714e6f9263774af9688f0e',
- u'quota_class': None,
- u'read_deleted': u'no',
- u'remote_address': u'10.0.2.15',
- u'request_id': u'req-d68b36e0-9233-467f-9afb-d81435d64d66',
- u'roles': [u'admin'],
- u'timestamp': u'2012-05-08T20:23:41.425105',
- u'user_id': u'1e3ce043029547f1a61c1996d1a531a2',
+ 'auth_token': '3d8b13de1b7d499587dfc69b77dc09c2',
+ 'is_admin': True,
+ 'project_id': '7c150a59fe714e6f9263774af9688f0e',
+ 'quota_class': None,
+ 'read_deleted': 'no',
+ 'remote_address': '10.0.2.15',
+ 'request_id': 'req-d68b36e0-9233-467f-9afb-d81435d64d66',
+ 'roles': ['admin'],
+ 'timestamp': '2012-05-08T20:23:41.425105',
+ 'user_id': '1e3ce043029547f1a61c1996d1a531a2',
}
TEST_NOTICE_METADATA = {
- u'message_id': u'dae6f69c-00e0-41c0-b371-41ec3b7f4451',
- u'timestamp': u'2012-05-08 20:23:48.028195',
+ 'message_id': 'dae6f69c-00e0-41c0-b371-41ec3b7f4451',
+ 'timestamp': '2012-05-08 20:23:48.028195',
}
TEST_NOTICE_PAYLOAD = {
- u'created_at': u'2012-05-08 20:23:41',
- u'deleted_at': u'',
- u'disk_gb': 0,
- u'display_name': u'testme',
- u'fixed_ips': [{u'address': u'10.0.0.2',
- u'floating_ips': [],
- u'meta': {},
- u'type': u'fixed',
- u'version': 4}],
- u'image_ref_url': u'http://10.0.2.15:9292/images/UUID',
- u'instance_id': u'9f9d01b9-4a58-4271-9e27-398b21ab20d1',
- u'instance_type': u'm1.tiny',
- u'instance_type_id': 2,
- u'launched_at': u'2012-05-08 20:23:47.985999',
- u'memory_mb': 512,
- u'state': u'active',
- u'state_description': u'',
- u'tenant_id': u'7c150a59fe714e6f9263774af9688f0e',
- u'user_id': u'1e3ce043029547f1a61c1996d1a531a2',
- u'reservation_id': u'1e3ce043029547f1a61c1996d1a531a3',
- u'vcpus': 1,
- u'root_gb': 0,
- u'ephemeral_gb': 0,
- u'host': u'compute-host-name',
- u'availability_zone': u'1e3ce043029547f1a61c1996d1a531a4',
- u'os_type': u'linux?',
- u'architecture': u'x86',
- u'image_ref': u'UUID',
- u'kernel_id': u'1e3ce043029547f1a61c1996d1a531a5',
- u'ramdisk_id': u'1e3ce043029547f1a61c1996d1a531a6',
+ 'created_at': '2012-05-08 20:23:41',
+ 'deleted_at': '',
+ 'disk_gb': 0,
+ 'display_name': 'testme',
+ 'fixed_ips': [{'address': '10.0.0.2',
+ 'floating_ips': [],
+ 'meta': {},
+ 'type': 'fixed',
+ 'version': 4}],
+ 'image_ref_url': 'http://10.0.2.15:9292/images/UUID',
+ 'instance_id': '9f9d01b9-4a58-4271-9e27-398b21ab20d1',
+ 'instance_type': 'm1.tiny',
+ 'instance_type_id': 2,
+ 'launched_at': '2012-05-08 20:23:47.985999',
+ 'memory_mb': 512,
+ 'state': 'active',
+ 'state_description': '',
+ 'tenant_id': '7c150a59fe714e6f9263774af9688f0e',
+ 'user_id': '1e3ce043029547f1a61c1996d1a531a2',
+ 'reservation_id': '1e3ce043029547f1a61c1996d1a531a3',
+ 'vcpus': 1,
+ 'root_gb': 0,
+ 'ephemeral_gb': 0,
+ 'host': 'compute-host-name',
+ 'availability_zone': '1e3ce043029547f1a61c1996d1a531a4',
+ 'os_type': 'linux?',
+ 'architecture': 'x86',
+ 'image_ref': 'UUID',
+ 'kernel_id': '1e3ce043029547f1a61c1996d1a531a5',
+ 'ramdisk_id': '1e3ce043029547f1a61c1996d1a531a6',
}
diff --git a/ceilometer/tests/unit/test_sample.py b/ceilometer/tests/unit/test_sample.py
index cf70358b..c947e6b3 100644
--- a/ceilometer/tests/unit/test_sample.py
+++ b/ceilometer/tests/unit/test_sample.py
@@ -39,13 +39,13 @@ class TestSample(base.BaseTestCase):
def test_sample_from_notifications_list(self):
msg = {
- 'event_type': u'sample.create',
+ 'event_type': 'sample.create',
'metadata': {
- 'timestamp': u'2015-06-19T09:19:35.786893',
- 'message_id': u'939823de-c242-45a2-a399-083f4d6a8c3e'},
- 'payload': [{u'counter_name': u'instance100'}],
+ 'timestamp': '2015-06-19T09:19:35.786893',
+ 'message_id': '939823de-c242-45a2-a399-083f4d6a8c3e'},
+ 'payload': [{'counter_name': 'instance100'}],
'priority': 'info',
- 'publisher_id': u'ceilometer.api',
+ 'publisher_id': 'ceilometer.api',
}
s = sample.Sample.from_notification(
'sample', 'type', 1.0, '%', 'user', 'project', 'res', msg)
@@ -55,13 +55,13 @@ class TestSample(base.BaseTestCase):
def test_sample_from_notifications_dict(self):
msg = {
- 'event_type': u'sample.create',
+ 'event_type': 'sample.create',
'metadata': {
- 'timestamp': u'2015-06-19T09:19:35.786893',
- 'message_id': u'939823de-c242-45a2-a399-083f4d6a8c3e'},
- 'payload': {u'counter_name': u'instance100'},
+ 'timestamp': '2015-06-19T09:19:35.786893',
+ 'message_id': '939823de-c242-45a2-a399-083f4d6a8c3e'},
+ 'payload': {'counter_name': 'instance100'},
'priority': 'info',
- 'publisher_id': u'ceilometer.api',
+ 'publisher_id': 'ceilometer.api',
}
s = sample.Sample.from_notification(
'sample', 'type', 1.0, '%', 'user', 'project', 'res', msg)
@@ -71,13 +71,13 @@ class TestSample(base.BaseTestCase):
def test_sample_from_notifications_assume_utc(self):
msg = {
- 'event_type': u'sample.create',
+ 'event_type': 'sample.create',
'metadata': {
- 'timestamp': u'2015-06-19T09:19:35.786893',
- 'message_id': u'939823de-c242-45a2-a399-083f4d6a8c3e'},
- 'payload': {u'counter_name': u'instance100'},
+ 'timestamp': '2015-06-19T09:19:35.786893',
+ 'message_id': '939823de-c242-45a2-a399-083f4d6a8c3e'},
+ 'payload': {'counter_name': 'instance100'},
'priority': 'info',
- 'publisher_id': u'ceilometer.api',
+ 'publisher_id': 'ceilometer.api',
}
s = sample.Sample.from_notification(
'sample', 'type', 1.0, '%', 'user', 'project', 'res', msg)
@@ -85,13 +85,13 @@ class TestSample(base.BaseTestCase):
def test_sample_from_notifications_keep_tz(self):
msg = {
- 'event_type': u'sample.create',
+ 'event_type': 'sample.create',
'metadata': {
- 'timestamp': u'2015-06-19T09:19:35.786893+01:00',
- 'message_id': u'939823de-c242-45a2-a399-083f4d6a8c3e'},
- 'payload': {u'counter_name': u'instance100'},
+ 'timestamp': '2015-06-19T09:19:35.786893+01:00',
+ 'message_id': '939823de-c242-45a2-a399-083f4d6a8c3e'},
+ 'payload': {'counter_name': 'instance100'},
'priority': 'info',
- 'publisher_id': u'ceilometer.api',
+ 'publisher_id': 'ceilometer.api',
}
s = sample.Sample.from_notification(
'sample', 'type', 1.0, '%', 'user', 'project', 'res', msg)
diff --git a/ceilometer/tests/unit/volume/test_cinder.py b/ceilometer/tests/unit/volume/test_cinder.py
index 4473f84b..d528e1b0 100644
--- a/ceilometer/tests/unit/volume/test_cinder.py
+++ b/ceilometer/tests/unit/volume/test_cinder.py
@@ -18,38 +18,38 @@ from ceilometer.volume import cinder
VOLUME_LIST = [
type('Volume', (object,),
- {u'migration_status': None,
- u'attachments': [
- {u'server_id': u'1ae69721-d071-4156-a2bd-b11bb43ec2e3',
- u'attachment_id': u'f903d95e-f999-4a34-8be7-119eadd9bb4f',
- u'attached_at': u'2016-07-14T03:55:57.000000',
- u'host_name': None,
- u'volume_id': u'd94c18fb-b680-4912-9741-da69ee83c94f',
- u'device': u'/dev/vdb',
- u'id': u'd94c18fb-b680-4912-9741-da69ee83c94f'}],
- u'links': [{
- u'href': u'http://fake_link3',
- u'rel': u'self'},
+ {'migration_status': None,
+ 'attachments': [
+ {'server_id': '1ae69721-d071-4156-a2bd-b11bb43ec2e3',
+ 'attachment_id': 'f903d95e-f999-4a34-8be7-119eadd9bb4f',
+ 'attached_at': '2016-07-14T03:55:57.000000',
+ 'host_name': None,
+ 'volume_id': 'd94c18fb-b680-4912-9741-da69ee83c94f',
+ 'device': '/dev/vdb',
+ 'id': 'd94c18fb-b680-4912-9741-da69ee83c94f'}],
+ 'links': [{
+ 'href': 'http://fake_link3',
+ 'rel': 'self'},
{
- u'href': u'http://fake_link4',
- u'rel': u'bookmark'}],
- u'availability_zone': u'nova',
- u'os-vol-host-attr:host': u'test@lvmdriver-1#lvmdriver-1',
- u'encrypted': False,
- u'updated_at': u'2016-07-14T03:55:57.000000',
- u'replication_status': u'disabled',
- u'snapshot_id': None,
- u'id': u'd94c18fb-b680-4912-9741-da69ee83c94f',
- u'size': 1,
- u'user_id': u'be255bd31eb944578000fc762fde6dcf',
- u'os-vol-tenant-attr:tenant_id': u'6824974c08974d4db864bbaa6bc08303',
- u'os-vol-mig-status-attr:migstat': None,
- u'metadata': {u'readonly': u'False', u'attached_mode': u'rw'},
- u'status': u'in-use',
- u'description': None,
- u'multiattach': False,
- u'source_volid': None,
- u'consistencygroup_id': None,
+ 'href': 'http://fake_link4',
+ 'rel': 'bookmark'}],
+ 'availability_zone': 'nova',
+ 'os-vol-host-attr:host': 'test@lvmdriver-1#lvmdriver-1',
+ 'encrypted': False,
+ 'updated_at': '2016-07-14T03:55:57.000000',
+ 'replication_status': 'disabled',
+ 'snapshot_id': None,
+ 'id': 'd94c18fb-b680-4912-9741-da69ee83c94f',
+ 'size': 1,
+ 'user_id': 'be255bd31eb944578000fc762fde6dcf',
+ 'os-vol-tenant-attr:tenant_id': '6824974c08974d4db864bbaa6bc08303',
+ 'os-vol-mig-status-attr:migstat': None,
+ 'metadata': {'readonly': 'False', 'attached_mode': 'rw'},
+ 'status': 'in-use',
+ 'description': None,
+ 'multiattach': False,
+ 'source_volid': None,
+ 'consistencygroup_id': None,
u"volume_image_metadata": {
u"checksum": u"17d9daa4fb8e20b0f6b7dec0d46fdddf",
u"container_format": u"bare",
@@ -62,27 +62,27 @@ VOLUME_LIST = [
u"min_ram": u"0",
u"size": u"1572864000"
},
- u'os-vol-mig-status-attr:name_id': None,
- u'name': None,
- u'bootable': u'false',
- u'created_at': u'2016-06-23T08:27:45.000000',
- u'volume_type': u'lvmdriver-1'})
+ 'os-vol-mig-status-attr:name_id': None,
+ 'name': None,
+ 'bootable': 'false',
+ 'created_at': '2016-06-23T08:27:45.000000',
+ 'volume_type': 'lvmdriver-1'})
]
SNAPSHOT_LIST = [
type('VolumeSnapshot', (object,),
- {u'status': u'available',
- u'os-extended-snapshot-attributes:progress': u'100%',
- u'description': None,
- u'os-extended-snapshot-attributes:project_id':
- u'6824974c08974d4db864bbaa6bc08303',
- u'size': 1,
- u'user_id': u'be255bd31eb944578000fc762fde6dcf',
- u'updated_at': u'2016-10-19T07:56:55.000000',
- u'id': u'b1ea6783-f952-491e-a4ed-23a6a562e1cf',
- u'volume_id': u'6f27bc42-c834-49ea-ae75-8d1073b37806',
- u'metadata': {},
- u'created_at': u'2016-10-19T07:56:55.000000',
+ {'status': 'available',
+ 'os-extended-snapshot-attributes:progress': '100%',
+ 'description': None,
+ 'os-extended-snapshot-attributes:project_id':
+ '6824974c08974d4db864bbaa6bc08303',
+ 'size': 1,
+ 'user_id': 'be255bd31eb944578000fc762fde6dcf',
+ 'updated_at': '2016-10-19T07:56:55.000000',
+ 'id': 'b1ea6783-f952-491e-a4ed-23a6a562e1cf',
+ 'volume_id': '6f27bc42-c834-49ea-ae75-8d1073b37806',
+ 'metadata': {},
+ 'created_at': '2016-10-19T07:56:55.000000',
u"volume_image_metadata": {
u"checksum": u"17d9daa4fb8e20b0f6b7dec0d46fdddf",
u"container_format": u"bare",
@@ -95,34 +95,34 @@ SNAPSHOT_LIST = [
u"min_ram": u"0",
u"size": u"1572864000"
},
- u'name': None})
+ 'name': None})
]
BACKUP_LIST = [
type('VolumeBackup', (object,),
- {u'status': u'available',
- u'object_count': 0,
- u'container': None,
- u'name': None,
- u'links': [{
- u'href': u'http://fake_urla',
- u'rel': u'self'}, {
- u'href': u'http://fake_urlb',
- u'rel': u'bookmark'}],
- u'availability_zone': u'nova',
- u'created_at': u'2016-10-19T06:55:23.000000',
- u'snapshot_id': None,
- u'updated_at': u'2016-10-19T06:55:23.000000',
- u'data_timestamp': u'2016-10-19T06:55:23.000000',
- u'description': None,
- u'has_dependent_backups': False,
- u'volume_id': u'6f27bc42-c834-49ea-ae75-8d1073b37806',
- u'os-backup-project-attr:project_id':
- u'6824974c08974d4db864bbaa6bc08303',
- u'fail_reason': u"",
- u'is_incremental': False,
- u'id': u'75a52125-85ff-4a8d-b2aa-580f3b22273f',
- u'size': 1})
+ {'status': 'available',
+ 'object_count': 0,
+ 'container': None,
+ 'name': None,
+ 'links': [{
+ 'href': 'http://fake_urla',
+ 'rel': 'self'}, {
+ 'href': 'http://fake_urlb',
+ 'rel': 'bookmark'}],
+ 'availability_zone': 'nova',
+ 'created_at': '2016-10-19T06:55:23.000000',
+ 'snapshot_id': None,
+ 'updated_at': '2016-10-19T06:55:23.000000',
+ 'data_timestamp': '2016-10-19T06:55:23.000000',
+ 'description': None,
+ 'has_dependent_backups': False,
+ 'volume_id': '6f27bc42-c834-49ea-ae75-8d1073b37806',
+ 'os-backup-project-attr:project_id':
+ '6824974c08974d4db864bbaa6bc08303',
+ 'fail_reason': u"",
+ 'is_incremental': False,
+ 'id': '75a52125-85ff-4a8d-b2aa-580f3b22273f',
+ 'size': 1})
]