本文整理汇总了Python中quantum.openstack.common.log.getLogger函数的典型用法代码示例。如果您正苦于以下问题:Python getLogger函数的具体用法?Python getLogger怎么用?Python getLogger使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getLogger函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _run
def _run(self, application, socket):
"""Start a WSGI service in a new green thread."""
logger = logging.getLogger('eventlet.wsgi.server')
eventlet.wsgi.server(socket,
application,
custom_pool=self.pool,
protocol=UnixDomainHttpProtocol,
log=logging.WritableLogger(logger))
示例2: setup_logging
def setup_logging(conf):
"""
Sets up the logging options for a log with supplied name
:param conf: a cfg.ConfOpts object
"""
product_name = "quantum"
logging.setup(product_name)
log_root = logging.getLogger(product_name).logger
LOG.info(_("Logging enabled!"))
示例3: notify
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(
'quantum.openstack.common.notification.%s' %
message['event_type'])
getattr(logger, priority)(jsonutils.dumps(message))
示例4: import
import abc
import netaddr
from oslo.config import cfg
from quantum.agent.common import config
from quantum.agent.linux import ip_lib
from quantum.agent.linux import ovs_lib
from quantum.agent.linux import utils
from quantum.common import exceptions
from quantum.extensions.flavor import (FLAVOR_NETWORK)
from quantum.openstack.common import importutils
from quantum.openstack.common import log as logging
LOG = logging.getLogger(__name__)
OPTS = [
cfg.StrOpt('ovs_integration_bridge',
default='br-int',
help=_('Name of Open vSwitch bridge to use')),
cfg.BoolOpt('ovs_use_veth',
default=False,
help=_('Uses veth for an interface or not')),
cfg.StrOpt('network_device_mtu',
help=_('MTU setting for device.')),
cfg.StrOpt('meta_flavor_driver_mappings',
help=_('Mapping between flavor and LinuxInterfaceDriver')),
cfg.StrOpt('admin_user',
help=_("Admin username")),
cfg.StrOpt('admin_password',
示例5: PluginInterface
import os
from oslo.config import cfg
import routes
import webob.dec
import webob.exc
from quantum.api.v2 import attributes
from quantum.common import exceptions
import quantum.extensions
from quantum.manager import QuantumManager
from quantum.openstack.common import log as logging
from quantum import wsgi
LOG = logging.getLogger('quantum.api.extensions')
class PluginInterface(object):
__metaclass__ = ABCMeta
@classmethod
def __subclasshook__(cls, klass):
"""Checking plugin class.
The __subclasshook__ method is a class method
that will be called everytime a class is tested
using issubclass(klass, PluginInterface).
In that case, it will check that every method
marked with the abstractmethod decorator is
provided by the plugin class.
示例6: files
import os
import routes
import webob.dec
import webob.exc
from quantum.common import exceptions
import quantum.extensions
from quantum.manager import QuantumManager
from quantum.openstack.common import cfg
from quantum.openstack.common import importutils
from quantum.openstack.common import log as logging
from quantum import wsgi
LOG = logging.getLogger("quantum.api.extensions")
# Besides the supported_extension_aliases in plugin class,
# we also support register enabled extensions here so that we
# can load some mandatory files (such as db models) before initialize plugin
ENABLED_EXTS = {
"quantum.plugins.linuxbridge.lb_quantum_plugin.LinuxBridgePluginV2": {
"ext_alias": ["quotas"],
"ext_db_models": ["quantum.extensions._quotav2_model.Quota"],
},
"quantum.plugins.openvswitch.ovs_quantum_plugin.OVSQuantumPluginV2": {
"ext_alias": ["quotas"],
"ext_db_models": ["quantum.extensions._quotav2_model.Quota"],
},
"quantum.plugins.nicira.nicira_nvp_plugin.QuantumPlugin.NvpPluginV2": {
"ext_alias": ["quotas"],
示例7: _run
def _run(self, application, socket):
"""Start a WSGI server in a new green thread."""
logger = logging.getLogger("eventlet.wsgi.server")
eventlet.wsgi.server(socket, application, custom_pool=self.pool, log=logging.WritableLogger(logger))
示例8: route_dict
from quantum import manager
from quantum.openstack.common import log as logging
from quantum import wsgi
RESOURCE_NAME = 'route'
RESOURCE_COLLECTION = RESOURCE_NAME + "s"
EXTENDED_ATTRIBUTES_2_0 = {
RESOURCE_COLLECTION: {}
}
attr_dict = EXTENDED_ATTRIBUTES_2_0[RESOURCE_COLLECTION]
attr_dict[RESOURCE_NAME] = {'allow_post': True,
'allow_put': True,
'is_visible': True}
LOG = logging.getLogger("quantum.quark.api.extensions.routes")
def route_dict(route):
return dict(cidr=route["cidr"],
gateway=route["gateway"],
id=route["id"],
subnet_id=route["subnet_id"])
class RoutesController(wsgi.Controller):
def __init__(self, plugin):
self._resource_name = RESOURCE_NAME
self._plugin = plugin
示例9: QuarkIpam
# under the License.
"""
Quark Pluggable IPAM
"""
import netaddr
from quantum.common import exceptions
from quantum.openstack.common import log as logging
from quantum.openstack.common import timeutils
from quark.db import api as db_api
LOG = logging.getLogger("quantum")
class QuarkIpam(object):
def _choose_available_subnet(self, context, net_id, version=None,
ip_address=None):
filters = {}
if version:
filters["version"] = version
subnets = db_api.subnet_find_allocation_counts(context, net_id,
scope=db_api.ALL,
**filters)
for subnet, ips_in_subnet in subnets:
ipnet = netaddr.IPNetwork(subnet["cidr"])
if ip_address and ip_address not in ipnet:
continue
示例10: BaseDriver
#
# 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
#
from quantum.openstack.common import log as logging
LOG = logging.getLogger("quantum.quark.base")
class BaseDriver(object):
"""Base interface for all Quark drivers.
Usable as a replacement for the sample plugin.
"""
def load_config(self, path):
LOG.info("load_config %s" % path)
def get_connection(self):
LOG.info("get_connection")
def create_network(self, tenant_id, network_name, tags=None,
network_id=None, **kwargs):
示例11: JSONStrategy
import json
from oslo.config import cfg
from quantum.common import exceptions
from quantum.openstack.common import log as logging
LOG = logging.getLogger("quantum.quark")
CONF = cfg.CONF
quark_opts = [
cfg.StrOpt('default_net_strategy', default='{}',
help=_("Default network assignment strategy"))
]
CONF.register_opts(quark_opts, "QUARK")
class JSONStrategy(object):
def __init__(self):
self.reverse_strategy = {}
self.strategy = {}
self._compile_strategy(CONF.QUARK.default_net_strategy)
def _compile_strategy(self, strategy):
strategy = json.loads(strategy)
for network, definition in strategy.iteritems():
for _, child_net in definition["children"].iteritems():
self.reverse_strategy[child_net] = network
self.strategy = strategy
def split_network_ids(self, context, net_ids):
assignable = []
示例12: _listify
# under the License.
import datetime
from quantum.openstack.common import log as logging
from quantum.openstack.common import timeutils
from sqlalchemy import func as sql_func
from sqlalchemy import orm, or_
from quark.db import models
from quark import exceptions as quark_exc
from quark import network_strategy
STRATEGY = network_strategy.STRATEGY
LOG = logging.getLogger("quantum.quark.db.api")
ONE = "one"
ALL = "all"
def _listify(filters):
for key in ["name", "network_id", "id", "device_id", "tenant_id",
"mac_address", "shared"]:
if key in filters:
if not filters[key]:
continue
listified = filters[key]
if not isinstance(listified, list):
listified = [listified]
filters[key] = listified
示例13:
NVP client driver for Quark
"""
from oslo.config import cfg
import sqlalchemy as sa
from sqlalchemy import orm
import aiclib
from quantum.openstack.common import log as logging
from quark.db import models
from quark.drivers import base
LOG = logging.getLogger("quantum.quark.nvplib")
CONF = cfg.CONF
nvp_opts = [
cfg.IntOpt('max_ports_per_switch',
default=0,
help=_('Maximum amount of NVP ports on an NVP lswitch')),
cfg.StrOpt('default_tz',
help=_('The default transport zone UUID')),
cfg.MultiStrOpt('controller_connection',
default=[],
help=_('NVP Controller connection string')),
]
CONF.register_opts(nvp_opts, "NVP")
示例14: mac_range_dict
from quantum import manager
from quantum.openstack.common import log as logging
from quantum import wsgi
RESOURCE_NAME = 'mac_address_range'
RESOURCE_COLLECTION = RESOURCE_NAME + "s"
EXTENDED_ATTRIBUTES_2_0 = {
RESOURCE_COLLECTION: {}
}
attr_dict = EXTENDED_ATTRIBUTES_2_0[RESOURCE_COLLECTION]
attr_dict[RESOURCE_NAME] = {'allow_post': True,
'allow_put': False,
'is_visible': True}
LOG = logging.getLogger("quantum.quark.api.extensions.mac_address_ranges")
def mac_range_dict(mac_range):
return dict(address=mac_range["cidr"],
id=mac_range["id"])
class MacAddressRangesController(wsgi.Controller):
def __init__(self, plugin):
self._resource_name = RESOURCE_NAME
self._plugin = plugin
def create(self, request, body=None):
body = self._deserialize(request.body, request.get_content_type())
示例15: _default_list_getset
from sqlalchemy import orm
from sqlalchemy.ext import associationproxy
from sqlalchemy.ext import declarative
from sqlalchemy.ext import hybrid
import quantum.db.model_base
from quantum.db import models_v2 as models
from quantum.openstack.common import log as logging
from quantum.openstack.common import timeutils
from quark.db import custom_types
HasId = models.HasId
LOG = logging.getLogger("quantum.quark.db.models")
def _default_list_getset(collection_class, proxy):
attr = proxy.value_attr
def getter(obj):
if obj:
return getattr(obj, attr, None)
return []
if collection_class is dict:
setter = lambda o, k, v: setattr(o, attr, v)
else:
setter = lambda o, v: setattr(o, attr, v)
return getter, setter