Esempio n. 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))
Esempio n. 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))
Esempio n. 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(
        'climate.openstack.common.notification.%s' %
        message['event_type'])
    getattr(logger, priority)(jsonutils.dumps(message))
# License for the specific language governing permissions and limitations
# under the License.

import uuid as uuidgen

from novaclient import exceptions as nova_exceptions
from oslo_config import cfg

from climate import context
from climate.manager import exceptions as manager_exceptions
from climate.openstack.common import log as logging
from climate.plugins import oshosts as plugin
from climate.utils.openstack import nova


LOG = logging.getLogger(__name__)

OPTS = [
    cfg.StrOpt('aggregate_freepool_name',
               default='freepool',
               help='Name of the special aggregate where all hosts '
                    'are candidate for physical host reservation'),
    cfg.StrOpt('project_id_key',
               default='climate:project',
               help='Aggregate metadata value for key matching project_id'),
    cfg.StrOpt('climate_owner',
               default='climate:owner',
               help='Aggregate metadata key for knowing owner project_id'),
    cfg.StrOpt('climate_az_prefix',
               default='climate:',
               help='Prefix for Availability Zones created by Climate'),
Esempio n. 5
0
# 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 json

import webob

from climate.db import exceptions as db_exceptions
from climate import exceptions
from climate.manager import exceptions as manager_exceptions
from climate.openstack.common.gettextutils import _  # noqa
from climate.openstack.common import log as logging

LOG = logging.getLogger(__name__)


class ParsableErrorMiddleware(object):
    """Middleware which prepared body to the client

    Middleware to replace the plain text message body of an error
    response with one formatted so the client can parse it.
    Based on pecan.middleware.errordocument
    """
    def __init__(self, app):
        self.app = app

    def __call__(self, environ, start_response):
        # Request for this state, modified by replace_start_response()
        # and used when an error is being reported.