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( 'billing.openstack.common.notification.%s' % message['event_type']) getattr(logger, priority)(jsonutils.dumps(message))
# 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 inspect import uuid from billing.openstack.common import cfg from billing.openstack.common import context from billing.openstack.common import importutils from billing.openstack.common import jsonutils from billing.openstack.common import log as logging from billing.openstack.common import timeutils LOG = logging.getLogger(__name__) notifier_opts = [ cfg.StrOpt('notification_driver', default='billing.openstack.common.notifier.no_op_notifier', help='Default driver for sending notifications'), cfg.StrOpt('default_notification_level', default='INFO', help='Default notification level for outgoing notifications'), cfg.StrOpt('default_publisher_id', default='$host', help='Default publisher_id for outgoing notifications'), ] CONF = cfg.CONF CONF.register_opts(notifier_opts)
# under the License. """ Price controller. """ import datetime import math from billing.common import timeutils from billing import exception from billing.openstack import nova as nova_client from billing.openstack.common import cfg from billing.openstack.common import log LOG = log.getLogger(__name__) price_opts = [ cfg.ListOpt('supported_items', default=['cpu', 'memory'], help='List of items supported for record.'), cfg.StrOpt('cpu_price', default=1, help='Per cpu price per minute'), cfg.StrOpt('memory_price', default=1, help='512M memory price per minute'), ] CONF = cfg.CONF CONF.register_opts(price_opts)