Example #1
0
 def _run(self, application, socket):
     """Start a WSGI server in a new green thread."""
     logger = logging.getLogger('eventlet.wsgi')
     eventlet.wsgi.server(socket,
                          application,
                          custom_pool=self.tg.pool,
                          log=logging.WritableLogger(logger))
Example #2
0
 def _run(self, application, socket):
     """Start a WSGI server in a new green thread."""
     logger = logging.getLogger('eventlet.wsgi')
     eventlet.wsgi.server(socket,
                          application,
                          custom_pool=self.tg.pool,
                          log=logging.WritableLogger(logger))
Example #3
0
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('qonos.openstack.common.notification.%s' %
                               message['event_type'])
    getattr(logger, priority)(jsonutils.dumps(message))
Example #4
0
    def run(self, run_once=False):
        LOG.debug(_('Starting qonos-api service'))
        # This must be done after the 'well-known' config options are loaded
        # so the list of action_overrides can be read
        self.register_action_override_cfg_opts()
        wsgi_logger = logging.getLogger('eventlet.wsgi.server')

        wsgi.run_server(self.app, CONF.api.port,
                        log=logging.WritableLogger(wsgi_logger),
                        log_format=CONF.api.wsgi_log_format)
Example #5
0
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(
        'qonos.openstack.common.notification.%s' %
        message['event_type'])
    getattr(logger, priority)(jsonutils.dumps(message))
Example #6
0
    def run(self, run_once=False):
        LOG.debug(_('Starting qonos-api service'))
        # This must be done after the 'well-known' config options are loaded
        # so the list of action_overrides can be read
        self.register_action_override_cfg_opts()
        wsgi_logger = logging.getLogger('eventlet.wsgi.server')

        wsgi.run_server(self.app,
                        CONF.api.port,
                        log=logging.WritableLogger(wsgi_logger),
                        log_format=CONF.api.wsgi_log_format)
Example #7
0
    def run(self, run_once=False):
        LOG.debug(_('Starting qonos-api service'))
        # This must be done after the 'well-known' config options are loaded
        # so the list of action_overrides can be read
        self.register_action_override_cfg_opts()
        wsgi_logger = logging.getLogger('eventlet.wsgi.server')

        if CONF.api.daemonized:
            import daemon
            #NOTE(ameade): We need to preserve all open files for logging
            open_files = utils.get_qonos_open_file_log_handlers()
            with daemon.DaemonContext(files_preserve=open_files):
                wsgi.run_server(self.app, CONF.api.port,
                                log=logging.WritableLogger(wsgi_logger),
                                log_format=CONF.api.wsgi_log_format)
        else:
            wsgi.run_server(self.app, CONF.api.port,
                            log=logging.WritableLogger(wsgi_logger),
                            log_format=CONF.api.wsgi_log_format)
Example #8
0
    def run(self, run_once=False):
        LOG.debug(_('Starting qonos-api service'))
        # This must be done after the 'well-known' config options are loaded
        # so the list of action_overrides can be read
        self.register_action_override_cfg_opts()
        wsgi_logger = logging.getLogger('eventlet.wsgi.server')

        if CONF.api.daemonized:
            import daemon
            #NOTE(ameade): We need to preserve all open files for logging
            open_files = utils.get_qonos_open_file_log_handlers()
            with daemon.DaemonContext(files_preserve=open_files):
                wsgi.run_server(self.app, CONF.api.port,
                                log=logging.WritableLogger(wsgi_logger),
                                log_format=CONF.api.wsgi_log_format)
        else:
            wsgi.run_server(self.app, CONF.api.port,
                            log=logging.WritableLogger(wsgi_logger),
                            log_format=CONF.api.wsgi_log_format)
Example #9
0
#         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 migrate.changeset.constraint import ForeignKeyConstraint
from sqlalchemy import MetaData, Table

from qonos.openstack.common._i18n import _
import qonos.openstack.common.log as logging


LOG = logging.getLogger(__name__)


def upgrade(migrate_engine):
    meta = MetaData()
    meta.bind = migrate_engine

    schedules = Table('schedules', meta, autoload=True)
    schedule_metadata = Table('schedule_metadata', meta, autoload=True)

    if not schedule_metadata.foreign_keys:
        cons = ForeignKeyConstraint([schedule_metadata.c.schedule_id],
                                    [schedules.c.id])
        cons.create()

Example #10
0
# Copyright 2012 Red Hat, Inc.
# All Rights Reserved.
#
#    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 qonos.openstack.common._i18n import _
from qonos.openstack.common import log as logging
from qonos.openstack.common.notifier import rpc_notifier

LOG = logging.getLogger(__name__)


def notify(context, message):
    """Deprecated in Grizzly. Please use rpc_notifier instead."""

    LOG.deprecated(
        _("The rabbit_notifier is now deprecated."
          " Please use rpc_notifier instead."))
    rpc_notifier.notify(context, message)
Example #11
0
File: api.py Project: isethi/qonos
from qonos.common import exception
import qonos.db.db_utils as db_utils
from qonos.db.sqlalchemy import models
from qonos.openstack.common import cfg
from qonos.openstack.common.gettextutils import _
import qonos.openstack.common.log as os_logging
from qonos.openstack.common import timeutils


_ENGINE = None
_MAKER = None
_MAX_RETRIES = None
_RETRY_INTERVAL = None
BASE = models.BASE
sa_logger = None
LOG = os_logging.getLogger(__name__)

db_opts = [
    cfg.IntOpt('sql_idle_timeout', default=3600),
    cfg.IntOpt('sql_max_retries', default=60),
    cfg.IntOpt('sql_retry_interval', default=1),
    cfg.BoolOpt('db_auto_create', default=True),
]

CONF = cfg.CONF
CONF.register_opts(db_opts)


def force_dict(func):
    """Ensure returned object is a dict or list of dicts."""
Example #12
0
import sqlalchemy.sql as sa_sql

from qonos.common import exception
from qonos.common import timeutils
import qonos.db.db_utils as db_utils
from qonos.db.sqlalchemy import models
from qonos.openstack.common.gettextutils import _
import qonos.openstack.common.log as os_logging

_ENGINE = None
_MAKER = None
_MAX_RETRIES = None
_RETRY_INTERVAL = None
BASE = models.BASE
sa_logger = None
LOG = os_logging.getLogger(__name__)

db_opts = [
    cfg.IntOpt('sql_idle_timeout', default=3600),
    cfg.IntOpt('sql_max_retries', default=60),
    cfg.IntOpt('sql_retry_interval', default=1),
    cfg.BoolOpt('db_auto_create', default=True),
]

CONF = cfg.CONF
CONF.register_opts(db_opts)


def force_dict(func):
    """Ensure returned object is a dict or list of dicts."""
    def convert_list(a_list):