Switch to a custom NotImplementedError
Some drivers/modules might raise NotImplementedError whereas we would expect things to work. Skipping test when such an error is raised would be a bad idea, we would know the test failed. So let's switch to a custom NotImplementedError and let's skip test only if this one is raised. Closes-Bug: #1369556 Change-Id: Ie88a281787218f9aba13b6e662eb4d49d3e685d0
This commit is contained in:
parent
500388c3fe
commit
62008d4e5b
@ -0,0 +1,22 @@
|
||||
# Copyright 2014 eNovance
|
||||
#
|
||||
# Authors: Julien Danjou <julien@danjou.info>
|
||||
#
|
||||
# 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.
|
||||
|
||||
|
||||
class NotImplementedError(NotImplementedError):
|
||||
# FIXME(jd) This is used by WSME to return a correct HTTP code. We should
|
||||
# not expose it here but wrap our methods in the API to convert it to a
|
||||
# proper HTTP error.
|
||||
code = 501
|
@ -17,6 +17,7 @@
|
||||
# under the License.
|
||||
"""Base classes for storage engines
|
||||
"""
|
||||
import ceilometer
|
||||
|
||||
|
||||
class Connection(object):
|
||||
@ -46,7 +47,7 @@ class Connection(object):
|
||||
def get_alarms(name=None, user=None, state=None, meter=None,
|
||||
project=None, enabled=None, alarm_id=None, pagination=None):
|
||||
"""Yields a lists of alarms that match filters."""
|
||||
raise NotImplementedError('Alarms not implemented')
|
||||
raise ceilometer.NotImplementedError('Alarms not implemented')
|
||||
|
||||
@staticmethod
|
||||
def create_alarm(alarm):
|
||||
@ -54,17 +55,17 @@ class Connection(object):
|
||||
|
||||
:param alarm: The alarm to create.
|
||||
"""
|
||||
raise NotImplementedError('Alarms not implemented')
|
||||
raise ceilometer.NotImplementedError('Alarms not implemented')
|
||||
|
||||
@staticmethod
|
||||
def update_alarm(alarm):
|
||||
"""Update alarm."""
|
||||
raise NotImplementedError('Alarms not implemented')
|
||||
raise ceilometer.NotImplementedError('Alarms not implemented')
|
||||
|
||||
@staticmethod
|
||||
def delete_alarm(alarm_id):
|
||||
"""Delete an alarm."""
|
||||
raise NotImplementedError('Alarms not implemented')
|
||||
raise ceilometer.NotImplementedError('Alarms not implemented')
|
||||
|
||||
@staticmethod
|
||||
def get_alarm_changes(alarm_id, on_behalf_of,
|
||||
@ -94,12 +95,12 @@ class Connection(object):
|
||||
:param end_timestamp: Optional modified timestamp end range
|
||||
:param end_timestamp_op: Optional timestamp end range operation
|
||||
"""
|
||||
raise NotImplementedError('Alarm history not implemented')
|
||||
raise ceilometer.NotImplementedError('Alarm history not implemented')
|
||||
|
||||
@staticmethod
|
||||
def record_alarm_change(alarm_change):
|
||||
"""Record alarm change event."""
|
||||
raise NotImplementedError('Alarm history not implemented')
|
||||
raise ceilometer.NotImplementedError('Alarm history not implemented')
|
||||
|
||||
@staticmethod
|
||||
def clear():
|
||||
@ -114,7 +115,7 @@ class Connection(object):
|
||||
:param limit: Maximum number of results to return.
|
||||
"""
|
||||
|
||||
raise NotImplementedError('Complex query for alarms '
|
||||
raise ceilometer.NotImplementedError('Complex query for alarms '
|
||||
'is not implemented.')
|
||||
|
||||
@staticmethod
|
||||
@ -126,7 +127,7 @@ class Connection(object):
|
||||
:param limit: Maximum number of results to return.
|
||||
"""
|
||||
|
||||
raise NotImplementedError('Complex query for alarms '
|
||||
raise ceilometer.NotImplementedError('Complex query for alarms '
|
||||
'history is not implemented.')
|
||||
|
||||
@classmethod
|
||||
|
@ -19,6 +19,7 @@ import happybase
|
||||
from oslo.utils import netutils
|
||||
from six.moves.urllib import parse as urlparse
|
||||
|
||||
import ceilometer
|
||||
from ceilometer.alarm.storage import base
|
||||
from ceilometer.alarm.storage import models
|
||||
from ceilometer.openstack.common.gettextutils import _
|
||||
@ -178,9 +179,10 @@ class Connection(base.Connection):
|
||||
project=None, enabled=None, alarm_id=None, pagination=None):
|
||||
|
||||
if pagination:
|
||||
raise NotImplementedError('Pagination not implemented')
|
||||
raise ceilometer.NotImplementedError('Pagination not implemented')
|
||||
if meter:
|
||||
raise NotImplementedError('Filter by meter not implemented')
|
||||
raise ceilometer.NotImplementedError(
|
||||
'Filter by meter not implemented')
|
||||
|
||||
q = hbase_utils.make_query(alarm_id=alarm_id, name=name,
|
||||
enabled=enabled, user_id=user,
|
||||
|
@ -24,6 +24,7 @@ from oslo.db.sqlalchemy import migration
|
||||
from oslo.db.sqlalchemy import session as db_session
|
||||
from sqlalchemy import desc
|
||||
|
||||
import ceilometer
|
||||
from ceilometer.alarm.storage import base
|
||||
from ceilometer.alarm.storage import models as alarm_api_models
|
||||
from ceilometer.openstack.common import log
|
||||
@ -153,7 +154,7 @@ class Connection(base.Connection):
|
||||
"""
|
||||
|
||||
if pagination:
|
||||
raise NotImplementedError('Pagination not implemented')
|
||||
raise ceilometer.NotImplementedError('Pagination not implemented')
|
||||
|
||||
session = self._engine_facade.get_session()
|
||||
query = session.query(models.Alarm)
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
import pymongo
|
||||
|
||||
import ceilometer
|
||||
from ceilometer.alarm.storage import base
|
||||
from ceilometer.alarm.storage import models
|
||||
from ceilometer.openstack.common import log
|
||||
@ -92,7 +93,7 @@ class Connection(base.Connection):
|
||||
:param pagination: Optional pagination query.
|
||||
"""
|
||||
if pagination:
|
||||
raise NotImplementedError('Pagination not implemented')
|
||||
raise ceilometer.NotImplementedError('Pagination not implemented')
|
||||
|
||||
q = {}
|
||||
if user is not None:
|
||||
|
@ -47,6 +47,7 @@ import wsme
|
||||
from wsme import types as wtypes
|
||||
import wsmeext.pecan as wsme_pecan
|
||||
|
||||
import ceilometer
|
||||
from ceilometer.alarm import service as alarm_service
|
||||
from ceilometer.alarm.storage import models as alarm_models
|
||||
from ceilometer.api import acl
|
||||
@ -1990,7 +1991,7 @@ class AlarmController(rest.RestController):
|
||||
|
||||
try:
|
||||
self.conn.record_alarm_change(payload)
|
||||
except NotImplementedError:
|
||||
except ceilometer.NotImplementedError:
|
||||
pass
|
||||
|
||||
# Revert to the pre-json'ed details ...
|
||||
@ -2146,7 +2147,7 @@ class AlarmsController(rest.RestController):
|
||||
|
||||
try:
|
||||
conn.record_alarm_change(payload)
|
||||
except NotImplementedError:
|
||||
except ceilometer.NotImplementedError:
|
||||
pass
|
||||
|
||||
# Revert to the pre-json'ed details ...
|
||||
|
@ -16,7 +16,7 @@
|
||||
# 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 ceilometer
|
||||
from ceilometer.compute import plugin
|
||||
from ceilometer.compute.pollsters import util
|
||||
from ceilometer.compute.virt import inspector as virt_inspector
|
||||
@ -50,7 +50,7 @@ class CPUPollster(plugin.ComputePollster):
|
||||
except virt_inspector.InstanceNotFoundException as err:
|
||||
# Instance was deleted while getting samples. Ignore it.
|
||||
LOG.debug(_('Exception while getting samples %s'), err)
|
||||
except NotImplementedError:
|
||||
except ceilometer.NotImplementedError:
|
||||
# Selected inspector does not implement this pollster.
|
||||
LOG.debug(_('Obtaining CPU time is not implemented for %s'
|
||||
), manager.inspector.__class__.__name__)
|
||||
@ -81,7 +81,7 @@ class CPUUtilPollster(plugin.ComputePollster):
|
||||
except virt_inspector.InstanceNotFoundException as err:
|
||||
# Instance was deleted while getting samples. Ignore it.
|
||||
LOG.debug(_('Exception while getting samples %s'), err)
|
||||
except NotImplementedError:
|
||||
except ceilometer.NotImplementedError:
|
||||
# Selected inspector does not implement this pollster.
|
||||
LOG.debug(_('Obtaining CPU Util is not implemented for %s'),
|
||||
manager.inspector.__class__.__name__)
|
||||
|
@ -23,6 +23,7 @@ import collections
|
||||
|
||||
import six
|
||||
|
||||
import ceilometer
|
||||
from ceilometer.compute import plugin
|
||||
from ceilometer.compute.pollsters import util
|
||||
from ceilometer.compute.virt import inspector as virt_inspector
|
||||
@ -119,7 +120,7 @@ class _Base(plugin.ComputePollster):
|
||||
except virt_inspector.InstanceNotFoundException as err:
|
||||
# Instance was deleted while getting samples. Ignore it.
|
||||
LOG.debug(_('Exception while getting samples %s'), err)
|
||||
except NotImplementedError:
|
||||
except ceilometer.NotImplementedError:
|
||||
# Selected inspector does not implement this pollster.
|
||||
LOG.debug(_('%(inspector)s does not provide data for '
|
||||
' %(pollster)s'),
|
||||
@ -324,7 +325,7 @@ class _DiskRatesPollsterBase(plugin.ComputePollster):
|
||||
except virt_inspector.InstanceNotFoundException as err:
|
||||
# Instance was deleted while getting samples. Ignore it.
|
||||
LOG.debug(_('Exception while getting samples %s'), err)
|
||||
except NotImplementedError:
|
||||
except ceilometer.NotImplementedError:
|
||||
# Selected inspector does not implement this pollster.
|
||||
LOG.debug(_('%(inspector)s does not provide data for '
|
||||
' %(pollster)s'),
|
||||
|
@ -12,7 +12,7 @@
|
||||
# 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 ceilometer
|
||||
from ceilometer.compute import plugin
|
||||
from ceilometer.compute.pollsters import util
|
||||
from ceilometer.compute.virt import inspector as virt_inspector
|
||||
@ -45,7 +45,7 @@ class MemoryUsagePollster(plugin.ComputePollster):
|
||||
except virt_inspector.InstanceNotFoundException as err:
|
||||
# Instance was deleted while getting samples. Ignore it.
|
||||
LOG.debug(_('Exception while getting samples %s'), err)
|
||||
except NotImplementedError:
|
||||
except ceilometer.NotImplementedError:
|
||||
# Selected inspector does not implement this pollster.
|
||||
LOG.debug(_('Obtaining Memory Usage is not implemented for %s'
|
||||
), manager.inspector.__class__.__name__)
|
||||
|
@ -21,6 +21,7 @@ import copy
|
||||
|
||||
from oslo.utils import timeutils
|
||||
|
||||
import ceilometer
|
||||
from ceilometer.compute import plugin
|
||||
from ceilometer.compute.pollsters import util
|
||||
from ceilometer.compute.virt import inspector as virt_inspector
|
||||
@ -104,7 +105,7 @@ class _Base(plugin.ComputePollster):
|
||||
except virt_inspector.InstanceNotFoundException as err:
|
||||
# Instance was deleted while getting samples. Ignore it.
|
||||
LOG.debug(_('Exception while getting samples %s'), err)
|
||||
except NotImplementedError:
|
||||
except ceilometer.NotImplementedError:
|
||||
# Selected inspector does not implement this pollster.
|
||||
LOG.debug(_('%(inspector)s does not provide data for '
|
||||
' %(pollster)s'),
|
||||
|
@ -22,6 +22,7 @@ import collections
|
||||
from oslo.config import cfg
|
||||
from stevedore import driver
|
||||
|
||||
import ceilometer
|
||||
from ceilometer.openstack.common.gettextutils import _
|
||||
from ceilometer.openstack.common import log
|
||||
|
||||
@ -148,7 +149,7 @@ class Inspector(object):
|
||||
|
||||
def inspect_instances(self):
|
||||
"""List the instances on the current host."""
|
||||
raise NotImplementedError()
|
||||
raise ceilometer.NotImplementedError
|
||||
|
||||
def inspect_cpus(self, instance_name):
|
||||
"""Inspect the CPU statistics for an instance.
|
||||
@ -156,7 +157,7 @@ class Inspector(object):
|
||||
:param instance_name: the name of the target instance
|
||||
:return: the number of CPUs and cumulative CPU time
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
raise ceilometer.NotImplementedError
|
||||
|
||||
def inspect_cpu_util(self, instance, duration=None):
|
||||
"""Inspect the CPU Utilization (%) for an instance.
|
||||
@ -166,7 +167,7 @@ class Inspector(object):
|
||||
inspected
|
||||
:return: the percentage of CPU utilization
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
raise ceilometer.NotImplementedError
|
||||
|
||||
def inspect_vnics(self, instance_name):
|
||||
"""Inspect the vNIC statistics for an instance.
|
||||
@ -175,7 +176,7 @@ class Inspector(object):
|
||||
:return: for each vNIC, the number of bytes & packets
|
||||
received and transmitted
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
raise ceilometer.NotImplementedError
|
||||
|
||||
def inspect_vnic_rates(self, instance, duration=None):
|
||||
"""Inspect the vNIC rate statistics for an instance.
|
||||
@ -186,7 +187,7 @@ class Inspector(object):
|
||||
:return: for each vNIC, the rate of bytes & packets
|
||||
received and transmitted
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
raise ceilometer.NotImplementedError
|
||||
|
||||
def inspect_disks(self, instance_name):
|
||||
"""Inspect the disk statistics for an instance.
|
||||
@ -195,7 +196,7 @@ class Inspector(object):
|
||||
:return: for each disk, the number of bytes & operations
|
||||
read and written, and the error count
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
raise ceilometer.NotImplementedError
|
||||
|
||||
def inspect_memory_usage(self, instance, duration=None):
|
||||
"""Inspect the memory usage statistics for an instance.
|
||||
@ -205,7 +206,7 @@ class Inspector(object):
|
||||
inspected
|
||||
:return: the amount of memory used
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
raise ceilometer.NotImplementedError
|
||||
|
||||
def inspect_disk_rates(self, instance, duration=None):
|
||||
"""Inspect the disk statistics as rates for an instance.
|
||||
@ -216,7 +217,7 @@ class Inspector(object):
|
||||
:return: for each disk, the number of bytes & operations
|
||||
read and written per second, with the error count
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
raise ceilometer.NotImplementedError
|
||||
|
||||
|
||||
def get_hypervisor_inspector():
|
||||
|
@ -21,6 +21,7 @@ from oslo.config import cfg
|
||||
import oslo.messaging
|
||||
from stevedore import extension
|
||||
|
||||
import ceilometer
|
||||
from ceilometer import dispatcher
|
||||
from ceilometer.event import converter as event_converter
|
||||
from ceilometer import messaging
|
||||
@ -66,7 +67,7 @@ class EventsNotificationEndpoint(object):
|
||||
try:
|
||||
problem_events.extend(
|
||||
dispatcher_ext.obj.record_events(event))
|
||||
except NotImplementedError:
|
||||
except ceilometer.NotImplementedError:
|
||||
LOG.warn(_('Event is not implemented with the storage'
|
||||
' backend'))
|
||||
if models.Event.UNKNOWN_PROBLEM in [x[0] for x in problem_events]:
|
||||
|
@ -25,6 +25,8 @@ from oslo.utils import timeutils
|
||||
import six
|
||||
from six import moves
|
||||
|
||||
import ceilometer
|
||||
|
||||
|
||||
def iter_period(start, end, period):
|
||||
"""Split a time from start to end in periods of a number of seconds.
|
||||
@ -188,7 +190,8 @@ class Connection(object):
|
||||
|
||||
All timestamps must be naive utc datetime object.
|
||||
"""
|
||||
raise NotImplementedError('Projects not implemented')
|
||||
raise ceilometer.NotImplementedError(
|
||||
'Recording metering data is not implemented')
|
||||
|
||||
@staticmethod
|
||||
def clear_expired_metering_data(ttl):
|
||||
@ -198,7 +201,8 @@ class Connection(object):
|
||||
|
||||
:param ttl: Number of seconds to keep records for.
|
||||
"""
|
||||
raise NotImplementedError('Clearing samples not implemented')
|
||||
raise ceilometer.NotImplementedError(
|
||||
'Clearing samples not implemented')
|
||||
|
||||
@staticmethod
|
||||
def get_resources(user=None, project=None, source=None,
|
||||
@ -219,7 +223,7 @@ class Connection(object):
|
||||
:param resource: Optional resource filter.
|
||||
:param pagination: Optional pagination query.
|
||||
"""
|
||||
raise NotImplementedError('Resources not implemented')
|
||||
raise ceilometer.NotImplementedError('Resources not implemented')
|
||||
|
||||
@staticmethod
|
||||
def get_meters(user=None, project=None, resource=None, source=None,
|
||||
@ -234,7 +238,7 @@ class Connection(object):
|
||||
:param metaquery: Optional dict with metadata to match on.
|
||||
:param pagination: Optional pagination query.
|
||||
"""
|
||||
raise NotImplementedError('Meters not implemented')
|
||||
raise ceilometer.NotImplementedError('Meters not implemented')
|
||||
|
||||
@staticmethod
|
||||
def get_samples(sample_filter, limit=None):
|
||||
@ -243,7 +247,7 @@ class Connection(object):
|
||||
:param sample_filter: Filter.
|
||||
:param limit: Maximum number of results to return.
|
||||
"""
|
||||
raise NotImplementedError('Samples not implemented')
|
||||
raise ceilometer.NotImplementedError('Samples not implemented')
|
||||
|
||||
@staticmethod
|
||||
def get_meter_statistics(sample_filter, period=None, groupby=None,
|
||||
@ -252,7 +256,7 @@ class Connection(object):
|
||||
|
||||
The filter must have a meter value set.
|
||||
"""
|
||||
raise NotImplementedError('Statistics not implemented')
|
||||
raise ceilometer.NotImplementedError('Statistics not implemented')
|
||||
|
||||
@staticmethod
|
||||
def clear():
|
||||
@ -264,17 +268,17 @@ class Connection(object):
|
||||
|
||||
:param events: a list of model.Event objects.
|
||||
"""
|
||||
raise NotImplementedError('Events not implemented.')
|
||||
raise ceilometer.NotImplementedError('Events not implemented.')
|
||||
|
||||
@staticmethod
|
||||
def get_events(event_filter):
|
||||
"""Return an iterable of model.Event objects."""
|
||||
raise NotImplementedError('Events not implemented.')
|
||||
raise ceilometer.NotImplementedError('Events not implemented.')
|
||||
|
||||
@staticmethod
|
||||
def get_event_types():
|
||||
"""Return all event types as an iterable of strings."""
|
||||
raise NotImplementedError('Events not implemented.')
|
||||
raise ceilometer.NotImplementedError('Events not implemented.')
|
||||
|
||||
@staticmethod
|
||||
def get_trait_types(event_type):
|
||||
@ -284,7 +288,7 @@ class Connection(object):
|
||||
returned.
|
||||
:param event_type: the type of the Event
|
||||
"""
|
||||
raise NotImplementedError('Events not implemented.')
|
||||
raise ceilometer.NotImplementedError('Events not implemented.')
|
||||
|
||||
@staticmethod
|
||||
def get_traits(event_type, trait_type=None):
|
||||
@ -295,7 +299,7 @@ class Connection(object):
|
||||
:param trait_type: the name of the Trait to filter by
|
||||
"""
|
||||
|
||||
raise NotImplementedError('Events not implemented.')
|
||||
raise ceilometer.NotImplementedError('Events not implemented.')
|
||||
|
||||
@staticmethod
|
||||
def query_samples(filter_expr=None, orderby=None, limit=None):
|
||||
@ -306,7 +310,7 @@ class Connection(object):
|
||||
:param limit: Maximum number of results to return.
|
||||
"""
|
||||
|
||||
raise NotImplementedError('Complex query for samples '
|
||||
raise ceilometer.NotImplementedError('Complex query for samples '
|
||||
'is not implemented.')
|
||||
|
||||
@classmethod
|
||||
|
@ -18,6 +18,7 @@ import copy
|
||||
import re
|
||||
import six
|
||||
|
||||
import ceilometer
|
||||
from ceilometer.openstack.common.gettextutils import _
|
||||
from ceilometer.openstack.common import log
|
||||
|
||||
@ -111,7 +112,8 @@ class MTable(object):
|
||||
# in case of multiple filters
|
||||
rows = m(fargs, rows)
|
||||
else:
|
||||
raise NotImplementedError("%s filter is not implemented, "
|
||||
raise ceilometer.NotImplementedError(
|
||||
"%s filter is not implemented, "
|
||||
"you may want to add it!")
|
||||
for k in sorted(rows)[:limit]:
|
||||
yield k, rows[k]
|
||||
@ -195,7 +197,8 @@ class MTable(object):
|
||||
if g == row:
|
||||
r[row] = data
|
||||
else:
|
||||
raise NotImplementedError("In-memory "
|
||||
raise ceilometer.NotImplementedError(
|
||||
"In-memory "
|
||||
"RowFilter doesn't support "
|
||||
"the %s operation yet" % op)
|
||||
except AttributeError:
|
||||
@ -226,7 +229,8 @@ class MTable(object):
|
||||
(op == '<' and key < column)):
|
||||
r_data[key] = data[key]
|
||||
else:
|
||||
raise NotImplementedError("In-memory QualifierFilter "
|
||||
raise ceilometer.NotImplementedError(
|
||||
"In-memory QualifierFilter "
|
||||
"doesn't support the %s "
|
||||
"operation yet" % op)
|
||||
if r_data:
|
||||
|
@ -32,6 +32,7 @@ from oslo.utils import timeutils
|
||||
import pymongo
|
||||
import six
|
||||
|
||||
import ceilometer
|
||||
from ceilometer.openstack.common import log
|
||||
from ceilometer import storage
|
||||
from ceilometer.storage import base
|
||||
@ -252,7 +253,7 @@ class Connection(pymongo_base.Connection):
|
||||
:param pagination: Optional pagination query.
|
||||
"""
|
||||
if pagination:
|
||||
raise NotImplementedError('Pagination not implemented')
|
||||
raise ceilometer.NotImplementedError('Pagination not implemented')
|
||||
|
||||
metaquery = metaquery or {}
|
||||
|
||||
@ -313,10 +314,12 @@ class Connection(pymongo_base.Connection):
|
||||
if (groupby and
|
||||
set(groupby) - set(['user_id', 'project_id',
|
||||
'resource_id', 'source'])):
|
||||
raise NotImplementedError("Unable to group by these fields")
|
||||
raise ceilometer.NotImplementedError(
|
||||
"Unable to group by these fields")
|
||||
|
||||
if aggregate:
|
||||
raise NotImplementedError('Selectable aggregates not implemented')
|
||||
raise ceilometer.NotImplementedError(
|
||||
'Selectable aggregates not implemented')
|
||||
|
||||
q = pymongo_utils.make_query_from_filter(sample_filter)
|
||||
|
||||
|
@ -22,6 +22,7 @@ from oslo.utils import netutils
|
||||
from oslo.utils import timeutils
|
||||
from six.moves.urllib import parse as urlparse
|
||||
|
||||
import ceilometer
|
||||
from ceilometer.openstack.common.gettextutils import _
|
||||
from ceilometer.openstack.common import log
|
||||
from ceilometer.storage import base
|
||||
@ -276,7 +277,7 @@ class Connection(base.Connection):
|
||||
:param pagination: Optional pagination query.
|
||||
"""
|
||||
if pagination:
|
||||
raise NotImplementedError('Pagination not implemented')
|
||||
raise ceilometer.NotImplementedError('Pagination not implemented')
|
||||
|
||||
q = hbase_utils.make_query(metaquery=metaquery, user_id=user,
|
||||
project_id=project,
|
||||
@ -330,7 +331,8 @@ class Connection(base.Connection):
|
||||
metaquery = metaquery or {}
|
||||
|
||||
if pagination:
|
||||
raise NotImplementedError(_('Pagination not implemented'))
|
||||
raise ceilometer.NotImplementedError(
|
||||
_('Pagination not implemented'))
|
||||
with self.conn_pool.connection() as conn:
|
||||
resource_table = conn.table(self.RESOURCE_TABLE)
|
||||
q = hbase_utils.make_query(metaquery=metaquery, user_id=user,
|
||||
@ -423,10 +425,11 @@ class Connection(base.Connection):
|
||||
because of all the Thrift traffic it is going to create.
|
||||
"""
|
||||
if groupby:
|
||||
raise NotImplementedError("Group by not implemented.")
|
||||
raise ceilometer.NotImplementedError("Group by not implemented.")
|
||||
|
||||
if aggregate:
|
||||
raise NotImplementedError('Selectable aggregates not implemented')
|
||||
raise ceilometer.NotImplementedError(
|
||||
'Selectable aggregates not implemented')
|
||||
|
||||
with self.conn_pool.connection() as conn:
|
||||
meter_table = conn.table(self.METER_TABLE)
|
||||
|
@ -34,6 +34,7 @@ from oslo.utils import timeutils
|
||||
import pymongo
|
||||
import six
|
||||
|
||||
import ceilometer
|
||||
from ceilometer.openstack.common import log
|
||||
from ceilometer import storage
|
||||
from ceilometer.storage import base
|
||||
@ -791,7 +792,7 @@ class Connection(pymongo_base.Connection):
|
||||
:param pagination: Optional pagination query.
|
||||
"""
|
||||
if pagination:
|
||||
raise NotImplementedError('Pagination not implemented')
|
||||
raise ceilometer.NotImplementedError('Pagination not implemented')
|
||||
|
||||
metaquery = metaquery or {}
|
||||
|
||||
@ -837,7 +838,8 @@ class Connection(pymongo_base.Connection):
|
||||
params = dict(aggregate_param=a.param)
|
||||
fragments += (fragment_map[a.func] % params)
|
||||
else:
|
||||
raise NotImplementedError('Selectable aggregate function %s'
|
||||
raise ceilometer.NotImplementedError(
|
||||
'Selectable aggregate function %s'
|
||||
' is not supported' % a.func)
|
||||
|
||||
return fragments
|
||||
@ -852,7 +854,8 @@ class Connection(pymongo_base.Connection):
|
||||
if (groupby and
|
||||
set(groupby) - set(['user_id', 'project_id',
|
||||
'resource_id', 'source'])):
|
||||
raise NotImplementedError("Unable to group by these fields")
|
||||
raise ceilometer.NotImplementedError(
|
||||
"Unable to group by these fields")
|
||||
|
||||
q = pymongo_utils.make_query_from_filter(sample_filter)
|
||||
|
||||
|
@ -34,6 +34,7 @@ from sqlalchemy import distinct
|
||||
from sqlalchemy import func
|
||||
from sqlalchemy.orm import aliased
|
||||
|
||||
import ceilometer
|
||||
from ceilometer.openstack.common.gettextutils import _
|
||||
from ceilometer.openstack.common import jsonutils
|
||||
from ceilometer.openstack.common import log
|
||||
@ -114,7 +115,8 @@ def apply_metaquery_filter(session, query, metaquery):
|
||||
try:
|
||||
_model = sql_utils.META_TYPE_MAP[type(value)]
|
||||
except KeyError:
|
||||
raise NotImplementedError('Query on %(key)s is of %(value)s '
|
||||
raise ceilometer.NotImplementedError(
|
||||
'Query on %(key)s is of %(value)s '
|
||||
'type and is not supported' %
|
||||
{"key": k, "value": type(value)})
|
||||
else:
|
||||
@ -390,7 +392,7 @@ class Connection(base.Connection):
|
||||
:param pagination: Optional pagination query.
|
||||
"""
|
||||
if pagination:
|
||||
raise NotImplementedError('Pagination not implemented')
|
||||
raise ceilometer.NotImplementedError('Pagination not implemented')
|
||||
|
||||
s_filter = storage.SampleFilter(user=user,
|
||||
project=project,
|
||||
@ -457,7 +459,7 @@ class Connection(base.Connection):
|
||||
"""
|
||||
|
||||
if pagination:
|
||||
raise NotImplementedError('Pagination not implemented')
|
||||
raise ceilometer.NotImplementedError('Pagination not implemented')
|
||||
|
||||
s_filter = storage.SampleFilter(user=user,
|
||||
project=project,
|
||||
@ -590,7 +592,8 @@ class Connection(base.Connection):
|
||||
compute = PARAMETERIZED_AGGREGATES['compute'][a.func]
|
||||
functions.append(compute(a.param))
|
||||
else:
|
||||
raise NotImplementedError('Selectable aggregate function %s'
|
||||
raise ceilometer.NotImplementedError(
|
||||
'Selectable aggregate function %s'
|
||||
' is not supported' % a.func)
|
||||
|
||||
return functions
|
||||
@ -666,7 +669,7 @@ class Connection(base.Connection):
|
||||
if groupby:
|
||||
for group in groupby:
|
||||
if group not in ['user_id', 'project_id', 'resource_id']:
|
||||
raise NotImplementedError('Unable to group by '
|
||||
raise ceilometer.NotImplementedError('Unable to group by '
|
||||
'these fields')
|
||||
|
||||
if not period:
|
||||
|
@ -19,6 +19,7 @@
|
||||
"""
|
||||
import pymongo
|
||||
|
||||
import ceilometer
|
||||
from ceilometer.openstack.common.gettextutils import _
|
||||
from ceilometer.openstack.common import log
|
||||
from ceilometer.storage import base
|
||||
@ -67,7 +68,7 @@ class Connection(base.Connection):
|
||||
"""
|
||||
|
||||
if pagination:
|
||||
raise NotImplementedError('Pagination not implemented')
|
||||
raise ceilometer.NotImplementedError('Pagination not implemented')
|
||||
|
||||
metaquery = metaquery or {}
|
||||
|
||||
|
@ -24,6 +24,7 @@ from sqlalchemy import not_
|
||||
from sqlalchemy import or_
|
||||
from sqlalchemy.orm import aliased
|
||||
|
||||
import ceilometer
|
||||
from ceilometer.storage.sqlalchemy import models
|
||||
|
||||
|
||||
@ -79,7 +80,7 @@ class QueryTransformer(object):
|
||||
|
||||
def _handle_metadata(self, op, field_name, value):
|
||||
if op == self.operators["in"]:
|
||||
raise NotImplementedError('Metadata query with in '
|
||||
raise ceilometer.NotImplementedError('Metadata query with in '
|
||||
'operator is not implemented')
|
||||
|
||||
field_name = field_name[len('resource_metadata.'):]
|
||||
|
@ -27,7 +27,9 @@ from oslotest import base
|
||||
from oslotest import mockpatch
|
||||
import six
|
||||
from testtools import testcase
|
||||
import webtest
|
||||
|
||||
import ceilometer
|
||||
from ceilometer import messaging
|
||||
|
||||
|
||||
@ -95,11 +97,9 @@ def _skip_decorator(func):
|
||||
def skip_if_not_implemented(*args, **kwargs):
|
||||
try:
|
||||
return func(*args, **kwargs)
|
||||
except AssertionError:
|
||||
raise
|
||||
except NotImplementedError as e:
|
||||
except ceilometer.NotImplementedError as e:
|
||||
raise testcase.TestSkipped(six.text_type(e))
|
||||
except Exception as e:
|
||||
except webtest.app.AppError as e:
|
||||
if 'not implemented' in six.text_type(e):
|
||||
raise testcase.TestSkipped(six.text_type(e))
|
||||
raise
|
||||
|
@ -22,6 +22,7 @@ from oslo.config import fixture as fixture_config
|
||||
import oslo.messaging
|
||||
from stevedore import extension
|
||||
|
||||
import ceilometer
|
||||
from ceilometer.event import endpoint as event_endpoint
|
||||
from ceilometer.storage import models
|
||||
from ceilometer.tests import base as tests_base
|
||||
@ -108,7 +109,8 @@ class TestEventEndpoint(tests_base.BaseTestCase):
|
||||
|
||||
@mock.patch('ceilometer.event.endpoint.LOG')
|
||||
def test_event_not_implemented(self, log):
|
||||
self.mock_dispatcher.record_events.side_effect = NotImplementedError
|
||||
re = self.mock_dispatcher.record_events
|
||||
re.side_effect = ceilometer.NotImplementedError
|
||||
message = {'event_type': "foo", 'message_id': "abc"}
|
||||
ret = self.endpoint.process_notification(message)
|
||||
log.warn.assert_called_once_with(
|
||||
|
@ -25,6 +25,7 @@ import operator
|
||||
import mock
|
||||
from oslo.utils import timeutils
|
||||
|
||||
import ceilometer
|
||||
from ceilometer.alarm.storage import models as alarm_models
|
||||
from ceilometer.publisher import utils
|
||||
from ceilometer import sample
|
||||
@ -1536,7 +1537,7 @@ class StatisticsGroupByTest(DBTestBase,
|
||||
# error before list() is called. By using lambda, we can cover both
|
||||
# MongoDB and SQLAlchemy in a single test.
|
||||
self.assertRaises(
|
||||
NotImplementedError,
|
||||
ceilometer.NotImplementedError,
|
||||
lambda: list(self.conn.get_meter_statistics(f, groupby=['wtf']))
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user