def notify(_context, message): """Notifies the recipient of the desired event given the model. Log notifications using openstack's default logging system""" priority = message.get('priority', CONF.default_notification_level) priority = priority.lower() logger = logging.getLogger( 'magnetodb.openstack.common.notification.%s' % message['event_type']) getattr(logger, priority)(jsonutils.dumps(message))
def notify(_context, message): """Notifies the recipient of the desired event given the model. Log notifications using OpenStack's default logging system. """ priority = message.get('priority', CONF.default_notification_level) priority = priority.lower() logger = logging.getLogger( 'openstack.common.notification.%s' % message['event_type']) getattr(logger, priority)(jsonutils.dumps(message))
import json import binascii import time from cassandra import decoder from cassandra import AlreadyExists from magnetodb.common.cassandra import cluster from magnetodb.common.exception import BackendInteractionException from magnetodb.common.exception import TableNotExistsException from magnetodb.common.exception import TableAlreadyExistsException from magnetodb.openstack.common import importutils from magnetodb.openstack.common import log as logging from magnetodb.storage import models LOG = logging.getLogger(__name__) class CassandraStorageImpl(object): STORAGE_TO_CASSANDRA_TYPES = { models.ATTRIBUTE_TYPE_STRING: 'text', models.ATTRIBUTE_TYPE_NUMBER: 'decimal', models.ATTRIBUTE_TYPE_BLOB: 'blob', models.ATTRIBUTE_TYPE_STRING_SET: 'set<text>', models.ATTRIBUTE_TYPE_NUMBER_SET: 'set<decimal>', models.ATTRIBUTE_TYPE_BLOB_SET: 'set<blob>' } CASSANDRA_TO_STORAGE_TYPES = {val: key for key, val in STORAGE_TO_CASSANDRA_TYPES.iteritems()}
# 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 magnetodb.openstack.common import exception as openstack_exception from magnetodb.openstack.common import log as logging LOG = logging.getLogger(__name__) class MagnetoError(openstack_exception.OpenstackException): """Base exception that all custom MagnetoDB app exceptions inherit from.""" def __init__(self, message=None, **kwargs): if message is not None: self.message = message super(MagnetoError, self).__init__(**kwargs) class BackendInteractionException(MagnetoError): pass