From 22328baf1f60719fcaa5b0fbd91c0a3158d09c31 Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Thu, 26 Feb 2015 23:26:41 +0100 Subject: [PATCH] Migrate to oslo.log It's mostly a matter of changing imports to a new location. Non-obvious changes needed: * pass overwrite= argument to oslo_context since oslo.log reads context from its thread local store and not local.store from incubator * don't store context at local.store now that there is no code that would consume it * LOG.deprecated() -> versionutils.report_deprecated_feature() * dropped LOG.audit check from hacking rule since now the method does not exist * WritableLogger is now located in oslo_log.loggers Dropped log module from the tree. Also dropped local module that is now of no use (and obsolete, as per oslo team). Added versionutils back to openstack-common.conf since now we use the module directly from neutron code and not just as a dependency of some other oslo-incubator module. Note: tempest tests are expected to be broken now, so instead of fixing all the oslo.log related issues for the subtree in this patch, I only added TODOs with directions for later fix. Closes-Bug: #1425013 Change-Id: I310e059a815377579de6bb2aa204de168e72571e --- neutron/agent/common/config.py | 2 +- neutron/agent/dhcp/agent.py | 2 +- neutron/agent/l2population_rpc.py | 2 +- neutron/agent/l3/agent.py | 2 +- neutron/agent/l3/dvr.py | 5 +- neutron/agent/l3/dvr_fip_ns.py | 5 +- neutron/agent/l3/dvr_router.py | 2 +- neutron/agent/l3/dvr_snat_ns.py | 3 +- neutron/agent/l3/ha.py | 2 +- neutron/agent/l3/ha_router.py | 5 +- neutron/agent/l3/namespace_manager.py | 3 +- neutron/agent/l3/namespaces.py | 3 +- neutron/agent/l3/router_info.py | 3 +- neutron/agent/linux/async_process.py | 2 +- neutron/agent/linux/daemon.py | 3 +- neutron/agent/linux/dhcp.py | 2 +- neutron/agent/linux/external_process.py | 2 +- neutron/agent/linux/interface.py | 2 +- neutron/agent/linux/ip_lib.py | 3 +- neutron/agent/linux/ip_link_support.py | 3 +- neutron/agent/linux/ip_monitor.py | 2 +- neutron/agent/linux/iptables_firewall.py | 2 +- neutron/agent/linux/iptables_manager.py | 2 +- neutron/agent/linux/keepalived.py | 2 +- neutron/agent/linux/ovs_lib.py | 2 +- neutron/agent/linux/ovsdb_monitor.py | 2 +- neutron/agent/linux/ra.py | 2 +- neutron/agent/linux/utils.py | 2 +- neutron/agent/metadata/agent.py | 5 +- neutron/agent/metadata/driver.py | 2 +- neutron/agent/metadata/namespace_proxy.py | 2 +- neutron/agent/metadata_agent.py | 2 +- neutron/agent/ovsdb/impl_vsctl.py | 2 +- neutron/agent/rpc.py | 3 +- neutron/agent/securitygroups_rpc.py | 2 +- neutron/api/api_common.py | 2 +- neutron/api/extensions.py | 2 +- .../rpc/agentnotifiers/dhcp_rpc_agent_api.py | 2 +- .../rpc/agentnotifiers/l3_rpc_agent_api.py | 2 +- .../agentnotifiers/metering_rpc_agent_api.py | 2 +- neutron/api/rpc/handlers/dhcp_rpc.py | 2 +- neutron/api/rpc/handlers/dvr_rpc.py | 2 +- neutron/api/rpc/handlers/l3_rpc.py | 2 +- neutron/api/v2/attributes.py | 5 +- neutron/api/v2/base.py | 6 +- neutron/api/v2/resource.py | 2 +- neutron/api/v2/router.py | 2 +- neutron/api/versions.py | 2 +- neutron/auth.py | 2 +- neutron/callbacks/manager.py | 2 +- neutron/cmd/netns_cleanup.py | 2 +- neutron/cmd/ovs_cleanup.py | 2 +- neutron/cmd/sanity/checks.py | 2 +- neutron/cmd/sanity_check.py | 5 +- neutron/common/config.py | 6 +- neutron/common/ipv6_utils.py | 2 +- neutron/common/log.py | 2 +- neutron/common/repos.py | 3 +- neutron/common/rpc.py | 2 +- neutron/common/utils.py | 2 +- neutron/context.py | 10 +- neutron/db/agents_db.py | 3 +- neutron/db/agentschedulers_db.py | 2 +- neutron/db/db_base_plugin_v2.py | 2 +- neutron/db/dvr_mac_db.py | 9 +- neutron/db/extradhcpopt_db.py | 3 +- neutron/db/extraroute_db.py | 2 +- neutron/db/l3_agentschedulers_db.py | 3 +- neutron/db/l3_db.py | 2 +- neutron/db/l3_dvr_db.py | 2 +- neutron/db/l3_dvrscheduler_db.py | 2 +- neutron/db/l3_gwmode_db.py | 2 +- neutron/db/l3_hamode_db.py | 2 +- neutron/db/metering/metering_db.py | 2 +- neutron/db/metering/metering_rpc.py | 2 +- neutron/db/portsecurity_db.py | 2 +- neutron/db/securitygroups_db.py | 2 +- neutron/db/securitygroups_rpc_base.py | 2 +- neutron/db/servicetype_db.py | 2 +- neutron/db/sqlalchemyutils.py | 2 +- neutron/debug/commands.py | 2 +- neutron/debug/debug_agent.py | 2 +- neutron/extensions/flavor.py | 3 +- neutron/extensions/l3agentscheduler.py | 2 +- neutron/extensions/metering.py | 2 +- neutron/extensions/servicetype.py | 3 +- neutron/hacking/checks.py | 2 - neutron/manager.py | 2 +- neutron/notifiers/nova.py | 2 +- neutron/openstack/common/local.py | 45 -- neutron/openstack/common/log.py | 718 ------------------ neutron/plugins/brocade/NeutronPlugin.py | 2 +- neutron/plugins/brocade/nos/nosdriver.py | 2 +- neutron/plugins/brocade/tests/noscli.py | 3 +- neutron/plugins/cisco/db/n1kv_db_v2.py | 5 +- neutron/plugins/cisco/db/n1kv_models_v2.py | 2 +- neutron/plugins/cisco/db/network_db_v2.py | 2 +- .../plugins/cisco/models/virt_phy_sw_v2.py | 2 +- neutron/plugins/cisco/n1kv/n1kv_client.py | 2 +- .../plugins/cisco/n1kv/n1kv_neutron_plugin.py | 3 +- neutron/plugins/cisco/network_plugin.py | 2 +- neutron/plugins/embrane/agent/dispatcher.py | 2 +- .../agent/operations/router_operations.py | 2 +- neutron/plugins/embrane/base_plugin.py | 2 +- neutron/plugins/embrane/common/utils.py | 2 +- .../hyperv/agent/hyperv_neutron_agent.py | 2 +- .../hyperv/agent/security_groups_driver.py | 3 +- neutron/plugins/hyperv/agent/utils.py | 2 +- neutron/plugins/hyperv/agent/utilsfactory.py | 2 +- .../plugins/ibm/agent/sdnve_neutron_agent.py | 2 +- neutron/plugins/ibm/sdnve_api.py | 2 +- neutron/plugins/ibm/sdnve_api_fake.py | 3 +- neutron/plugins/ibm/sdnve_neutron_plugin.py | 2 +- .../agent/linuxbridge_neutron_agent.py | 2 +- neutron/plugins/ml2/db.py | 5 +- neutron/plugins/ml2/driver_context.py | 2 +- .../ml2/drivers/arista/mechanism_arista.py | 2 +- .../ml2/drivers/brocade/mechanism_brocade.py | 2 +- .../ml2/drivers/brocade/nos/nosdriver.py | 2 +- .../ml2/drivers/cisco/apic/apic_sync.py | 3 +- .../ml2/drivers/cisco/apic/apic_topology.py | 3 +- .../ml2/drivers/cisco/apic/mechanism_apic.py | 2 +- .../plugins/ml2/drivers/cisco/ncs/driver.py | 2 +- .../ml2/drivers/freescale/mechanism_fslsdn.py | 3 +- neutron/plugins/ml2/drivers/helpers.py | 2 +- .../plugins/ml2/drivers/l2pop/mech_driver.py | 2 +- neutron/plugins/ml2/drivers/l2pop/rpc.py | 2 +- neutron/plugins/ml2/drivers/mech_agent.py | 3 +- neutron/plugins/ml2/drivers/mech_hyperv.py | 3 +- .../plugins/ml2/drivers/mech_linuxbridge.py | 3 +- .../plugins/ml2/drivers/mech_nuage/driver.py | 2 +- .../plugins/ml2/drivers/mech_openvswitch.py | 3 +- .../ml2/drivers/mech_sriov/mech_driver.py | 2 +- neutron/plugins/ml2/drivers/mlnx/mech_mlnx.py | 2 +- .../ml2/drivers/opendaylight/driver.py | 2 +- neutron/plugins/ml2/drivers/type_flat.py | 2 +- neutron/plugins/ml2/drivers/type_gre.py | 2 +- neutron/plugins/ml2/drivers/type_local.py | 3 +- neutron/plugins/ml2/drivers/type_tunnel.py | 3 +- neutron/plugins/ml2/drivers/type_vlan.py | 2 +- neutron/plugins/ml2/drivers/type_vxlan.py | 2 +- neutron/plugins/ml2/managers.py | 2 +- neutron/plugins/ml2/plugin.py | 4 +- neutron/plugins/ml2/rpc.py | 2 +- .../mlnx/agent/eswitch_neutron_agent.py | 2 +- .../plugins/nec/extensions/router_provider.py | 3 +- .../agent/nvsd_neutron_agent.py | 2 +- neutron/plugins/oneconvergence/lib/nvsdlib.py | 2 +- .../oneconvergence/lib/plugin_helper.py | 2 +- neutron/plugins/oneconvergence/plugin.py | 2 +- .../plugins/opencontrail/contrail_plugin.py | 2 +- .../agent/ovs_dvr_neutron_agent.py | 3 +- .../openvswitch/agent/ovs_neutron_agent.py | 4 +- .../plugins/sriovnicagent/eswitch_manager.py | 3 +- neutron/plugins/sriovnicagent/pci_lib.py | 3 +- .../plugins/sriovnicagent/sriov_nic_agent.py | 2 +- neutron/policy.py | 8 +- neutron/quota.py | 2 +- neutron/scheduler/dhcp_agent_scheduler.py | 2 +- neutron/scheduler/l3_agent_scheduler.py | 2 +- neutron/server/__init__.py | 2 +- neutron/service.py | 2 +- neutron/services/advanced_service.py | 2 +- .../firewall/agents/firewall_agent_api.py | 2 +- .../agents/l3reference/firewall_l3_agent.py | 2 +- .../l3_router/brocade/l3_router_plugin.py | 2 +- neutron/services/l3_router/l3_arista.py | 2 +- .../metering/agents/metering_agent.py | 2 +- .../drivers/iptables/iptables_driver.py | 2 +- neutron/services/provider_configuration.py | 2 +- neutron/services/service_base.py | 2 +- neutron/tests/api/contrib/clients.py | 3 +- .../functional/agent/linux/test_ip_lib.py | 2 +- .../tests/functional/agent/test_l3_agent.py | 7 +- neutron/tests/tempest/api/network/base.py | 2 +- .../api/network/test_metering_extensions.py | 3 +- neutron/tests/tempest/auth.py | 2 +- neutron/tests/tempest/common/accounts.py | 4 +- neutron/tests/tempest/common/commands.py | 2 +- neutron/tests/tempest/common/cred_provider.py | 2 +- .../common/generator/base_generator.py | 3 +- .../common/generator/negative_generator.py | 3 +- .../common/generator/valid_generator.py | 3 +- neutron/tests/tempest/common/glance_http.py | 2 +- .../tests/tempest/common/isolated_creds.py | 2 +- neutron/tests/tempest/common/ssh.py | 2 +- neutron/tests/tempest/common/utils/misc.py | 2 +- neutron/tests/tempest/common/waiters.py | 3 +- neutron/tests/tempest/config.py | 11 +- neutron/tests/tempest/test.py | 4 +- neutron/tests/unit/database_stubs.py | 3 +- neutron/tests/unit/hacking/test_checks.py | 1 - .../drivers/brocade/test_brocade_l3_plugin.py | 2 +- .../brocade/test_brocade_mechanism_driver.py | 2 +- .../tests/unit/ml2/drivers/mech_fake_agent.py | 5 +- .../unit/ml2/drivers/mechanism_logger.py | 3 +- .../openvswitch/test_ovs_neutron_agent.py | 4 +- .../tests/unit/openvswitch/test_ovs_tunnel.py | 4 +- neutron/tests/unit/test_agent_ext_plugin.py | 2 +- neutron/tests/unit/test_extension_ext_net.py | 2 +- .../unit/test_extension_extradhcpopts.py | 3 +- .../tests/unit/test_extension_extraroute.py | 3 +- neutron/tests/unit/test_extensions.py | 2 +- neutron/tests/unit/test_l3_agent.py | 7 +- neutron/tests/unit/test_l3_plugin.py | 2 +- neutron/tests/unit/test_linux_dhcp.py | 2 +- neutron/tests/unit/test_neutron_context.py | 15 +- neutron/tests/unit/test_neutron_manager.py | 3 +- neutron/tests/unit/test_wsgi.py | 2 +- neutron/wsgi.py | 5 +- openstack-common.conf | 3 +- 211 files changed, 297 insertions(+), 1029 deletions(-) delete mode 100644 neutron/openstack/common/local.py delete mode 100644 neutron/openstack/common/log.py diff --git a/neutron/agent/common/config.py b/neutron/agent/common/config.py index d559612b5a4..4862cffe9c0 100644 --- a/neutron/agent/common/config.py +++ b/neutron/agent/common/config.py @@ -16,9 +16,9 @@ import os from oslo_config import cfg +from oslo_log import log as logging from neutron.common import config -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/agent/dhcp/agent.py b/neutron/agent/dhcp/agent.py index 8f0647c8992..0d6624d0237 100644 --- a/neutron/agent/dhcp/agent.py +++ b/neutron/agent/dhcp/agent.py @@ -19,6 +19,7 @@ import os import eventlet from oslo_config import cfg +from oslo_log import log as logging import oslo_messaging from oslo_utils import importutils @@ -34,7 +35,6 @@ from neutron.common import utils from neutron import context from neutron.i18n import _LE, _LI, _LW from neutron import manager -from neutron.openstack.common import log as logging from neutron.openstack.common import loopingcall LOG = logging.getLogger(__name__) diff --git a/neutron/agent/l2population_rpc.py b/neutron/agent/l2population_rpc.py index 6547a29a064..50ba665b082 100644 --- a/neutron/agent/l2population_rpc.py +++ b/neutron/agent/l2population_rpc.py @@ -16,11 +16,11 @@ import abc from oslo_config import cfg +from oslo_log import log as logging import six from neutron.common import constants as n_const from neutron.common import log -from neutron.openstack.common import log as logging from neutron.plugins.ml2.drivers.l2pop import rpc as l2pop_rpc LOG = logging.getLogger(__name__) diff --git a/neutron/agent/l3/agent.py b/neutron/agent/l3/agent.py index e793d9d1aff..0e4a6ce3ba0 100644 --- a/neutron/agent/l3/agent.py +++ b/neutron/agent/l3/agent.py @@ -16,6 +16,7 @@ import eventlet import netaddr from oslo_config import cfg +from oslo_log import log as logging import oslo_messaging from oslo_utils import excutils from oslo_utils import importutils @@ -45,7 +46,6 @@ from neutron.common import utils as common_utils from neutron import context as n_context from neutron.i18n import _LE, _LI, _LW from neutron import manager -from neutron.openstack.common import log as logging from neutron.openstack.common import loopingcall from neutron.openstack.common import periodic_task from neutron.services import advanced_service as adv_svc diff --git a/neutron/agent/l3/dvr.py b/neutron/agent/l3/dvr.py index ed4bc28a2e9..0c6424c2edc 100644 --- a/neutron/agent/l3/dvr.py +++ b/neutron/agent/l3/dvr.py @@ -13,16 +13,17 @@ # under the License. import binascii -import netaddr import weakref +import netaddr +from oslo_log import log as logging + from neutron.agent.l3 import dvr_fip_ns from neutron.agent.l3 import dvr_snat_ns from neutron.agent.linux import ip_lib from neutron.agent.linux import iptables_manager from neutron.common import constants as l3_constants from neutron.i18n import _LE -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/agent/l3/dvr_fip_ns.py b/neutron/agent/l3/dvr_fip_ns.py index 5369fc8b322..d7d11ddcf16 100644 --- a/neutron/agent/l3/dvr_fip_ns.py +++ b/neutron/agent/l3/dvr_fip_ns.py @@ -12,15 +12,16 @@ # License for the specific language governing permissions and limitations # under the License. -import netaddr import os +import netaddr +from oslo_log import log as logging + from neutron.agent.l3 import link_local_allocator as lla from neutron.agent.l3 import namespaces from neutron.agent.linux import ip_lib from neutron.agent.linux import iptables_manager from neutron.common import utils as common_utils -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/agent/l3/dvr_router.py b/neutron/agent/l3/dvr_router.py index 5dc290232c2..713cce4349a 100644 --- a/neutron/agent/l3/dvr_router.py +++ b/neutron/agent/l3/dvr_router.py @@ -12,6 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging from oslo_utils import excutils from neutron.agent.l3 import dvr_fip_ns @@ -21,7 +22,6 @@ from neutron.agent.linux import ip_lib from neutron.common import constants as l3_constants from neutron.common import utils as common_utils from neutron.i18n import _LE -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/agent/l3/dvr_snat_ns.py b/neutron/agent/l3/dvr_snat_ns.py index 2ab940bc14c..194f2a8c236 100644 --- a/neutron/agent/l3/dvr_snat_ns.py +++ b/neutron/agent/l3/dvr_snat_ns.py @@ -10,9 +10,10 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging + from neutron.agent.l3 import namespaces from neutron.agent.linux import ip_lib -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) SNAT_NS_PREFIX = 'snat-' diff --git a/neutron/agent/l3/ha.py b/neutron/agent/l3/ha.py index 5758abba09a..86b7169f328 100644 --- a/neutron/agent/l3/ha.py +++ b/neutron/agent/l3/ha.py @@ -16,11 +16,11 @@ import os from oslo_config import cfg +from oslo_log import log as logging from neutron.agent.linux import keepalived from neutron.common import constants as l3_constants from neutron.i18n import _LE -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/agent/l3/ha_router.py b/neutron/agent/l3/ha_router.py index 67e8aee5bfc..83a25ee671a 100644 --- a/neutron/agent/l3/ha_router.py +++ b/neutron/agent/l3/ha_router.py @@ -12,17 +12,18 @@ # License for the specific language governing permissions and limitations # under the License. -import netaddr import shutil import signal +import netaddr +from oslo_log import log as logging + from neutron.agent.l3 import router_info as router from neutron.agent.linux import ip_lib from neutron.agent.linux import keepalived from neutron.agent.metadata import driver as metadata_driver from neutron.common import constants as n_consts from neutron.common import utils as common_utils -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) HA_DEV_PREFIX = 'ha-' diff --git a/neutron/agent/l3/namespace_manager.py b/neutron/agent/l3/namespace_manager.py index 21f72cb0aaa..52333f0c248 100644 --- a/neutron/agent/l3/namespace_manager.py +++ b/neutron/agent/l3/namespace_manager.py @@ -10,11 +10,12 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging + from neutron.agent.l3 import dvr_snat_ns from neutron.agent.l3 import namespaces from neutron.agent.linux import ip_lib from neutron.i18n import _LE -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/agent/l3/namespaces.py b/neutron/agent/l3/namespaces.py index 27111ac0647..e1c6813d311 100644 --- a/neutron/agent/l3/namespaces.py +++ b/neutron/agent/l3/namespaces.py @@ -13,9 +13,10 @@ # under the License. # +from oslo_log import log as logging + from neutron.agent.linux import ip_lib from neutron.i18n import _LE -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/agent/l3/router_info.py b/neutron/agent/l3/router_info.py index 3c01112bab7..ab44bf44933 100644 --- a/neutron/agent/l3/router_info.py +++ b/neutron/agent/l3/router_info.py @@ -12,6 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging + from neutron.agent.l3 import namespaces from neutron.agent.linux import ip_lib from neutron.agent.linux import iptables_manager @@ -19,7 +21,6 @@ from neutron.common import constants as l3_constants from neutron.common import exceptions as n_exc from neutron.common import utils as common_utils from neutron.i18n import _LW -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) INTERNAL_DEV_PREFIX = 'qr-' diff --git a/neutron/agent/linux/async_process.py b/neutron/agent/linux/async_process.py index 8da4ae2c30f..ddb7681279a 100644 --- a/neutron/agent/linux/async_process.py +++ b/neutron/agent/linux/async_process.py @@ -15,11 +15,11 @@ import eventlet import eventlet.event import eventlet.queue +from oslo_log import log as logging from neutron.agent.linux import ip_lib from neutron.agent.linux import utils from neutron.i18n import _LE -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/agent/linux/daemon.py b/neutron/agent/linux/daemon.py index 42ace422a04..65ea4af8649 100644 --- a/neutron/agent/linux/daemon.py +++ b/neutron/agent/linux/daemon.py @@ -20,9 +20,10 @@ import pwd import signal import sys +from oslo_log import log as logging + from neutron.common import exceptions from neutron.i18n import _LE, _LI -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/agent/linux/dhcp.py b/neutron/agent/linux/dhcp.py index 08e3c84b46d..1b0e0e64dd4 100644 --- a/neutron/agent/linux/dhcp.py +++ b/neutron/agent/linux/dhcp.py @@ -20,6 +20,7 @@ import re import shutil import netaddr +from oslo_log import log as logging from oslo_utils import importutils import six @@ -31,7 +32,6 @@ from neutron.common import exceptions from neutron.common import ipv6_utils from neutron.common import utils as commonutils from neutron.i18n import _LE, _LI, _LW -from neutron.openstack.common import log as logging from neutron.openstack.common import uuidutils LOG = logging.getLogger(__name__) diff --git a/neutron/agent/linux/external_process.py b/neutron/agent/linux/external_process.py index abed5ba42d4..95beddd99df 100644 --- a/neutron/agent/linux/external_process.py +++ b/neutron/agent/linux/external_process.py @@ -20,13 +20,13 @@ import six import eventlet from oslo_concurrency import lockutils from oslo_config import cfg +from oslo_log import log as logging from neutron.agent.common import config as agent_cfg from neutron.agent.linux import ip_lib from neutron.agent.linux import utils from neutron.i18n import _LE from neutron.openstack.common import fileutils -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/agent/linux/interface.py b/neutron/agent/linux/interface.py index 3fe78f81ab3..d3eb2f10c8f 100644 --- a/neutron/agent/linux/interface.py +++ b/neutron/agent/linux/interface.py @@ -17,6 +17,7 @@ import abc import netaddr from oslo_config import cfg +from oslo_log import log as logging from oslo_utils import importutils import six @@ -27,7 +28,6 @@ from neutron.common import constants as n_const from neutron.common import exceptions from neutron.extensions import flavor from neutron.i18n import _LE, _LI -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/agent/linux/ip_lib.py b/neutron/agent/linux/ip_lib.py index 733703e0eb8..e37d6a536a5 100644 --- a/neutron/agent/linux/ip_lib.py +++ b/neutron/agent/linux/ip_lib.py @@ -14,14 +14,13 @@ # under the License. import eventlet - import netaddr from oslo_config import cfg +from oslo_log import log as logging from neutron.agent.linux import utils from neutron.common import exceptions from neutron.i18n import _LE -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/agent/linux/ip_link_support.py b/neutron/agent/linux/ip_link_support.py index 2a1083bc050..d41a2ecb8d0 100644 --- a/neutron/agent/linux/ip_link_support.py +++ b/neutron/agent/linux/ip_link_support.py @@ -15,10 +15,11 @@ import re +from oslo_log import log as logging + from neutron.agent.linux import utils from neutron.common import exceptions as n_exc from neutron.i18n import _LE -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/agent/linux/ip_monitor.py b/neutron/agent/linux/ip_monitor.py index f7485c2ec4b..02bb242cbbf 100644 --- a/neutron/agent/linux/ip_monitor.py +++ b/neutron/agent/linux/ip_monitor.py @@ -13,11 +13,11 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging from oslo_utils import excutils from neutron.agent.linux import async_process from neutron.i18n import _LE -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/agent/linux/iptables_firewall.py b/neutron/agent/linux/iptables_firewall.py index 4830bc21359..8ad2db0a7b4 100644 --- a/neutron/agent/linux/iptables_firewall.py +++ b/neutron/agent/linux/iptables_firewall.py @@ -15,6 +15,7 @@ import netaddr from oslo_config import cfg +from oslo_log import log as logging from neutron.agent import firewall from neutron.agent.linux import ipset_manager @@ -23,7 +24,6 @@ from neutron.agent.linux import iptables_manager from neutron.common import constants from neutron.common import ipv6_utils from neutron.i18n import _LI -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/agent/linux/iptables_manager.py b/neutron/agent/linux/iptables_manager.py index 5adf1d227ce..065c1823e3c 100644 --- a/neutron/agent/linux/iptables_manager.py +++ b/neutron/agent/linux/iptables_manager.py @@ -25,6 +25,7 @@ import sys from oslo_concurrency import lockutils from oslo_config import cfg +from oslo_log import log as logging from oslo_utils import excutils from neutron.agent.common import config @@ -33,7 +34,6 @@ from neutron.agent.linux import utils as linux_utils from neutron.common import exceptions as n_exc from neutron.common import utils from neutron.i18n import _LE, _LW -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/agent/linux/keepalived.py b/neutron/agent/linux/keepalived.py index c448f41ae35..8164af0b094 100644 --- a/neutron/agent/linux/keepalived.py +++ b/neutron/agent/linux/keepalived.py @@ -19,11 +19,11 @@ import stat import netaddr from oslo_config import cfg +from oslo_log import log as logging from neutron.agent.linux import external_process from neutron.agent.linux import utils from neutron.common import exceptions -from neutron.openstack.common import log as logging VALID_STATES = ['MASTER', 'BACKUP'] VALID_NOTIFY_STATES = ['master', 'backup', 'fault'] diff --git a/neutron/agent/linux/ovs_lib.py b/neutron/agent/linux/ovs_lib.py index 5eb3d025250..531232388f0 100644 --- a/neutron/agent/linux/ovs_lib.py +++ b/neutron/agent/linux/ovs_lib.py @@ -18,6 +18,7 @@ import itertools import operator from oslo_config import cfg +from oslo_log import log as logging from oslo_utils import excutils import retrying import six @@ -27,7 +28,6 @@ from neutron.agent.linux import utils from neutron.agent.ovsdb import api as ovsdb from neutron.common import exceptions from neutron.i18n import _LE, _LI, _LW -from neutron.openstack.common import log as logging from neutron.plugins.common import constants # Default timeout for ovs-vsctl command diff --git a/neutron/agent/linux/ovsdb_monitor.py b/neutron/agent/linux/ovsdb_monitor.py index 4c1863c36cb..02f45f6b1b9 100644 --- a/neutron/agent/linux/ovsdb_monitor.py +++ b/neutron/agent/linux/ovsdb_monitor.py @@ -13,10 +13,10 @@ # under the License. import eventlet +from oslo_log import log as logging from neutron.agent.linux import async_process from neutron.i18n import _LE -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/agent/linux/ra.py b/neutron/agent/linux/ra.py index ef8346e4588..e017116d88f 100644 --- a/neutron/agent/linux/ra.py +++ b/neutron/agent/linux/ra.py @@ -16,12 +16,12 @@ import jinja2 import netaddr from oslo_config import cfg +from oslo_log import log as logging import six from neutron.agent.linux import external_process from neutron.agent.linux import utils from neutron.common import constants -from neutron.openstack.common import log as logging RADVD_SERVICE_NAME = 'radvd' diff --git a/neutron/agent/linux/utils.py b/neutron/agent/linux/utils.py index 44720853813..6bf4bea09f1 100644 --- a/neutron/agent/linux/utils.py +++ b/neutron/agent/linux/utils.py @@ -25,13 +25,13 @@ import eventlet from eventlet.green import subprocess from eventlet import greenthread from oslo_config import cfg +from oslo_log import log as logging from oslo_utils import excutils from neutron.agent.common import config from neutron.common import constants from neutron.common import utils from neutron.i18n import _LE -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/agent/metadata/agent.py b/neutron/agent/metadata/agent.py index 21ecea3e842..22ed9f3fe2f 100644 --- a/neutron/agent/metadata/agent.py +++ b/neutron/agent/metadata/agent.py @@ -21,6 +21,8 @@ import eventlet import httplib2 from neutronclient.v2_0 import client from oslo_config import cfg +from oslo_log import log as logging +from oslo_log import loggers import oslo_messaging from oslo_utils import excutils import six.moves.urllib.parse as urlparse @@ -34,7 +36,6 @@ from neutron.common import utils from neutron import context from neutron.i18n import _LE, _LW from neutron.openstack.common.cache import cache -from neutron.openstack.common import log as logging from neutron.openstack.common import loopingcall from neutron import wsgi @@ -294,7 +295,7 @@ class UnixDomainWSGIServer(wsgi.Server): application, max_size=self.num_threads, protocol=UnixDomainHttpProtocol, - log=logging.WritableLogger(logger)) + log=loggers.WritableLogger(logger)) class UnixDomainMetadataProxy(object): diff --git a/neutron/agent/metadata/driver.py b/neutron/agent/metadata/driver.py index f7808d4a2c0..1e36460eeda 100644 --- a/neutron/agent/metadata/driver.py +++ b/neutron/agent/metadata/driver.py @@ -16,11 +16,11 @@ import os from oslo_config import cfg +from oslo_log import log as logging from neutron.agent.common import config from neutron.agent.linux import external_process from neutron.common import exceptions -from neutron.openstack.common import log as logging from neutron.services import advanced_service LOG = logging.getLogger(__name__) diff --git a/neutron/agent/metadata/namespace_proxy.py b/neutron/agent/metadata/namespace_proxy.py index 690453097b3..be1d32adf70 100644 --- a/neutron/agent/metadata/namespace_proxy.py +++ b/neutron/agent/metadata/namespace_proxy.py @@ -17,6 +17,7 @@ import socket import httplib2 from oslo_config import cfg +from oslo_log import log as logging import six.moves.urllib.parse as urlparse import webob @@ -25,7 +26,6 @@ from neutron.common import config from neutron.common import exceptions from neutron.common import utils from neutron.i18n import _LE -from neutron.openstack.common import log as logging from neutron import wsgi LOG = logging.getLogger(__name__) diff --git a/neutron/agent/metadata_agent.py b/neutron/agent/metadata_agent.py index a6cec3a28ee..11135aec95e 100644 --- a/neutron/agent/metadata_agent.py +++ b/neutron/agent/metadata_agent.py @@ -15,6 +15,7 @@ import sys from oslo_config import cfg +from oslo_log import log as logging from neutron.agent.common import config as agent_conf from neutron.agent.metadata import agent @@ -22,7 +23,6 @@ from neutron.agent.metadata import config as metadata_conf from neutron.common import config from neutron.common import utils from neutron.openstack.common.cache import cache -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/agent/ovsdb/impl_vsctl.py b/neutron/agent/ovsdb/impl_vsctl.py index 3ffca811c96..57b74989366 100644 --- a/neutron/agent/ovsdb/impl_vsctl.py +++ b/neutron/agent/ovsdb/impl_vsctl.py @@ -16,13 +16,13 @@ import collections import itertools import uuid +from oslo_log import log as logging from oslo_serialization import jsonutils from oslo_utils import excutils from neutron.agent.linux import utils from neutron.agent.ovsdb import api as ovsdb from neutron.i18n import _LE -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/agent/rpc.py b/neutron/agent/rpc.py index 7f567743725..f71d36032e8 100644 --- a/neutron/agent/rpc.py +++ b/neutron/agent/rpc.py @@ -14,6 +14,8 @@ # under the License. import itertools + +from oslo_log import log as logging import oslo_messaging from oslo_utils import timeutils @@ -21,7 +23,6 @@ from neutron.common import constants from neutron.common import rpc as n_rpc from neutron.common import topics from neutron.i18n import _LW -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/agent/securitygroups_rpc.py b/neutron/agent/securitygroups_rpc.py index 5fe11a236cc..527c65d76e0 100644 --- a/neutron/agent/securitygroups_rpc.py +++ b/neutron/agent/securitygroups_rpc.py @@ -17,6 +17,7 @@ import functools from oslo_config import cfg +from oslo_log import log as logging import oslo_messaging from oslo_utils import importutils @@ -25,7 +26,6 @@ from neutron.common import constants from neutron.common import rpc as n_rpc from neutron.common import topics from neutron.i18n import _LI, _LW -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) # history diff --git a/neutron/api/api_common.py b/neutron/api/api_common.py index b34765e3449..b97e3a39130 100644 --- a/neutron/api/api_common.py +++ b/neutron/api/api_common.py @@ -16,12 +16,12 @@ import urllib from oslo_config import cfg +from oslo_log import log as logging from webob import exc from neutron.common import constants from neutron.common import exceptions from neutron.i18n import _LW -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/api/extensions.py b/neutron/api/extensions.py index b47bc6149dd..aa4e2b9572d 100644 --- a/neutron/api/extensions.py +++ b/neutron/api/extensions.py @@ -21,6 +21,7 @@ import itertools import os from oslo_config import cfg +from oslo_log import log as logging import routes import six import webob.dec @@ -31,7 +32,6 @@ from neutron.common import repos import neutron.extensions from neutron.i18n import _LE, _LI, _LW from neutron import manager -from neutron.openstack.common import log as logging from neutron import wsgi diff --git a/neutron/api/rpc/agentnotifiers/dhcp_rpc_agent_api.py b/neutron/api/rpc/agentnotifiers/dhcp_rpc_agent_api.py index 3f2fbc0e2f6..edba999747f 100644 --- a/neutron/api/rpc/agentnotifiers/dhcp_rpc_agent_api.py +++ b/neutron/api/rpc/agentnotifiers/dhcp_rpc_agent_api.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from oslo_log import log as logging import oslo_messaging from neutron.common import constants @@ -21,7 +22,6 @@ from neutron.common import topics from neutron.common import utils from neutron.i18n import _LE, _LW from neutron import manager -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/api/rpc/agentnotifiers/l3_rpc_agent_api.py b/neutron/api/rpc/agentnotifiers/l3_rpc_agent_api.py index 07d95d65d33..097e7f88bd7 100644 --- a/neutron/api/rpc/agentnotifiers/l3_rpc_agent_api.py +++ b/neutron/api/rpc/agentnotifiers/l3_rpc_agent_api.py @@ -15,6 +15,7 @@ import random +from oslo_log import log as logging import oslo_messaging from neutron.common import constants @@ -23,7 +24,6 @@ from neutron.common import topics from neutron.common import utils from neutron.i18n import _LE from neutron import manager -from neutron.openstack.common import log as logging from neutron.plugins.common import constants as service_constants diff --git a/neutron/api/rpc/agentnotifiers/metering_rpc_agent_api.py b/neutron/api/rpc/agentnotifiers/metering_rpc_agent_api.py index d3be6b1079c..f7640cf8fa0 100644 --- a/neutron/api/rpc/agentnotifiers/metering_rpc_agent_api.py +++ b/neutron/api/rpc/agentnotifiers/metering_rpc_agent_api.py @@ -12,6 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging import oslo_messaging from neutron.common import constants @@ -19,7 +20,6 @@ from neutron.common import rpc as n_rpc from neutron.common import topics from neutron.common import utils from neutron import manager -from neutron.openstack.common import log as logging from neutron.plugins.common import constants as service_constants LOG = logging.getLogger(__name__) diff --git a/neutron/api/rpc/handlers/dhcp_rpc.py b/neutron/api/rpc/handlers/dhcp_rpc.py index bbe68f8955e..4e17e39dda0 100644 --- a/neutron/api/rpc/handlers/dhcp_rpc.py +++ b/neutron/api/rpc/handlers/dhcp_rpc.py @@ -18,6 +18,7 @@ import operator from oslo_config import cfg from oslo_db import exception as db_exc +from oslo_log import log as logging import oslo_messaging from oslo_utils import excutils @@ -28,7 +29,6 @@ from neutron.common import utils from neutron.extensions import portbindings from neutron.i18n import _LW from neutron import manager -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/api/rpc/handlers/dvr_rpc.py b/neutron/api/rpc/handlers/dvr_rpc.py index fb0e083b515..bbfe6e02a46 100644 --- a/neutron/api/rpc/handlers/dvr_rpc.py +++ b/neutron/api/rpc/handlers/dvr_rpc.py @@ -13,6 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging import oslo_messaging from neutron.common import constants @@ -20,7 +21,6 @@ from neutron.common import log from neutron.common import rpc as n_rpc from neutron.common import topics from neutron import manager -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/api/rpc/handlers/l3_rpc.py b/neutron/api/rpc/handlers/l3_rpc.py index 2ae38c2aa1a..0c979d377c6 100644 --- a/neutron/api/rpc/handlers/l3_rpc.py +++ b/neutron/api/rpc/handlers/l3_rpc.py @@ -14,6 +14,7 @@ # limitations under the License. from oslo_config import cfg +from oslo_log import log as logging import oslo_messaging from oslo_serialization import jsonutils @@ -25,7 +26,6 @@ from neutron.extensions import l3 from neutron.extensions import portbindings from neutron.i18n import _LE from neutron import manager -from neutron.openstack.common import log as logging from neutron.plugins.common import constants as plugin_constants diff --git a/neutron/api/v2/attributes.py b/neutron/api/v2/attributes.py index 7fb4a440973..34d55b03cb9 100644 --- a/neutron/api/v2/attributes.py +++ b/neutron/api/v2/attributes.py @@ -13,12 +13,13 @@ # License for the specific language governing permissions and limitations # under the License. -import netaddr import re +import netaddr +from oslo_log import log as logging + from neutron.common import constants from neutron.common import exceptions as n_exc -from neutron.openstack.common import log as logging from neutron.openstack.common import uuidutils diff --git a/neutron/api/v2/base.py b/neutron/api/v2/base.py index fdcc04de2fc..e32c85f11eb 100644 --- a/neutron/api/v2/base.py +++ b/neutron/api/v2/base.py @@ -14,11 +14,12 @@ # under the License. import copy -import netaddr -import webob.exc +import netaddr from oslo_config import cfg +from oslo_log import log as logging from oslo_utils import excutils +import webob.exc from neutron.api import api_common from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api @@ -28,7 +29,6 @@ from neutron.common import constants as const from neutron.common import exceptions from neutron.common import rpc as n_rpc from neutron.i18n import _LE, _LI -from neutron.openstack.common import log as logging from neutron.openstack.common import policy as common_policy from neutron import policy from neutron import quota diff --git a/neutron/api/v2/resource.py b/neutron/api/v2/resource.py index 34bd428e772..09919b93815 100644 --- a/neutron/api/v2/resource.py +++ b/neutron/api/v2/resource.py @@ -21,13 +21,13 @@ import sys import netaddr import oslo_i18n +from oslo_log import log as logging import six import webob.dec import webob.exc from neutron.common import exceptions from neutron.i18n import _LE, _LI -from neutron.openstack.common import log as logging from neutron.openstack.common import policy as common_policy from neutron import wsgi diff --git a/neutron/api/v2/router.py b/neutron/api/v2/router.py index b1522f6096f..de0147db410 100644 --- a/neutron/api/v2/router.py +++ b/neutron/api/v2/router.py @@ -14,6 +14,7 @@ # limitations under the License. from oslo_config import cfg +from oslo_log import log as logging import routes as routes_mapper import six.moves.urllib.parse as urlparse import webob @@ -24,7 +25,6 @@ from neutron.api import extensions from neutron.api.v2 import attributes from neutron.api.v2 import base from neutron import manager -from neutron.openstack.common import log as logging from neutron import policy from neutron import wsgi diff --git a/neutron/api/versions.py b/neutron/api/versions.py index d9c1b4d0cbd..3d9cfec6c38 100644 --- a/neutron/api/versions.py +++ b/neutron/api/versions.py @@ -14,10 +14,10 @@ # under the License. import oslo_i18n +from oslo_log import log as logging import webob.dec from neutron.api.views import versions as versions_view -from neutron.openstack.common import log as logging from neutron import wsgi diff --git a/neutron/auth.py b/neutron/auth.py index 09ce3d2ebcc..b8c45e2e804 100644 --- a/neutron/auth.py +++ b/neutron/auth.py @@ -13,12 +13,12 @@ # under the License. from oslo_config import cfg +from oslo_log import log as logging from oslo_middleware import request_id import webob.dec import webob.exc from neutron import context -from neutron.openstack.common import log as logging from neutron import wsgi LOG = logging.getLogger(__name__) diff --git a/neutron/callbacks/manager.py b/neutron/callbacks/manager.py index eda43e05235..365a54f27f3 100644 --- a/neutron/callbacks/manager.py +++ b/neutron/callbacks/manager.py @@ -13,13 +13,13 @@ import collections import weakref +from oslo_log import log as logging from oslo_utils import reflection from neutron.callbacks import events from neutron.callbacks import exceptions from neutron.callbacks import resources from neutron.i18n import _LE, _LI -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/cmd/netns_cleanup.py b/neutron/cmd/netns_cleanup.py index e579693b9d3..570ca71de55 100644 --- a/neutron/cmd/netns_cleanup.py +++ b/neutron/cmd/netns_cleanup.py @@ -17,6 +17,7 @@ import re import time from oslo_config import cfg +from oslo_log import log as logging from oslo_utils import importutils from neutron.agent.common import config as agent_config @@ -29,7 +30,6 @@ from neutron.agent.linux import ovs_lib from neutron.api.v2 import attributes from neutron.common import config from neutron.i18n import _LE -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/cmd/ovs_cleanup.py b/neutron/cmd/ovs_cleanup.py index a5010466a82..180fae8ec6e 100644 --- a/neutron/cmd/ovs_cleanup.py +++ b/neutron/cmd/ovs_cleanup.py @@ -14,6 +14,7 @@ # under the License. from oslo_config import cfg +from oslo_log import log as logging from neutron.agent.common import config as agent_config from neutron.agent.l3 import config as l3_config @@ -22,7 +23,6 @@ from neutron.agent.linux import ip_lib from neutron.agent.linux import ovs_lib from neutron.common import config from neutron.i18n import _LI -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/cmd/sanity/checks.py b/neutron/cmd/sanity/checks.py index 210e22f5f02..c0245bc17b5 100644 --- a/neutron/cmd/sanity/checks.py +++ b/neutron/cmd/sanity/checks.py @@ -16,6 +16,7 @@ import re import netaddr +from oslo_log import log as logging from neutron.agent.linux import ip_lib from neutron.agent.linux import ip_link_support @@ -23,7 +24,6 @@ from neutron.agent.linux import ovs_lib from neutron.agent.linux import utils as agent_utils from neutron.common import utils from neutron.i18n import _LE -from neutron.openstack.common import log as logging from neutron.openstack.common import uuidutils from neutron.plugins.common import constants as const from neutron.plugins.openvswitch.common import constants as ovs_const diff --git a/neutron/cmd/sanity_check.py b/neutron/cmd/sanity_check.py index 92e61d57297..58531879a71 100644 --- a/neutron/cmd/sanity_check.py +++ b/neutron/cmd/sanity_check.py @@ -15,12 +15,13 @@ import sys +from oslo_config import cfg +from oslo_log import log as logging + from neutron.agent import dhcp_agent from neutron.cmd.sanity import checks from neutron.common import config from neutron.i18n import _LE, _LW -from neutron.openstack.common import log as logging -from oslo_config import cfg LOG = logging.getLogger(__name__) diff --git a/neutron/common/config.py b/neutron/common/config.py index 696f1c4f913..194f8f9492d 100644 --- a/neutron/common/config.py +++ b/neutron/common/config.py @@ -24,13 +24,13 @@ from keystoneclient import auth from keystoneclient import session as ks_session from oslo_config import cfg from oslo_db import options as db_options +from oslo_log import log as logging import oslo_messaging from paste import deploy from neutron.api.v2 import attributes from neutron.common import utils from neutron.i18n import _LI -from neutron.openstack.common import log as logging from neutron import version @@ -163,6 +163,8 @@ nova_opts = [ ] cfg.CONF.register_opts(nova_opts, group=NOVA_CONF_SECTION) +logging.register_options(cfg.CONF) + def init(args, **kwargs): cfg.CONF(args=args, project='neutron', @@ -185,7 +187,7 @@ def init(args, **kwargs): def setup_logging(): """Sets up the logging options for a log with supplied name.""" product_name = "neutron" - logging.setup(product_name) + logging.setup(cfg.CONF, product_name) LOG.info(_LI("Logging enabled!")) LOG.info(_LI("%(prog)s version %(version)s"), {'prog': sys.argv[0], diff --git a/neutron/common/ipv6_utils.py b/neutron/common/ipv6_utils.py index e11a218ee4c..ad531baf387 100644 --- a/neutron/common/ipv6_utils.py +++ b/neutron/common/ipv6_utils.py @@ -19,10 +19,10 @@ IPv6-related utilities and helper functions. import os import netaddr +from oslo_log import log from neutron.common import constants from neutron.i18n import _LI -from neutron.openstack.common import log LOG = log.getLogger(__name__) diff --git a/neutron/common/log.py b/neutron/common/log.py index f1b5f425fd8..b5fcaf15bb9 100644 --- a/neutron/common/log.py +++ b/neutron/common/log.py @@ -15,7 +15,7 @@ """Log helper functions.""" import functools -from neutron.openstack.common import log as logging +from oslo_log import log as logging def log(method): diff --git a/neutron/common/repos.py b/neutron/common/repos.py index e2a421e4c7a..59b8735b7f2 100644 --- a/neutron/common/repos.py +++ b/neutron/common/repos.py @@ -18,8 +18,7 @@ import importlib import os from oslo_config import cfg - -from neutron.openstack.common import log as logging +from oslo_log import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/common/rpc.py b/neutron/common/rpc.py index 0bdd6c38704..732f0527f2a 100644 --- a/neutron/common/rpc.py +++ b/neutron/common/rpc.py @@ -15,12 +15,12 @@ # under the License. from oslo_config import cfg +from oslo_log import log as logging import oslo_messaging from oslo_messaging import serializer as om_serializer from neutron.common import exceptions from neutron import context -from neutron.openstack.common import log as logging from neutron.openstack.common import service diff --git a/neutron/common/utils.py b/neutron/common/utils.py index bd75238cc9b..9d6b6a1cce4 100644 --- a/neutron/common/utils.py +++ b/neutron/common/utils.py @@ -33,10 +33,10 @@ import uuid from eventlet.green import subprocess from oslo_concurrency import lockutils from oslo_config import cfg +from oslo_log import log as logging from oslo_utils import excutils from neutron.common import constants as q_const -from neutron.openstack.common import log as logging TIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ" diff --git a/neutron/context.py b/neutron/context.py index 4e3e4f2ef2a..1889b092dbe 100644 --- a/neutron/context.py +++ b/neutron/context.py @@ -19,10 +19,9 @@ import copy import datetime from oslo_context import context as oslo_context +from oslo_log import log as logging from neutron.db import api as db_api -from neutron.openstack.common import local -from neutron.openstack.common import log as logging from neutron import policy @@ -55,7 +54,8 @@ class ContextBase(oslo_context.RequestContext): super(ContextBase, self).__init__(auth_token=auth_token, user=user_id, tenant=tenant_id, is_admin=is_admin, - request_id=request_id) + request_id=request_id, + overwrite=overwrite) self.user_name = user_name self.tenant_name = tenant_name @@ -73,10 +73,6 @@ class ContextBase(oslo_context.RequestContext): admin_roles = policy.get_admin_roles() if admin_roles: self.roles = list(set(self.roles) | set(admin_roles)) - # Allow openstack.common.log to access the context - if overwrite or not hasattr(local.store, 'context'): - local.store.context = self - # Log only once the context has been configured to prevent # format errors. if kwargs: diff --git a/neutron/db/agents_db.py b/neutron/db/agents_db.py index 6cae2084be1..7596fef9d83 100644 --- a/neutron/db/agents_db.py +++ b/neutron/db/agents_db.py @@ -14,9 +14,9 @@ # under the License. from eventlet import greenthread - from oslo_config import cfg from oslo_db import exception as db_exc +from oslo_log import log as logging import oslo_messaging from oslo_serialization import jsonutils from oslo_utils import timeutils @@ -31,7 +31,6 @@ from neutron.db import models_v2 from neutron.extensions import agent as ext_agent from neutron.i18n import _LW from neutron import manager -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) cfg.CONF.register_opt( diff --git a/neutron/db/agentschedulers_db.py b/neutron/db/agentschedulers_db.py index e330b0fc390..4257144ac66 100644 --- a/neutron/db/agentschedulers_db.py +++ b/neutron/db/agentschedulers_db.py @@ -18,6 +18,7 @@ import random import time from oslo_config import cfg +from oslo_log import log as logging from oslo_utils import timeutils import sqlalchemy as sa from sqlalchemy import orm @@ -32,7 +33,6 @@ from neutron.db import model_base from neutron.extensions import agent as ext_agent from neutron.extensions import dhcpagentscheduler from neutron.i18n import _LE, _LI, _LW -from neutron.openstack.common import log as logging from neutron.openstack.common import loopingcall diff --git a/neutron/db/db_base_plugin_v2.py b/neutron/db/db_base_plugin_v2.py index 50f3bd41014..73db078b82a 100644 --- a/neutron/db/db_base_plugin_v2.py +++ b/neutron/db/db_base_plugin_v2.py @@ -16,6 +16,7 @@ import netaddr from oslo_config import cfg from oslo_db import exception as db_exc +from oslo_log import log as logging from oslo_utils import excutils from sqlalchemy import and_ from sqlalchemy import event @@ -35,7 +36,6 @@ from neutron.extensions import l3 from neutron.i18n import _LE, _LI from neutron import manager from neutron import neutron_plugin_base_v2 -from neutron.openstack.common import log as logging from neutron.openstack.common import uuidutils from neutron.plugins.common import constants as service_constants diff --git a/neutron/db/dvr_mac_db.py b/neutron/db/dvr_mac_db.py index f849c19f685..b432d8b84a3 100644 --- a/neutron/db/dvr_mac_db.py +++ b/neutron/db/dvr_mac_db.py @@ -13,9 +13,11 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_config import cfg from oslo_db import exception as db_exc - +from oslo_log import log as logging import sqlalchemy as sa +from sqlalchemy.orm import exc from neutron.common import exceptions as q_exc from neutron.common import log @@ -25,12 +27,11 @@ from neutron.extensions import dvr as ext_dvr from neutron.extensions import portbindings from neutron.i18n import _LE from neutron import manager -from neutron.openstack.common import log as logging -from oslo_config import cfg -from sqlalchemy.orm import exc + LOG = logging.getLogger(__name__) + dvr_mac_address_opts = [ cfg.StrOpt('dvr_base_mac', default="fa:16:3f:00:00:00", diff --git a/neutron/db/extradhcpopt_db.py b/neutron/db/extradhcpopt_db.py index fc58027c3d5..09d64c70d09 100644 --- a/neutron/db/extradhcpopt_db.py +++ b/neutron/db/extradhcpopt_db.py @@ -13,6 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging import sqlalchemy as sa from sqlalchemy import orm @@ -21,7 +22,7 @@ from neutron.db import db_base_plugin_v2 from neutron.db import model_base from neutron.db import models_v2 from neutron.extensions import extra_dhcp_opt as edo_ext -from neutron.openstack.common import log as logging + LOG = logging.getLogger(__name__) diff --git a/neutron/db/extraroute_db.py b/neutron/db/extraroute_db.py index 59027dc2199..5966439c96e 100644 --- a/neutron/db/extraroute_db.py +++ b/neutron/db/extraroute_db.py @@ -15,6 +15,7 @@ import netaddr from oslo_config import cfg +from oslo_log import log as logging import sqlalchemy as sa from sqlalchemy import orm @@ -25,7 +26,6 @@ from neutron.db import model_base from neutron.db import models_v2 from neutron.extensions import extraroute from neutron.extensions import l3 -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/db/l3_agentschedulers_db.py b/neutron/db/l3_agentschedulers_db.py index c0142b22b98..cb8206b74ce 100644 --- a/neutron/db/l3_agentschedulers_db.py +++ b/neutron/db/l3_agentschedulers_db.py @@ -12,8 +12,10 @@ # 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 oslo_config import cfg from oslo_db import exception as db_exc +from oslo_log import log as logging import oslo_messaging import sqlalchemy as sa from sqlalchemy import func @@ -32,7 +34,6 @@ from neutron.db import model_base from neutron.extensions import l3agentscheduler from neutron.i18n import _LE, _LI, _LW from neutron import manager -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/db/l3_db.py b/neutron/db/l3_db.py index f3aa036b4be..0ebefc83de9 100644 --- a/neutron/db/l3_db.py +++ b/neutron/db/l3_db.py @@ -13,6 +13,7 @@ # under the License. import netaddr +from oslo_log import log as logging import sqlalchemy as sa from sqlalchemy import orm from sqlalchemy.orm import exc @@ -35,7 +36,6 @@ from neutron.extensions import external_net from neutron.extensions import l3 from neutron.i18n import _LI from neutron import manager -from neutron.openstack.common import log as logging from neutron.openstack.common import uuidutils from neutron.plugins.common import constants diff --git a/neutron/db/l3_dvr_db.py b/neutron/db/l3_dvr_db.py index f507412dedf..f630cae5346 100644 --- a/neutron/db/l3_dvr_db.py +++ b/neutron/db/l3_dvr_db.py @@ -13,6 +13,7 @@ # under the License. from oslo_config import cfg +from oslo_log import log as logging from neutron.api.v2 import attributes from neutron.common import constants as l3_const @@ -26,7 +27,6 @@ from neutron.extensions import l3 from neutron.extensions import portbindings from neutron.i18n import _LI from neutron import manager -from neutron.openstack.common import log as logging from neutron.plugins.common import constants diff --git a/neutron/db/l3_dvrscheduler_db.py b/neutron/db/l3_dvrscheduler_db.py index 2d3eb4360c5..e367381be53 100644 --- a/neutron/db/l3_dvrscheduler_db.py +++ b/neutron/db/l3_dvrscheduler_db.py @@ -16,6 +16,7 @@ import random from oslo_db import exception as db_exc +from oslo_log import log as logging import sqlalchemy as sa from sqlalchemy import orm from sqlalchemy.orm import exc @@ -28,7 +29,6 @@ from neutron.db import l3_agentschedulers_db as l3agent_sch_db from neutron.db import model_base from neutron.db import models_v2 from neutron.i18n import _LI, _LW -from neutron.openstack.common import log as logging from neutron.plugins.ml2 import db as ml2_db LOG = logging.getLogger(__name__) diff --git a/neutron/db/l3_gwmode_db.py b/neutron/db/l3_gwmode_db.py index e9f081f6fce..6d4b3306180 100644 --- a/neutron/db/l3_gwmode_db.py +++ b/neutron/db/l3_gwmode_db.py @@ -13,13 +13,13 @@ # under the License. # +from oslo_log import log as logging import sqlalchemy as sa from sqlalchemy import sql from neutron.db import db_base_plugin_v2 from neutron.db import l3_db from neutron.extensions import l3 -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/db/l3_hamode_db.py b/neutron/db/l3_hamode_db.py index ce30fcb98a6..6b978cedb16 100644 --- a/neutron/db/l3_hamode_db.py +++ b/neutron/db/l3_hamode_db.py @@ -16,6 +16,7 @@ import netaddr from oslo_config import cfg from oslo_db import exception as db_exc +from oslo_log import log as logging from oslo_utils import excutils import sqlalchemy as sa from sqlalchemy import orm @@ -28,7 +29,6 @@ from neutron.db import model_base from neutron.db import models_v2 from neutron.extensions import l3_ext_ha_mode as l3_ha from neutron.i18n import _LI, _LW -from neutron.openstack.common import log as logging VR_ID_RANGE = set(range(1, 255)) MAX_ALLOCATION_TRIES = 10 diff --git a/neutron/db/metering/metering_db.py b/neutron/db/metering/metering_db.py index 242c76d5b90..f5f1643fbe3 100644 --- a/neutron/db/metering/metering_db.py +++ b/neutron/db/metering/metering_db.py @@ -13,6 +13,7 @@ # under the License. import netaddr +from oslo_log import log as logging import sqlalchemy as sa from sqlalchemy import orm from sqlalchemy import sql @@ -24,7 +25,6 @@ from neutron.db import l3_db from neutron.db import model_base from neutron.db import models_v2 from neutron.extensions import metering -from neutron.openstack.common import log as logging from neutron.openstack.common import uuidutils diff --git a/neutron/db/metering/metering_rpc.py b/neutron/db/metering/metering_rpc.py index 96c1eb28ac7..9fda950df60 100644 --- a/neutron/db/metering/metering_rpc.py +++ b/neutron/db/metering/metering_rpc.py @@ -12,13 +12,13 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging import oslo_messaging from neutron.common import constants as consts from neutron.common import utils from neutron.i18n import _LE from neutron import manager -from neutron.openstack.common import log as logging from neutron.plugins.common import constants as service_constants LOG = logging.getLogger(__name__) diff --git a/neutron/db/portsecurity_db.py b/neutron/db/portsecurity_db.py index 14423a46f30..8585fdf851d 100644 --- a/neutron/db/portsecurity_db.py +++ b/neutron/db/portsecurity_db.py @@ -12,6 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging import sqlalchemy as sa from sqlalchemy import orm from sqlalchemy.orm import exc @@ -21,7 +22,6 @@ from neutron.db import db_base_plugin_v2 from neutron.db import model_base from neutron.db import models_v2 from neutron.extensions import portsecurity as psec -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/db/securitygroups_db.py b/neutron/db/securitygroups_db.py index 658f27514ed..c12e60d1912 100644 --- a/neutron/db/securitygroups_db.py +++ b/neutron/db/securitygroups_db.py @@ -14,6 +14,7 @@ import netaddr from oslo_db import exception +from oslo_log import log as logging import sqlalchemy as sa from sqlalchemy import orm from sqlalchemy.orm import exc @@ -25,7 +26,6 @@ from neutron.db import db_base_plugin_v2 from neutron.db import model_base from neutron.db import models_v2 from neutron.extensions import securitygroup as ext_sg -from neutron.openstack.common import log as logging from neutron.openstack.common import uuidutils LOG = logging.getLogger(__name__) diff --git a/neutron/db/securitygroups_rpc_base.py b/neutron/db/securitygroups_rpc_base.py index 728312b5350..c47493599e1 100644 --- a/neutron/db/securitygroups_rpc_base.py +++ b/neutron/db/securitygroups_rpc_base.py @@ -14,6 +14,7 @@ # under the License. import netaddr +from oslo_log import log as logging from sqlalchemy.orm import exc from neutron.common import constants as q_const @@ -24,7 +25,6 @@ from neutron.db import models_v2 from neutron.db import securitygroups_db as sg_db from neutron.extensions import securitygroup as ext_sg from neutron.i18n import _LW -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/db/servicetype_db.py b/neutron/db/servicetype_db.py index 534ba1553db..46a9a944817 100644 --- a/neutron/db/servicetype_db.py +++ b/neutron/db/servicetype_db.py @@ -13,10 +13,10 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging import sqlalchemy as sa from neutron.db import model_base -from neutron.openstack.common import log as logging from neutron.services import provider_configuration as pconf LOG = logging.getLogger(__name__) diff --git a/neutron/db/sqlalchemyutils.py b/neutron/db/sqlalchemyutils.py index b21edc83e44..f3df78fceb1 100644 --- a/neutron/db/sqlalchemyutils.py +++ b/neutron/db/sqlalchemyutils.py @@ -13,12 +13,12 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging from six import moves import sqlalchemy from sqlalchemy.orm import properties from neutron.common import exceptions as n_exc -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/debug/commands.py b/neutron/debug/commands.py index f73703c2202..9f3d380c40a 100644 --- a/neutron/debug/commands.py +++ b/neutron/debug/commands.py @@ -17,9 +17,9 @@ from cliff import lister from neutronclient.common import utils from neutronclient.neutron import v2_0 as client from neutronclient.neutron.v2_0 import port +from oslo_log import log as logging from neutron.i18n import _LI -from neutron.openstack.common import log as logging class ProbeCommand(client.NeutronCommand): diff --git a/neutron/debug/debug_agent.py b/neutron/debug/debug_agent.py index a7f35dadec3..0b6e053edbb 100644 --- a/neutron/debug/debug_agent.py +++ b/neutron/debug/debug_agent.py @@ -18,12 +18,12 @@ import socket import netaddr from oslo_config import cfg +from oslo_log import log as logging from neutron.agent.linux import dhcp from neutron.agent.linux import ip_lib from neutron.agent.linux import utils from neutron.i18n import _LW -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/extensions/flavor.py b/neutron/extensions/flavor.py index c5937d932b4..8679259bd31 100644 --- a/neutron/extensions/flavor.py +++ b/neutron/extensions/flavor.py @@ -13,9 +13,10 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging + from neutron.api import extensions from neutron.api.v2 import attributes -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/extensions/l3agentscheduler.py b/neutron/extensions/l3agentscheduler.py index f18a7abdb31..c786680a437 100644 --- a/neutron/extensions/l3agentscheduler.py +++ b/neutron/extensions/l3agentscheduler.py @@ -15,6 +15,7 @@ import abc +from oslo_log import log as logging import webob.exc from neutron.api import extensions @@ -26,7 +27,6 @@ from neutron.common import rpc as n_rpc from neutron.extensions import agent from neutron.i18n import _LE from neutron import manager -from neutron.openstack.common import log as logging from neutron.plugins.common import constants as service_constants from neutron import policy from neutron import wsgi diff --git a/neutron/extensions/metering.py b/neutron/extensions/metering.py index 06536799983..8485fc40d85 100644 --- a/neutron/extensions/metering.py +++ b/neutron/extensions/metering.py @@ -14,13 +14,13 @@ import abc +from oslo_log import log as logging import six from neutron.api import extensions from neutron.api.v2 import attributes as attr from neutron.api.v2 import resource_helper from neutron.common import exceptions as nexception -from neutron.openstack.common import log as logging from neutron.plugins.common import constants from neutron.services import service_base diff --git a/neutron/extensions/servicetype.py b/neutron/extensions/servicetype.py index 5675c05c273..a972f6f45e9 100644 --- a/neutron/extensions/servicetype.py +++ b/neutron/extensions/servicetype.py @@ -13,11 +13,12 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging + from neutron.api import extensions from neutron.api.v2 import attributes from neutron.api.v2 import base from neutron.db import servicetype_db -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/hacking/checks.py b/neutron/hacking/checks.py index d19c71430bb..392f09d1526 100644 --- a/neutron/hacking/checks.py +++ b/neutron/hacking/checks.py @@ -29,8 +29,6 @@ import pep8 # neutron/tests/unit/hacking/test_checks.py _all_log_levels = { - # NOTE(yamamoto): Following nova which uses _() for audit. - 'audit': '_', 'error': '_LE', 'info': '_LI', 'warn': '_LW', diff --git a/neutron/manager.py b/neutron/manager.py index cfae3066789..503d79448e7 100644 --- a/neutron/manager.py +++ b/neutron/manager.py @@ -16,12 +16,12 @@ import weakref from oslo_config import cfg +from oslo_log import log as logging import oslo_messaging from oslo_utils import importutils from neutron.common import utils from neutron.i18n import _LE, _LI -from neutron.openstack.common import log as logging from neutron.openstack.common import periodic_task from neutron.plugins.common import constants diff --git a/neutron/notifiers/nova.py b/neutron/notifiers/nova.py index 39b3af78558..c31111f64de 100644 --- a/neutron/notifiers/nova.py +++ b/neutron/notifiers/nova.py @@ -20,6 +20,7 @@ from keystoneclient import session as ks_session from novaclient import client as nova_client from novaclient import exceptions as nova_exceptions from oslo_config import cfg +from oslo_log import log as logging from oslo_utils import importutils from sqlalchemy.orm import attributes as sql_attr @@ -27,7 +28,6 @@ from neutron.common import constants from neutron import context from neutron.i18n import _LE, _LI, _LW from neutron import manager -from neutron.openstack.common import log as logging from neutron.openstack.common import uuidutils diff --git a/neutron/openstack/common/local.py b/neutron/openstack/common/local.py deleted file mode 100644 index 0819d5b97cb..00000000000 --- a/neutron/openstack/common/local.py +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright 2011 OpenStack Foundation. -# 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. - -"""Local storage of variables using weak references""" - -import threading -import weakref - - -class WeakLocal(threading.local): - def __getattribute__(self, attr): - rval = super(WeakLocal, self).__getattribute__(attr) - if rval: - # NOTE(mikal): this bit is confusing. What is stored is a weak - # reference, not the value itself. We therefore need to lookup - # the weak reference and return the inner value here. - rval = rval() - return rval - - def __setattr__(self, attr, value): - value = weakref.ref(value) - return super(WeakLocal, self).__setattr__(attr, value) - - -# NOTE(mikal): the name "store" should be deprecated in the future -store = WeakLocal() - -# A "weak" store uses weak references and allows an object to fall out of scope -# when it falls out of scope in the code that uses the thread local storage. A -# "strong" store will hold a reference to the object so that it never falls out -# of scope. -weak_store = WeakLocal() -strong_store = threading.local() diff --git a/neutron/openstack/common/log.py b/neutron/openstack/common/log.py deleted file mode 100644 index ddb1891ad91..00000000000 --- a/neutron/openstack/common/log.py +++ /dev/null @@ -1,718 +0,0 @@ -# Copyright 2011 OpenStack Foundation. -# Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. -# 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. - -"""OpenStack logging handler. - -This module adds to logging functionality by adding the option to specify -a context object when calling the various log methods. If the context object -is not specified, default formatting is used. Additionally, an instance uuid -may be passed as part of the log message, which is intended to make it easier -for admins to find messages related to a specific instance. - -It also allows setting of formatting information through conf. - -""" - -import copy -import inspect -import itertools -import logging -import logging.config -import logging.handlers -import os -import socket -import sys -import traceback - -from oslo.config import cfg -from oslo.serialization import jsonutils -from oslo.utils import importutils -import six -from six import moves - -_PY26 = sys.version_info[0:2] == (2, 6) - -from neutron.openstack.common._i18n import _ -from neutron.openstack.common import local - - -_DEFAULT_LOG_DATE_FORMAT = "%Y-%m-%d %H:%M:%S" - - -common_cli_opts = [ - cfg.BoolOpt('debug', - short='d', - default=False, - help='Print debugging output (set logging level to ' - 'DEBUG instead of default WARNING level).'), - cfg.BoolOpt('verbose', - short='v', - default=False, - help='Print more verbose output (set logging level to ' - 'INFO instead of default WARNING level).'), -] - -logging_cli_opts = [ - cfg.StrOpt('log-config-append', - metavar='PATH', - deprecated_name='log-config', - help='The name of a logging configuration file. This file ' - 'is appended to any existing logging configuration ' - 'files. For details about logging configuration files, ' - 'see the Python logging module documentation.'), - cfg.StrOpt('log-format', - metavar='FORMAT', - help='DEPRECATED. ' - 'A logging.Formatter log message format string which may ' - 'use any of the available logging.LogRecord attributes. ' - 'This option is deprecated. Please use ' - 'logging_context_format_string and ' - 'logging_default_format_string instead.'), - cfg.StrOpt('log-date-format', - default=_DEFAULT_LOG_DATE_FORMAT, - metavar='DATE_FORMAT', - help='Format string for %%(asctime)s in log records. ' - 'Default: %(default)s .'), - cfg.StrOpt('log-file', - metavar='PATH', - deprecated_name='logfile', - help='(Optional) Name of log file to output to. ' - 'If no default is set, logging will go to stdout.'), - cfg.StrOpt('log-dir', - deprecated_name='logdir', - help='(Optional) The base directory used for relative ' - '--log-file paths.'), - cfg.BoolOpt('use-syslog', - default=False, - help='Use syslog for logging. ' - 'Existing syslog format is DEPRECATED during I, ' - 'and will change in J to honor RFC5424.'), - cfg.BoolOpt('use-syslog-rfc-format', - # TODO(bogdando) remove or use True after existing - # syslog format deprecation in J - default=False, - help='(Optional) Enables or disables syslog rfc5424 format ' - 'for logging. If enabled, prefixes the MSG part of the ' - 'syslog message with APP-NAME (RFC5424). The ' - 'format without the APP-NAME is deprecated in I, ' - 'and will be removed in J.'), - cfg.StrOpt('syslog-log-facility', - default='LOG_USER', - help='Syslog facility to receive log lines.') -] - -generic_log_opts = [ - cfg.BoolOpt('use_stderr', - default=True, - help='Log output to standard error.') -] - -DEFAULT_LOG_LEVELS = ['amqp=WARN', 'amqplib=WARN', 'boto=WARN', - 'qpid=WARN', 'sqlalchemy=WARN', 'suds=INFO', - 'oslo.messaging=INFO', 'iso8601=WARN', - 'requests.packages.urllib3.connectionpool=WARN', - 'urllib3.connectionpool=WARN', 'websocket=WARN', - "keystonemiddleware=WARN", "routes.middleware=WARN", - "stevedore=WARN"] - -log_opts = [ - cfg.StrOpt('logging_context_format_string', - default='%(asctime)s.%(msecs)03d %(process)d %(levelname)s ' - '%(name)s [%(request_id)s %(user_identity)s] ' - '%(instance)s%(message)s', - help='Format string to use for log messages with context.'), - cfg.StrOpt('logging_default_format_string', - default='%(asctime)s.%(msecs)03d %(process)d %(levelname)s ' - '%(name)s [-] %(instance)s%(message)s', - help='Format string to use for log messages without context.'), - cfg.StrOpt('logging_debug_format_suffix', - default='%(funcName)s %(pathname)s:%(lineno)d', - help='Data to append to log format when level is DEBUG.'), - cfg.StrOpt('logging_exception_prefix', - default='%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s ' - '%(instance)s', - help='Prefix each line of exception output with this format.'), - cfg.ListOpt('default_log_levels', - default=DEFAULT_LOG_LEVELS, - help='List of logger=LEVEL pairs.'), - cfg.BoolOpt('publish_errors', - default=False, - help='Enables or disables publication of error events.'), - cfg.BoolOpt('fatal_deprecations', - default=False, - help='Enables or disables fatal status of deprecations.'), - - # NOTE(mikal): there are two options here because sometimes we are handed - # a full instance (and could include more information), and other times we - # are just handed a UUID for the instance. - cfg.StrOpt('instance_format', - default='[instance: %(uuid)s] ', - help='The format for an instance that is passed with the log ' - 'message.'), - cfg.StrOpt('instance_uuid_format', - default='[instance: %(uuid)s] ', - help='The format for an instance UUID that is passed with the ' - 'log message.'), -] - -CONF = cfg.CONF -CONF.register_cli_opts(common_cli_opts) -CONF.register_cli_opts(logging_cli_opts) -CONF.register_opts(generic_log_opts) -CONF.register_opts(log_opts) - - -def list_opts(): - """Entry point for oslo.config-generator.""" - return [(None, copy.deepcopy(common_cli_opts)), - (None, copy.deepcopy(logging_cli_opts)), - (None, copy.deepcopy(generic_log_opts)), - (None, copy.deepcopy(log_opts)), - ] - - -# our new audit level -# NOTE(jkoelker) Since we synthesized an audit level, make the logging -# module aware of it so it acts like other levels. -logging.AUDIT = logging.INFO + 1 -logging.addLevelName(logging.AUDIT, 'AUDIT') - - -try: - NullHandler = logging.NullHandler -except AttributeError: # NOTE(jkoelker) NullHandler added in Python 2.7 - class NullHandler(logging.Handler): - def handle(self, record): - pass - - def emit(self, record): - pass - - def createLock(self): - self.lock = None - - -def _dictify_context(context): - if context is None: - return None - if not isinstance(context, dict) and getattr(context, 'to_dict', None): - context = context.to_dict() - return context - - -def _get_binary_name(): - return os.path.basename(inspect.stack()[-1][1]) - - -def _get_log_file_path(binary=None): - logfile = CONF.log_file - logdir = CONF.log_dir - - if logfile and not logdir: - return logfile - - if logfile and logdir: - return os.path.join(logdir, logfile) - - if logdir: - binary = binary or _get_binary_name() - return '%s.log' % (os.path.join(logdir, binary),) - - return None - - -class BaseLoggerAdapter(logging.LoggerAdapter): - - def audit(self, msg, *args, **kwargs): - self.log(logging.AUDIT, msg, *args, **kwargs) - - def isEnabledFor(self, level): - if _PY26: - # This method was added in python 2.7 (and it does the exact - # same logic, so we need to do the exact same logic so that - # python 2.6 has this capability as well). - return self.logger.isEnabledFor(level) - else: - return super(BaseLoggerAdapter, self).isEnabledFor(level) - - -class LazyAdapter(BaseLoggerAdapter): - def __init__(self, name='unknown', version='unknown'): - self._logger = None - self.extra = {} - self.name = name - self.version = version - - @property - def logger(self): - if not self._logger: - self._logger = getLogger(self.name, self.version) - if six.PY3: - # In Python 3, the code fails because the 'manager' attribute - # cannot be found when using a LoggerAdapter as the - # underlying logger. Work around this issue. - self._logger.manager = self._logger.logger.manager - return self._logger - - -class ContextAdapter(BaseLoggerAdapter): - warn = logging.LoggerAdapter.warning - - def __init__(self, logger, project_name, version_string): - self.logger = logger - self.project = project_name - self.version = version_string - self._deprecated_messages_sent = dict() - - @property - def handlers(self): - return self.logger.handlers - - def deprecated(self, msg, *args, **kwargs): - """Call this method when a deprecated feature is used. - - If the system is configured for fatal deprecations then the message - is logged at the 'critical' level and :class:`DeprecatedConfig` will - be raised. - - Otherwise, the message will be logged (once) at the 'warn' level. - - :raises: :class:`DeprecatedConfig` if the system is configured for - fatal deprecations. - - """ - stdmsg = _("Deprecated: %s") % msg - if CONF.fatal_deprecations: - self.critical(stdmsg, *args, **kwargs) - raise DeprecatedConfig(msg=stdmsg) - - # Using a list because a tuple with dict can't be stored in a set. - sent_args = self._deprecated_messages_sent.setdefault(msg, list()) - - if args in sent_args: - # Already logged this message, so don't log it again. - return - - sent_args.append(args) - self.warn(stdmsg, *args, **kwargs) - - def process(self, msg, kwargs): - # NOTE(jecarey): If msg is not unicode, coerce it into unicode - # before it can get to the python logging and - # possibly cause string encoding trouble - if not isinstance(msg, six.text_type): - msg = six.text_type(msg) - - if 'extra' not in kwargs: - kwargs['extra'] = {} - extra = kwargs['extra'] - - context = kwargs.pop('context', None) - if not context: - context = getattr(local.store, 'context', None) - if context: - extra.update(_dictify_context(context)) - - instance = kwargs.pop('instance', None) - instance_uuid = (extra.get('instance_uuid') or - kwargs.pop('instance_uuid', None)) - instance_extra = '' - if instance: - instance_extra = CONF.instance_format % instance - elif instance_uuid: - instance_extra = (CONF.instance_uuid_format - % {'uuid': instance_uuid}) - extra['instance'] = instance_extra - - extra.setdefault('user_identity', kwargs.pop('user_identity', None)) - - extra['project'] = self.project - extra['version'] = self.version - extra['extra'] = extra.copy() - return msg, kwargs - - -class JSONFormatter(logging.Formatter): - def __init__(self, fmt=None, datefmt=None): - # NOTE(jkoelker) we ignore the fmt argument, but its still there - # since logging.config.fileConfig passes it. - self.datefmt = datefmt - - def formatException(self, ei, strip_newlines=True): - lines = traceback.format_exception(*ei) - if strip_newlines: - lines = [moves.filter( - lambda x: x, - line.rstrip().splitlines()) for line in lines] - lines = list(itertools.chain(*lines)) - return lines - - def format(self, record): - message = {'message': record.getMessage(), - 'asctime': self.formatTime(record, self.datefmt), - 'name': record.name, - 'msg': record.msg, - 'args': record.args, - 'levelname': record.levelname, - 'levelno': record.levelno, - 'pathname': record.pathname, - 'filename': record.filename, - 'module': record.module, - 'lineno': record.lineno, - 'funcname': record.funcName, - 'created': record.created, - 'msecs': record.msecs, - 'relative_created': record.relativeCreated, - 'thread': record.thread, - 'thread_name': record.threadName, - 'process_name': record.processName, - 'process': record.process, - 'traceback': None} - - if hasattr(record, 'extra'): - message['extra'] = record.extra - - if record.exc_info: - message['traceback'] = self.formatException(record.exc_info) - - return jsonutils.dumps(message) - - -def _create_logging_excepthook(product_name): - def logging_excepthook(exc_type, value, tb): - extra = {'exc_info': (exc_type, value, tb)} - getLogger(product_name).critical( - "".join(traceback.format_exception_only(exc_type, value)), - **extra) - return logging_excepthook - - -class LogConfigError(Exception): - - message = _('Error loading logging config %(log_config)s: %(err_msg)s') - - def __init__(self, log_config, err_msg): - self.log_config = log_config - self.err_msg = err_msg - - def __str__(self): - return self.message % dict(log_config=self.log_config, - err_msg=self.err_msg) - - -def _load_log_config(log_config_append): - try: - logging.config.fileConfig(log_config_append, - disable_existing_loggers=False) - except (moves.configparser.Error, KeyError) as exc: - raise LogConfigError(log_config_append, six.text_type(exc)) - - -def setup(product_name, version='unknown'): - """Setup logging.""" - if CONF.log_config_append: - _load_log_config(CONF.log_config_append) - else: - _setup_logging_from_conf(product_name, version) - sys.excepthook = _create_logging_excepthook(product_name) - - -def set_defaults(logging_context_format_string=None, - default_log_levels=None): - # Just in case the caller is not setting the - # default_log_level. This is insurance because - # we introduced the default_log_level parameter - # later in a backwards in-compatible change - if default_log_levels is not None: - cfg.set_defaults( - log_opts, - default_log_levels=default_log_levels) - if logging_context_format_string is not None: - cfg.set_defaults( - log_opts, - logging_context_format_string=logging_context_format_string) - - -def _find_facility_from_conf(): - facility_names = logging.handlers.SysLogHandler.facility_names - facility = getattr(logging.handlers.SysLogHandler, - CONF.syslog_log_facility, - None) - - if facility is None and CONF.syslog_log_facility in facility_names: - facility = facility_names.get(CONF.syslog_log_facility) - - if facility is None: - valid_facilities = facility_names.keys() - consts = ['LOG_AUTH', 'LOG_AUTHPRIV', 'LOG_CRON', 'LOG_DAEMON', - 'LOG_FTP', 'LOG_KERN', 'LOG_LPR', 'LOG_MAIL', 'LOG_NEWS', - 'LOG_AUTH', 'LOG_SYSLOG', 'LOG_USER', 'LOG_UUCP', - 'LOG_LOCAL0', 'LOG_LOCAL1', 'LOG_LOCAL2', 'LOG_LOCAL3', - 'LOG_LOCAL4', 'LOG_LOCAL5', 'LOG_LOCAL6', 'LOG_LOCAL7'] - valid_facilities.extend(consts) - raise TypeError(_('syslog facility must be one of: %s') % - ', '.join("'%s'" % fac - for fac in valid_facilities)) - - return facility - - -class RFCSysLogHandler(logging.handlers.SysLogHandler): - def __init__(self, *args, **kwargs): - self.binary_name = _get_binary_name() - # Do not use super() unless type(logging.handlers.SysLogHandler) - # is 'type' (Python 2.7). - # Use old style calls, if the type is 'classobj' (Python 2.6) - logging.handlers.SysLogHandler.__init__(self, *args, **kwargs) - - def format(self, record): - # Do not use super() unless type(logging.handlers.SysLogHandler) - # is 'type' (Python 2.7). - # Use old style calls, if the type is 'classobj' (Python 2.6) - msg = logging.handlers.SysLogHandler.format(self, record) - msg = self.binary_name + ' ' + msg - return msg - - -def _setup_logging_from_conf(project, version): - log_root = getLogger(None).logger - for handler in log_root.handlers: - log_root.removeHandler(handler) - - logpath = _get_log_file_path() - if logpath: - filelog = logging.handlers.WatchedFileHandler(logpath) - log_root.addHandler(filelog) - - if CONF.use_stderr: - streamlog = ColorHandler() - log_root.addHandler(streamlog) - - elif not logpath: - # pass sys.stdout as a positional argument - # python2.6 calls the argument strm, in 2.7 it's stream - streamlog = logging.StreamHandler(sys.stdout) - log_root.addHandler(streamlog) - - if CONF.publish_errors: - handler = importutils.import_object( - "oslo.messaging.notify.log_handler.PublishErrorsHandler", - logging.ERROR) - log_root.addHandler(handler) - - datefmt = CONF.log_date_format - for handler in log_root.handlers: - # NOTE(alaski): CONF.log_format overrides everything currently. This - # should be deprecated in favor of context aware formatting. - if CONF.log_format: - handler.setFormatter(logging.Formatter(fmt=CONF.log_format, - datefmt=datefmt)) - log_root.info('Deprecated: log_format is now deprecated and will ' - 'be removed in the next release') - else: - handler.setFormatter(ContextFormatter(project=project, - version=version, - datefmt=datefmt)) - - if CONF.debug: - log_root.setLevel(logging.DEBUG) - elif CONF.verbose: - log_root.setLevel(logging.INFO) - else: - log_root.setLevel(logging.WARNING) - - for pair in CONF.default_log_levels: - mod, _sep, level_name = pair.partition('=') - logger = logging.getLogger(mod) - # NOTE(AAzza) in python2.6 Logger.setLevel doesn't convert string name - # to integer code. - if sys.version_info < (2, 7): - level = logging.getLevelName(level_name) - logger.setLevel(level) - else: - logger.setLevel(level_name) - - if CONF.use_syslog: - try: - facility = _find_facility_from_conf() - # TODO(bogdando) use the format provided by RFCSysLogHandler - # after existing syslog format deprecation in J - if CONF.use_syslog_rfc_format: - syslog = RFCSysLogHandler(address='/dev/log', - facility=facility) - else: - syslog = logging.handlers.SysLogHandler(address='/dev/log', - facility=facility) - log_root.addHandler(syslog) - except socket.error: - log_root.error('Unable to add syslog handler. Verify that syslog ' - 'is running.') - - -_loggers = {} - - -def getLogger(name='unknown', version='unknown'): - if name not in _loggers: - _loggers[name] = ContextAdapter(logging.getLogger(name), - name, - version) - return _loggers[name] - - -def getLazyLogger(name='unknown', version='unknown'): - """Returns lazy logger. - - Creates a pass-through logger that does not create the real logger - until it is really needed and delegates all calls to the real logger - once it is created. - """ - return LazyAdapter(name, version) - - -class WritableLogger(object): - """A thin wrapper that responds to `write` and logs.""" - - def __init__(self, logger, level=logging.INFO): - self.logger = logger - self.level = level - - def write(self, msg): - self.logger.log(self.level, msg.rstrip()) - - -class ContextFormatter(logging.Formatter): - """A context.RequestContext aware formatter configured through flags. - - The flags used to set format strings are: logging_context_format_string - and logging_default_format_string. You can also specify - logging_debug_format_suffix to append extra formatting if the log level is - debug. - - For information about what variables are available for the formatter see: - http://docs.python.org/library/logging.html#formatter - - If available, uses the context value stored in TLS - local.store.context - - """ - - def __init__(self, *args, **kwargs): - """Initialize ContextFormatter instance - - Takes additional keyword arguments which can be used in the message - format string. - - :keyword project: project name - :type project: string - :keyword version: project version - :type version: string - - """ - - self.project = kwargs.pop('project', 'unknown') - self.version = kwargs.pop('version', 'unknown') - - logging.Formatter.__init__(self, *args, **kwargs) - - def format(self, record): - """Uses contextstring if request_id is set, otherwise default.""" - - # NOTE(jecarey): If msg is not unicode, coerce it into unicode - # before it can get to the python logging and - # possibly cause string encoding trouble - if not isinstance(record.msg, six.text_type): - record.msg = six.text_type(record.msg) - - # store project info - record.project = self.project - record.version = self.version - - # store request info - context = getattr(local.store, 'context', None) - if context: - d = _dictify_context(context) - for k, v in d.items(): - setattr(record, k, v) - - # NOTE(sdague): default the fancier formatting params - # to an empty string so we don't throw an exception if - # they get used - for key in ('instance', 'color', 'user_identity'): - if key not in record.__dict__: - record.__dict__[key] = '' - - if record.__dict__.get('request_id'): - fmt = CONF.logging_context_format_string - else: - fmt = CONF.logging_default_format_string - - if (record.levelno == logging.DEBUG and - CONF.logging_debug_format_suffix): - fmt += " " + CONF.logging_debug_format_suffix - - if sys.version_info < (3, 2): - self._fmt = fmt - else: - self._style = logging.PercentStyle(fmt) - self._fmt = self._style._fmt - # Cache this on the record, Logger will respect our formatted copy - if record.exc_info: - record.exc_text = self.formatException(record.exc_info, record) - return logging.Formatter.format(self, record) - - def formatException(self, exc_info, record=None): - """Format exception output with CONF.logging_exception_prefix.""" - if not record: - return logging.Formatter.formatException(self, exc_info) - - stringbuffer = moves.StringIO() - traceback.print_exception(exc_info[0], exc_info[1], exc_info[2], - None, stringbuffer) - lines = stringbuffer.getvalue().split('\n') - stringbuffer.close() - - if CONF.logging_exception_prefix.find('%(asctime)') != -1: - record.asctime = self.formatTime(record, self.datefmt) - - formatted_lines = [] - for line in lines: - pl = CONF.logging_exception_prefix % record.__dict__ - fl = '%s%s' % (pl, line) - formatted_lines.append(fl) - return '\n'.join(formatted_lines) - - -class ColorHandler(logging.StreamHandler): - LEVEL_COLORS = { - logging.DEBUG: '\033[00;32m', # GREEN - logging.INFO: '\033[00;36m', # CYAN - logging.AUDIT: '\033[01;36m', # BOLD CYAN - logging.WARN: '\033[01;33m', # BOLD YELLOW - logging.ERROR: '\033[01;31m', # BOLD RED - logging.CRITICAL: '\033[01;31m', # BOLD RED - } - - def format(self, record): - record.color = self.LEVEL_COLORS[record.levelno] - return logging.StreamHandler.format(self, record) - - -class DeprecatedConfig(Exception): - message = _("Fatal call to deprecated config: %(msg)s") - - def __init__(self, msg): - super(Exception, self).__init__(self.message % dict(msg=msg)) diff --git a/neutron/plugins/brocade/NeutronPlugin.py b/neutron/plugins/brocade/NeutronPlugin.py index b922b03ae00..cfb1d65d6d6 100644 --- a/neutron/plugins/brocade/NeutronPlugin.py +++ b/neutron/plugins/brocade/NeutronPlugin.py @@ -21,6 +21,7 @@ from oslo_config import cfg from oslo_context import context as oslo_context +from oslo_log import log as logging import oslo_messaging from oslo_utils import importutils @@ -47,7 +48,6 @@ from neutron.db import securitygroups_rpc_base as sg_db_rpc from neutron.extensions import portbindings from neutron.extensions import securitygroup as ext_sg from neutron.i18n import _LE, _LI -from neutron.openstack.common import log as logging from neutron.plugins.brocade.db import models as brocade_db from neutron.plugins.brocade import vlanbm as vbm from neutron.plugins.common import constants as svc_constants diff --git a/neutron/plugins/brocade/nos/nosdriver.py b/neutron/plugins/brocade/nos/nosdriver.py index 64c824eef24..3d87d939a78 100644 --- a/neutron/plugins/brocade/nos/nosdriver.py +++ b/neutron/plugins/brocade/nos/nosdriver.py @@ -19,10 +19,10 @@ Neutron network life-cycle management. """ from ncclient import manager +from oslo_log import log as logging from oslo_utils import excutils from neutron.i18n import _LE -from neutron.openstack.common import log as logging from neutron.plugins.brocade.nos import nctemplates as template diff --git a/neutron/plugins/brocade/tests/noscli.py b/neutron/plugins/brocade/tests/noscli.py index 41213b1a1eb..0becd48e411 100644 --- a/neutron/plugins/brocade/tests/noscli.py +++ b/neutron/plugins/brocade/tests/noscli.py @@ -21,7 +21,8 @@ from __future__ import print_function import argparse -from neutron.openstack.common import log as logging +from oslo_log import log as logging + from neutron.plugins.brocade.nos import nosdriver as nos LOG = logging.getLogger(__name__) diff --git a/neutron/plugins/cisco/db/n1kv_db_v2.py b/neutron/plugins/cisco/db/n1kv_db_v2.py index 5ba7c1e508d..aca3eca49a7 100644 --- a/neutron/plugins/cisco/db/n1kv_db_v2.py +++ b/neutron/plugins/cisco/db/n1kv_db_v2.py @@ -12,8 +12,10 @@ # License for the specific language governing permissions and limitations # under the License. -import netaddr import re + +import netaddr +from oslo_log import log as logging from sqlalchemy.orm import exc from sqlalchemy import sql @@ -23,7 +25,6 @@ from neutron.common import exceptions as n_exc import neutron.db.api as db from neutron.db import models_v2 from neutron.i18n import _LW -from neutron.openstack.common import log as logging from neutron.plugins.cisco.common import cisco_constants as c_const from neutron.plugins.cisco.common import cisco_exceptions as c_exc from neutron.plugins.cisco.common import config as c_conf diff --git a/neutron/plugins/cisco/db/n1kv_models_v2.py b/neutron/plugins/cisco/db/n1kv_models_v2.py index dbbbfb0919d..bb7c446a1b9 100644 --- a/neutron/plugins/cisco/db/n1kv_models_v2.py +++ b/neutron/plugins/cisco/db/n1kv_models_v2.py @@ -12,12 +12,12 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging import sqlalchemy as sa from sqlalchemy import sql from neutron.db import model_base from neutron.db import models_v2 -from neutron.openstack.common import log as logging from neutron.plugins.cisco.common import cisco_constants diff --git a/neutron/plugins/cisco/db/network_db_v2.py b/neutron/plugins/cisco/db/network_db_v2.py index f4724865b27..dab2e071a32 100644 --- a/neutron/plugins/cisco/db/network_db_v2.py +++ b/neutron/plugins/cisco/db/network_db_v2.py @@ -12,10 +12,10 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging from sqlalchemy.orm import exc from neutron.db import api as db -from neutron.openstack.common import log as logging from neutron.openstack.common import uuidutils from neutron.plugins.cisco.common import cisco_constants as const from neutron.plugins.cisco.common import cisco_exceptions as c_exc diff --git a/neutron/plugins/cisco/models/virt_phy_sw_v2.py b/neutron/plugins/cisco/models/virt_phy_sw_v2.py index 95d0a0a721b..13fecd6ae66 100644 --- a/neutron/plugins/cisco/models/virt_phy_sw_v2.py +++ b/neutron/plugins/cisco/models/virt_phy_sw_v2.py @@ -15,6 +15,7 @@ import inspect +from oslo_log import log as logging from oslo_utils import excutils from oslo_utils import importutils @@ -23,7 +24,6 @@ from neutron.extensions import portbindings from neutron.extensions import providernet as provider from neutron.i18n import _LE, _LI from neutron import neutron_plugin_base_v2 -from neutron.openstack.common import log as logging from neutron.plugins.cisco.common import cisco_constants as const from neutron.plugins.cisco.common import cisco_credentials_v2 as cred from neutron.plugins.cisco.common import config as conf diff --git a/neutron/plugins/cisco/n1kv/n1kv_client.py b/neutron/plugins/cisco/n1kv/n1kv_client.py index 9df4a4541a1..f7a54f50fc8 100644 --- a/neutron/plugins/cisco/n1kv/n1kv_client.py +++ b/neutron/plugins/cisco/n1kv/n1kv_client.py @@ -16,12 +16,12 @@ import base64 import eventlet import netaddr +from oslo_log import log as logging from oslo_serialization import jsonutils import requests from neutron.common import exceptions as n_exc from neutron.extensions import providernet -from neutron.openstack.common import log as logging from neutron.plugins.cisco.common import cisco_constants as c_const from neutron.plugins.cisco.common import cisco_credentials_v2 as c_cred from neutron.plugins.cisco.common import cisco_exceptions as c_exc diff --git a/neutron/plugins/cisco/n1kv/n1kv_neutron_plugin.py b/neutron/plugins/cisco/n1kv/n1kv_neutron_plugin.py index cb4b9b907cf..0b022947924 100644 --- a/neutron/plugins/cisco/n1kv/n1kv_neutron_plugin.py +++ b/neutron/plugins/cisco/n1kv/n1kv_neutron_plugin.py @@ -13,8 +13,8 @@ # under the License. import eventlet - from oslo_config import cfg as q_conf +from oslo_log import log as logging from oslo_utils import excutils from oslo_utils import importutils @@ -37,7 +37,6 @@ from neutron.extensions import portbindings from neutron.extensions import providernet from neutron.i18n import _LW from neutron import manager -from neutron.openstack.common import log as logging from neutron.openstack.common import uuidutils as uuidutils from neutron.plugins.cisco.common import cisco_constants as c_const from neutron.plugins.cisco.common import cisco_credentials_v2 as c_cred diff --git a/neutron/plugins/cisco/network_plugin.py b/neutron/plugins/cisco/network_plugin.py index 36ada7bf1f2..efeda970860 100644 --- a/neutron/plugins/cisco/network_plugin.py +++ b/neutron/plugins/cisco/network_plugin.py @@ -12,13 +12,13 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging from oslo_utils import importutils import webob.exc as wexc from neutron.api import extensions as neutron_extensions from neutron.api.v2 import base from neutron.db import db_base_plugin_v2 -from neutron.openstack.common import log as logging from neutron.plugins.cisco.common import cisco_exceptions as cexc from neutron.plugins.cisco.common import config from neutron.plugins.cisco.db import network_db_v2 as cdb diff --git a/neutron/plugins/embrane/agent/dispatcher.py b/neutron/plugins/embrane/agent/dispatcher.py index 2ce7db1b0a7..fb5101f88e7 100644 --- a/neutron/plugins/embrane/agent/dispatcher.py +++ b/neutron/plugins/embrane/agent/dispatcher.py @@ -17,9 +17,9 @@ from eventlet import greenthread from eventlet import queue from heleosapi import constants as h_con from heleosapi import exceptions as h_exc +from oslo_log import log as logging from neutron.i18n import _LE -from neutron.openstack.common import log as logging from neutron.plugins.embrane.agent.operations import router_operations from neutron.plugins.embrane.common import constants as p_con from neutron.plugins.embrane.common import contexts as ctx diff --git a/neutron/plugins/embrane/agent/operations/router_operations.py b/neutron/plugins/embrane/agent/operations/router_operations.py index c5cdcbbb9c7..e32f8adb7d2 100644 --- a/neutron/plugins/embrane/agent/operations/router_operations.py +++ b/neutron/plugins/embrane/agent/operations/router_operations.py @@ -16,9 +16,9 @@ import functools from heleosapi import exceptions as h_exc +from oslo_log import log as logging from neutron.i18n import _LW -from neutron.openstack.common import log as logging from neutron.plugins.embrane.common import constants as p_con LOG = logging.getLogger(__name__) diff --git a/neutron/plugins/embrane/base_plugin.py b/neutron/plugins/embrane/base_plugin.py index 3cf64945e9b..3995d4c6c65 100644 --- a/neutron/plugins/embrane/base_plugin.py +++ b/neutron/plugins/embrane/base_plugin.py @@ -17,6 +17,7 @@ from heleosapi import backend_operations as h_op from heleosapi import constants as h_con from heleosapi import exceptions as h_exc from oslo_config import cfg +from oslo_log import log as logging from sqlalchemy.orm import exc from neutron.common import constants as l3_constants @@ -26,7 +27,6 @@ from neutron.db import l3_db from neutron.db import models_v2 from neutron.extensions import l3 from neutron.i18n import _LE -from neutron.openstack.common import log as logging from neutron.plugins.embrane.agent import dispatcher from neutron.plugins.embrane.common import config # noqa from neutron.plugins.embrane.common import constants as p_con diff --git a/neutron/plugins/embrane/common/utils.py b/neutron/plugins/embrane/common/utils.py index 8eb4451a6b1..fbf6109fe05 100644 --- a/neutron/plugins/embrane/common/utils.py +++ b/neutron/plugins/embrane/common/utils.py @@ -14,11 +14,11 @@ # under the License. from heleosapi import info as h_info +from oslo_log import log as logging from neutron.common import constants from neutron.db import models_v2 from neutron.i18n import _LI -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/plugins/hyperv/agent/hyperv_neutron_agent.py b/neutron/plugins/hyperv/agent/hyperv_neutron_agent.py index 58580f5bd43..37bb6e724f4 100644 --- a/neutron/plugins/hyperv/agent/hyperv_neutron_agent.py +++ b/neutron/plugins/hyperv/agent/hyperv_neutron_agent.py @@ -23,6 +23,7 @@ import eventlet eventlet.monkey_patch() from oslo_config import cfg +from oslo_log import log as logging import oslo_messaging from neutron.agent.common import config @@ -33,7 +34,6 @@ from neutron.common import constants as n_const from neutron.common import topics from neutron import context from neutron.i18n import _LE, _LI -from neutron.openstack.common import log as logging from neutron.openstack.common import loopingcall from neutron.plugins.common import constants as p_const from neutron.plugins.hyperv.agent import utils diff --git a/neutron/plugins/hyperv/agent/security_groups_driver.py b/neutron/plugins/hyperv/agent/security_groups_driver.py index f275f6ecca7..12cfd5befae 100644 --- a/neutron/plugins/hyperv/agent/security_groups_driver.py +++ b/neutron/plugins/hyperv/agent/security_groups_driver.py @@ -13,9 +13,10 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging + from neutron.agent import firewall from neutron.i18n import _LE, _LI -from neutron.openstack.common import log as logging from neutron.plugins.hyperv.agent import utilsfactory from neutron.plugins.hyperv.agent import utilsv2 diff --git a/neutron/plugins/hyperv/agent/utils.py b/neutron/plugins/hyperv/agent/utils.py index 320b3b9185b..029e7c9eaf1 100644 --- a/neutron/plugins/hyperv/agent/utils.py +++ b/neutron/plugins/hyperv/agent/utils.py @@ -18,9 +18,9 @@ import sys import time from oslo_config import cfg +from oslo_log import log as logging from neutron.common import exceptions as n_exc -from neutron.openstack.common import log as logging # Check needed for unit testing on Unix if sys.platform == 'win32': diff --git a/neutron/plugins/hyperv/agent/utilsfactory.py b/neutron/plugins/hyperv/agent/utilsfactory.py index 89aa109d159..4bc0165c242 100644 --- a/neutron/plugins/hyperv/agent/utilsfactory.py +++ b/neutron/plugins/hyperv/agent/utilsfactory.py @@ -16,9 +16,9 @@ import sys from oslo_config import cfg +from oslo_log import log as logging from neutron.i18n import _LW -from neutron.openstack.common import log as logging from neutron.plugins.hyperv.agent import utils from neutron.plugins.hyperv.agent import utilsv2 diff --git a/neutron/plugins/ibm/agent/sdnve_neutron_agent.py b/neutron/plugins/ibm/agent/sdnve_neutron_agent.py index 00e7adc83b4..6434df544d5 100644 --- a/neutron/plugins/ibm/agent/sdnve_neutron_agent.py +++ b/neutron/plugins/ibm/agent/sdnve_neutron_agent.py @@ -23,6 +23,7 @@ import eventlet eventlet.monkey_patch() from oslo_config import cfg +from oslo_log import log as logging import oslo_messaging from neutron.agent.linux import ip_lib @@ -34,7 +35,6 @@ from neutron.common import topics from neutron.common import utils as n_utils from neutron.i18n import _LE, _LI from neutron import context -from neutron.openstack.common import log as logging from neutron.openstack.common import loopingcall from neutron.plugins.ibm.common import constants diff --git a/neutron/plugins/ibm/sdnve_api.py b/neutron/plugins/ibm/sdnve_api.py index e992d8dc539..91fe62f18c4 100644 --- a/neutron/plugins/ibm/sdnve_api.py +++ b/neutron/plugins/ibm/sdnve_api.py @@ -21,11 +21,11 @@ import urllib import httplib2 from keystoneclient.v2_0 import client as keyclient from oslo_config import cfg +from oslo_log import log as logging from neutron.api.v2 import attributes from neutron.common import utils from neutron.i18n import _LE, _LI -from neutron.openstack.common import log as logging from neutron.plugins.ibm.common import config # noqa from neutron.plugins.ibm.common import constants from neutron import wsgi diff --git a/neutron/plugins/ibm/sdnve_api_fake.py b/neutron/plugins/ibm/sdnve_api_fake.py index b1deeb1b610..a6c0aeedfc8 100644 --- a/neutron/plugins/ibm/sdnve_api_fake.py +++ b/neutron/plugins/ibm/sdnve_api_fake.py @@ -14,8 +14,9 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging + from neutron.i18n import _LI -from neutron.openstack.common import log as logging from neutron.plugins.ibm.common import constants LOG = logging.getLogger(__name__) diff --git a/neutron/plugins/ibm/sdnve_neutron_plugin.py b/neutron/plugins/ibm/sdnve_neutron_plugin.py index 92b5c4047fb..87cd5d5d107 100644 --- a/neutron/plugins/ibm/sdnve_neutron_plugin.py +++ b/neutron/plugins/ibm/sdnve_neutron_plugin.py @@ -18,6 +18,7 @@ import functools from oslo_config import cfg +from oslo_log import log as logging import oslo_messaging from oslo_utils import excutils @@ -33,7 +34,6 @@ from neutron.db import portbindings_db from neutron.db import quota_db # noqa from neutron.extensions import portbindings from neutron.i18n import _LE, _LI, _LW -from neutron.openstack.common import log as logging from neutron.plugins.ibm.common import config # noqa from neutron.plugins.ibm.common import constants from neutron.plugins.ibm.common import exceptions as sdnve_exc diff --git a/neutron/plugins/linuxbridge/agent/linuxbridge_neutron_agent.py b/neutron/plugins/linuxbridge/agent/linuxbridge_neutron_agent.py index 8f0193009a5..35aa66ab435 100755 --- a/neutron/plugins/linuxbridge/agent/linuxbridge_neutron_agent.py +++ b/neutron/plugins/linuxbridge/agent/linuxbridge_neutron_agent.py @@ -27,6 +27,7 @@ import eventlet eventlet.monkey_patch() from oslo_config import cfg +from oslo_log import log as logging import oslo_messaging from six import moves @@ -42,7 +43,6 @@ from neutron.common import topics from neutron.common import utils as q_utils from neutron import context from neutron.i18n import _LE, _LI, _LW -from neutron.openstack.common import log as logging from neutron.openstack.common import loopingcall from neutron.plugins.common import constants as p_const from neutron.plugins.linuxbridge.common import config # noqa diff --git a/neutron/plugins/ml2/db.py b/neutron/plugins/ml2/db.py index 8456d214ad0..73523ac74da 100644 --- a/neutron/plugins/ml2/db.py +++ b/neutron/plugins/ml2/db.py @@ -13,11 +13,11 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_db import exception as db_exc +from oslo_log import log from sqlalchemy import or_ from sqlalchemy.orm import exc -from oslo_db import exception as db_exc - from neutron.common import constants as n_const from neutron.db import api as db_api from neutron.db import models_v2 @@ -25,7 +25,6 @@ from neutron.db import securitygroups_db as sg_db from neutron.extensions import portbindings from neutron.i18n import _LE, _LI from neutron import manager -from neutron.openstack.common import log from neutron.openstack.common import uuidutils from neutron.plugins.ml2 import driver_api as api from neutron.plugins.ml2 import models diff --git a/neutron/plugins/ml2/driver_context.py b/neutron/plugins/ml2/driver_context.py index 88ff031db29..b0a77fa20d8 100644 --- a/neutron/plugins/ml2/driver_context.py +++ b/neutron/plugins/ml2/driver_context.py @@ -13,12 +13,12 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log from oslo_serialization import jsonutils from neutron.common import constants from neutron.extensions import portbindings from neutron.i18n import _LW -from neutron.openstack.common import log from neutron.plugins.ml2 import db from neutron.plugins.ml2 import driver_api as api diff --git a/neutron/plugins/ml2/drivers/arista/mechanism_arista.py b/neutron/plugins/ml2/drivers/arista/mechanism_arista.py index d99cdf4ce74..4011f1c38cb 100644 --- a/neutron/plugins/ml2/drivers/arista/mechanism_arista.py +++ b/neutron/plugins/ml2/drivers/arista/mechanism_arista.py @@ -18,10 +18,10 @@ import threading from networking_arista.common import db_lib from networking_arista.ml2 import arista_ml2 from oslo_config import cfg +from oslo_log import log as logging from neutron.common import constants as n_const from neutron.i18n import _LI -from neutron.openstack.common import log as logging from neutron.plugins.ml2.common import exceptions as ml2_exc from neutron.plugins.ml2 import driver_api from neutron.plugins.ml2.drivers.arista import config # noqa diff --git a/neutron/plugins/ml2/drivers/brocade/mechanism_brocade.py b/neutron/plugins/ml2/drivers/brocade/mechanism_brocade.py index a0592b3cc85..dd98bf7d4d9 100644 --- a/neutron/plugins/ml2/drivers/brocade/mechanism_brocade.py +++ b/neutron/plugins/ml2/drivers/brocade/mechanism_brocade.py @@ -17,11 +17,11 @@ """Implentation of Brocade ML2 Mechanism driver for ML2 Plugin.""" from oslo_config import cfg +from oslo_log import log as logging from oslo_utils import excutils from oslo_utils import importutils from neutron.i18n import _LE, _LI -from neutron.openstack.common import log as logging from neutron.plugins.ml2 import driver_api from neutron.plugins.ml2.drivers.brocade.db import models as brocade_db diff --git a/neutron/plugins/ml2/drivers/brocade/nos/nosdriver.py b/neutron/plugins/ml2/drivers/brocade/nos/nosdriver.py index a0a607ca3fb..1ae52d331fe 100644 --- a/neutron/plugins/ml2/drivers/brocade/nos/nosdriver.py +++ b/neutron/plugins/ml2/drivers/brocade/nos/nosdriver.py @@ -19,11 +19,11 @@ Neutron network life-cycle management. """ from ncclient import manager +from oslo_log import log as logging from oslo_utils import excutils from xml.etree import ElementTree from neutron.i18n import _LE -from neutron.openstack.common import log as logging from neutron.plugins.ml2.drivers.brocade.nos import nctemplates as template diff --git a/neutron/plugins/ml2/drivers/cisco/apic/apic_sync.py b/neutron/plugins/ml2/drivers/cisco/apic/apic_sync.py index b72cd6b8e6f..08873d70219 100644 --- a/neutron/plugins/ml2/drivers/cisco/apic/apic_sync.py +++ b/neutron/plugins/ml2/drivers/cisco/apic/apic_sync.py @@ -13,11 +13,12 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log + from neutron.common import constants as n_constants from neutron import context from neutron.i18n import _LW from neutron import manager -from neutron.openstack.common import log from neutron.openstack.common import loopingcall from neutron.plugins.ml2 import db as l2_db from neutron.plugins.ml2 import driver_context diff --git a/neutron/plugins/ml2/drivers/cisco/apic/apic_topology.py b/neutron/plugins/ml2/drivers/cisco/apic/apic_topology.py index 10fbc377da1..d4901bcf84c 100644 --- a/neutron/plugins/ml2/drivers/cisco/apic/apic_topology.py +++ b/neutron/plugins/ml2/drivers/cisco/apic/apic_topology.py @@ -17,11 +17,11 @@ import re import sys import eventlet - eventlet.monkey_patch() from oslo_concurrency import lockutils from oslo_config import cfg +from oslo_log import log as logging import oslo_messaging from neutron.agent.common import config @@ -33,7 +33,6 @@ from neutron.common import utils as neutron_utils from neutron.db import agents_db from neutron.i18n import _LE, _LI from neutron import manager -from neutron.openstack.common import log as logging from neutron.openstack.common import periodic_task from neutron.openstack.common import service as svc from neutron.plugins.ml2.drivers.cisco.apic import mechanism_apic as ma diff --git a/neutron/plugins/ml2/drivers/cisco/apic/mechanism_apic.py b/neutron/plugins/ml2/drivers/cisco/apic/mechanism_apic.py index f6fa93b098c..bb40f26bb27 100644 --- a/neutron/plugins/ml2/drivers/cisco/apic/mechanism_apic.py +++ b/neutron/plugins/ml2/drivers/cisco/apic/mechanism_apic.py @@ -18,9 +18,9 @@ from keystoneclient.v2_0 import client as keyclient import netaddr from oslo_concurrency import lockutils from oslo_config import cfg +from oslo_log import log from neutron.common import constants as n_constants -from neutron.openstack.common import log from neutron.plugins.common import constants from neutron.plugins.ml2 import driver_api as api from neutron.plugins.ml2.drivers.cisco.apic import apic_model diff --git a/neutron/plugins/ml2/drivers/cisco/ncs/driver.py b/neutron/plugins/ml2/drivers/cisco/ncs/driver.py index 06370423190..8fcfa721c87 100644 --- a/neutron/plugins/ml2/drivers/cisco/ncs/driver.py +++ b/neutron/plugins/ml2/drivers/cisco/ncs/driver.py @@ -16,10 +16,10 @@ import re from oslo_config import cfg +from oslo_log import log from oslo_serialization import jsonutils import requests -from neutron.openstack.common import log from neutron.plugins.ml2 import driver_api as api LOG = log.getLogger(__name__) diff --git a/neutron/plugins/ml2/drivers/freescale/mechanism_fslsdn.py b/neutron/plugins/ml2/drivers/freescale/mechanism_fslsdn.py index cc594dc8e2d..4c750ea7fa3 100755 --- a/neutron/plugins/ml2/drivers/freescale/mechanism_fslsdn.py +++ b/neutron/plugins/ml2/drivers/freescale/mechanism_fslsdn.py @@ -13,11 +13,12 @@ # See the License for the specific language governing permissions and # limitations under the License. +from oslo_log import log as logging + from neutron.common import constants as n_const from neutron.common import log from neutron.extensions import portbindings from neutron.i18n import _LI -from neutron.openstack.common import log as logging from neutron.plugins.common import constants from neutron.plugins.ml2 import driver_api as api from neutron.plugins.ml2.drivers.freescale import config # noqa diff --git a/neutron/plugins/ml2/drivers/helpers.py b/neutron/plugins/ml2/drivers/helpers.py index e39b53a7d08..e4da1d412ca 100644 --- a/neutron/plugins/ml2/drivers/helpers.py +++ b/neutron/plugins/ml2/drivers/helpers.py @@ -14,10 +14,10 @@ # under the License. from oslo_db import exception as db_exc +from oslo_log import log from neutron.common import exceptions as exc from neutron.i18n import _LW -from neutron.openstack.common import log from neutron.plugins.ml2 import driver_api as api diff --git a/neutron/plugins/ml2/drivers/l2pop/mech_driver.py b/neutron/plugins/ml2/drivers/l2pop/mech_driver.py index 99f56988999..5420e827a7c 100644 --- a/neutron/plugins/ml2/drivers/l2pop/mech_driver.py +++ b/neutron/plugins/ml2/drivers/l2pop/mech_driver.py @@ -14,12 +14,12 @@ # under the License. from oslo_config import cfg +from oslo_log import log as logging from neutron.common import constants as const from neutron import context as n_context from neutron.db import api as db_api from neutron.i18n import _LW -from neutron.openstack.common import log as logging from neutron.plugins.ml2.common import exceptions as ml2_exc from neutron.plugins.ml2 import driver_api as api from neutron.plugins.ml2.drivers.l2pop import config # noqa diff --git a/neutron/plugins/ml2/drivers/l2pop/rpc.py b/neutron/plugins/ml2/drivers/l2pop/rpc.py index 5dd7378bfaa..afa7e1b2a62 100644 --- a/neutron/plugins/ml2/drivers/l2pop/rpc.py +++ b/neutron/plugins/ml2/drivers/l2pop/rpc.py @@ -16,11 +16,11 @@ import collections import copy +from oslo_log import log as logging import oslo_messaging from neutron.common import rpc as n_rpc from neutron.common import topics -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/plugins/ml2/drivers/mech_agent.py b/neutron/plugins/ml2/drivers/mech_agent.py index 08365141e15..03fd8dc0db9 100644 --- a/neutron/plugins/ml2/drivers/mech_agent.py +++ b/neutron/plugins/ml2/drivers/mech_agent.py @@ -16,9 +16,10 @@ import abc import six +from oslo_log import log + from neutron.extensions import portbindings from neutron.i18n import _LW -from neutron.openstack.common import log from neutron.plugins.common import constants as p_constants from neutron.plugins.ml2 import driver_api as api diff --git a/neutron/plugins/ml2/drivers/mech_hyperv.py b/neutron/plugins/ml2/drivers/mech_hyperv.py index 1eb584f12c3..1d069790870 100644 --- a/neutron/plugins/ml2/drivers/mech_hyperv.py +++ b/neutron/plugins/ml2/drivers/mech_hyperv.py @@ -15,9 +15,10 @@ import re +from oslo_log import log + from neutron.common import constants from neutron.extensions import portbindings -from neutron.openstack.common import log from neutron.plugins.common import constants as p_constants from neutron.plugins.ml2.drivers import mech_agent diff --git a/neutron/plugins/ml2/drivers/mech_linuxbridge.py b/neutron/plugins/ml2/drivers/mech_linuxbridge.py index c5e45394243..221b2abfab1 100644 --- a/neutron/plugins/ml2/drivers/mech_linuxbridge.py +++ b/neutron/plugins/ml2/drivers/mech_linuxbridge.py @@ -13,10 +13,11 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log + from neutron.agent import securitygroups_rpc from neutron.common import constants from neutron.extensions import portbindings -from neutron.openstack.common import log from neutron.plugins.common import constants as p_constants from neutron.plugins.ml2.drivers import mech_agent diff --git a/neutron/plugins/ml2/drivers/mech_nuage/driver.py b/neutron/plugins/ml2/drivers/mech_nuage/driver.py index d09ba83943c..971c195b4d3 100644 --- a/neutron/plugins/ml2/drivers/mech_nuage/driver.py +++ b/neutron/plugins/ml2/drivers/mech_nuage/driver.py @@ -14,11 +14,11 @@ import netaddr from oslo_config import cfg +from oslo_log import log from neutron.common import constants as n_consts from neutron.extensions import portbindings from neutron.i18n import _LE -from neutron.openstack.common import log from neutron.plugins.common import constants from neutron.plugins.ml2 import driver_api as api from nuage_neutron.plugins.nuage.common import config diff --git a/neutron/plugins/ml2/drivers/mech_openvswitch.py b/neutron/plugins/ml2/drivers/mech_openvswitch.py index 5e20a4b354f..668b3832ec7 100644 --- a/neutron/plugins/ml2/drivers/mech_openvswitch.py +++ b/neutron/plugins/ml2/drivers/mech_openvswitch.py @@ -13,10 +13,11 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log + from neutron.agent import securitygroups_rpc from neutron.common import constants from neutron.extensions import portbindings -from neutron.openstack.common import log from neutron.plugins.common import constants as p_constants from neutron.plugins.ml2.drivers import mech_agent diff --git a/neutron/plugins/ml2/drivers/mech_sriov/mech_driver.py b/neutron/plugins/ml2/drivers/mech_sriov/mech_driver.py index 2d365f13a8e..d70edf22fd1 100644 --- a/neutron/plugins/ml2/drivers/mech_sriov/mech_driver.py +++ b/neutron/plugins/ml2/drivers/mech_sriov/mech_driver.py @@ -15,11 +15,11 @@ from oslo_config import cfg +from oslo_log import log from neutron.common import constants from neutron.extensions import portbindings from neutron.i18n import _LE, _LW -from neutron.openstack.common import log from neutron.plugins.common import constants as p_const from neutron.plugins.ml2 import driver_api as api from neutron.plugins.ml2.drivers.mech_sriov import exceptions as exc diff --git a/neutron/plugins/ml2/drivers/mlnx/mech_mlnx.py b/neutron/plugins/ml2/drivers/mlnx/mech_mlnx.py index 84c5ae9ad10..e6881bc4227 100644 --- a/neutron/plugins/ml2/drivers/mlnx/mech_mlnx.py +++ b/neutron/plugins/ml2/drivers/mlnx/mech_mlnx.py @@ -16,10 +16,10 @@ from networking_mlnx.plugins.ml2.drivers.mlnx import constants from oslo_config import cfg +from oslo_log import log from neutron.common import constants as n_const from neutron.extensions import portbindings -from neutron.openstack.common import log from neutron.plugins.common import constants as p_constants from neutron.plugins.ml2 import driver_api as api from neutron.plugins.ml2.drivers import mech_agent diff --git a/neutron/plugins/ml2/drivers/opendaylight/driver.py b/neutron/plugins/ml2/drivers/opendaylight/driver.py index 0342be3617f..28d6931f5a1 100644 --- a/neutron/plugins/ml2/drivers/opendaylight/driver.py +++ b/neutron/plugins/ml2/drivers/opendaylight/driver.py @@ -16,10 +16,10 @@ from networking_odl.common import constants as odl_const from networking_odl.ml2 import mech_driver from oslo_config import cfg +from oslo_log import log from neutron.common import constants as n_const from neutron.extensions import portbindings -from neutron.openstack.common import log from neutron.plugins.common import constants from neutron.plugins.ml2 import driver_api as api diff --git a/neutron/plugins/ml2/drivers/type_flat.py b/neutron/plugins/ml2/drivers/type_flat.py index 21aaa5731cb..73670daad5c 100644 --- a/neutron/plugins/ml2/drivers/type_flat.py +++ b/neutron/plugins/ml2/drivers/type_flat.py @@ -15,12 +15,12 @@ from oslo_config import cfg from oslo_db import exception as db_exc +from oslo_log import log import sqlalchemy as sa from neutron.common import exceptions as exc from neutron.db import model_base from neutron.i18n import _LI, _LW -from neutron.openstack.common import log from neutron.plugins.common import constants as p_const from neutron.plugins.ml2 import driver_api as api diff --git a/neutron/plugins/ml2/drivers/type_gre.py b/neutron/plugins/ml2/drivers/type_gre.py index 9a426284b41..b5daeaa9e1e 100644 --- a/neutron/plugins/ml2/drivers/type_gre.py +++ b/neutron/plugins/ml2/drivers/type_gre.py @@ -15,6 +15,7 @@ from oslo_config import cfg from oslo_db import exception as db_exc +from oslo_log import log from six import moves import sqlalchemy as sa from sqlalchemy import sql @@ -23,7 +24,6 @@ from neutron.common import exceptions as n_exc from neutron.db import api as db_api from neutron.db import model_base from neutron.i18n import _LE, _LW -from neutron.openstack.common import log from neutron.plugins.common import constants as p_const from neutron.plugins.ml2.drivers import type_tunnel diff --git a/neutron/plugins/ml2/drivers/type_local.py b/neutron/plugins/ml2/drivers/type_local.py index f935cc09aa5..d07b321b44c 100644 --- a/neutron/plugins/ml2/drivers/type_local.py +++ b/neutron/plugins/ml2/drivers/type_local.py @@ -13,9 +13,10 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log + from neutron.common import exceptions as exc from neutron.i18n import _LI -from neutron.openstack.common import log from neutron.plugins.common import constants as p_const from neutron.plugins.ml2 import driver_api as api diff --git a/neutron/plugins/ml2/drivers/type_tunnel.py b/neutron/plugins/ml2/drivers/type_tunnel.py index 25472438ac4..eca978f913a 100644 --- a/neutron/plugins/ml2/drivers/type_tunnel.py +++ b/neutron/plugins/ml2/drivers/type_tunnel.py @@ -14,10 +14,11 @@ # under the License. import abc +from oslo_log import log + from neutron.common import exceptions as exc from neutron.common import topics from neutron.i18n import _LI, _LW -from neutron.openstack.common import log from neutron.plugins.common import utils as plugin_utils from neutron.plugins.ml2 import driver_api as api from neutron.plugins.ml2.drivers import helpers diff --git a/neutron/plugins/ml2/drivers/type_vlan.py b/neutron/plugins/ml2/drivers/type_vlan.py index a2bf98a1fea..bb3aafb7ad1 100644 --- a/neutron/plugins/ml2/drivers/type_vlan.py +++ b/neutron/plugins/ml2/drivers/type_vlan.py @@ -16,6 +16,7 @@ import sys from oslo_config import cfg +from oslo_log import log from six import moves import sqlalchemy as sa @@ -25,7 +26,6 @@ from neutron.common import utils from neutron.db import api as db_api from neutron.db import model_base from neutron.i18n import _LE, _LI, _LW -from neutron.openstack.common import log from neutron.plugins.common import constants as p_const from neutron.plugins.common import utils as plugin_utils from neutron.plugins.ml2 import driver_api as api diff --git a/neutron/plugins/ml2/drivers/type_vxlan.py b/neutron/plugins/ml2/drivers/type_vxlan.py index d9c631f2f76..39f60e061e6 100644 --- a/neutron/plugins/ml2/drivers/type_vxlan.py +++ b/neutron/plugins/ml2/drivers/type_vxlan.py @@ -15,6 +15,7 @@ from oslo_config import cfg from oslo_db import exception as db_exc +from oslo_log import log from six import moves import sqlalchemy as sa from sqlalchemy import sql @@ -23,7 +24,6 @@ from neutron.common import exceptions as n_exc from neutron.db import api as db_api from neutron.db import model_base from neutron.i18n import _LE, _LW -from neutron.openstack.common import log from neutron.plugins.common import constants as p_const from neutron.plugins.ml2.drivers import type_tunnel diff --git a/neutron/plugins/ml2/managers.py b/neutron/plugins/ml2/managers.py index 4fc271d5ef6..65cfadadf25 100644 --- a/neutron/plugins/ml2/managers.py +++ b/neutron/plugins/ml2/managers.py @@ -14,6 +14,7 @@ # under the License. from oslo_config import cfg +from oslo_log import log import stevedore from neutron.api.v2 import attributes @@ -22,7 +23,6 @@ from neutron.extensions import multiprovidernet as mpnet from neutron.extensions import portbindings from neutron.extensions import providernet as provider from neutron.i18n import _LE, _LI -from neutron.openstack.common import log from neutron.plugins.ml2.common import exceptions as ml2_exc from neutron.plugins.ml2 import db from neutron.plugins.ml2 import driver_api as api diff --git a/neutron/plugins/ml2/plugin.py b/neutron/plugins/ml2/plugin.py index d9108e594b4..80c0f053a43 100644 --- a/neutron/plugins/ml2/plugin.py +++ b/neutron/plugins/ml2/plugin.py @@ -14,11 +14,12 @@ # under the License. import contextlib -from eventlet import greenthread +from eventlet import greenthread from oslo_concurrency import lockutils from oslo_config import cfg from oslo_db import exception as os_db_exception +from oslo_log import log from oslo_serialization import jsonutils from oslo_utils import excutils from oslo_utils import importutils @@ -55,7 +56,6 @@ from neutron.extensions import portbindings from neutron.extensions import providernet as provider from neutron.i18n import _LE, _LI, _LW from neutron import manager -from neutron.openstack.common import log from neutron.openstack.common import uuidutils from neutron.plugins.common import constants as service_constants from neutron.plugins.ml2.common import exceptions as ml2_exc diff --git a/neutron/plugins/ml2/rpc.py b/neutron/plugins/ml2/rpc.py index c92e5474046..8e1a55d9c76 100644 --- a/neutron/plugins/ml2/rpc.py +++ b/neutron/plugins/ml2/rpc.py @@ -13,6 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log import oslo_messaging from sqlalchemy.orm import exc @@ -26,7 +27,6 @@ from neutron.common import utils from neutron.extensions import portbindings from neutron.i18n import _LW from neutron import manager -from neutron.openstack.common import log from neutron.plugins.common import constants as service_constants from neutron.plugins.ml2 import driver_api as api from neutron.plugins.ml2.drivers import type_tunnel diff --git a/neutron/plugins/mlnx/agent/eswitch_neutron_agent.py b/neutron/plugins/mlnx/agent/eswitch_neutron_agent.py index 19c610640fe..688d7bebf20 100644 --- a/neutron/plugins/mlnx/agent/eswitch_neutron_agent.py +++ b/neutron/plugins/mlnx/agent/eswitch_neutron_agent.py @@ -18,11 +18,11 @@ import sys from networking_mlnx.plugins.mlnx.agent import mlnx_eswitch_neutron_agent from oslo_config import cfg +from oslo_log import log as logging from neutron.i18n import _LE, _LI from neutron.common import config as common_config from neutron.common import utils -from neutron.openstack.common import log as logging from neutron.plugins.mlnx.agent import config # noqa LOG = logging.getLogger(__name__) diff --git a/neutron/plugins/nec/extensions/router_provider.py b/neutron/plugins/nec/extensions/router_provider.py index 0c8f02559ea..5098a47fda0 100644 --- a/neutron/plugins/nec/extensions/router_provider.py +++ b/neutron/plugins/nec/extensions/router_provider.py @@ -12,8 +12,9 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging + from neutron.api.v2 import attributes -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/plugins/oneconvergence/agent/nvsd_neutron_agent.py b/neutron/plugins/oneconvergence/agent/nvsd_neutron_agent.py index 26c0685e867..63dbae439a2 100644 --- a/neutron/plugins/oneconvergence/agent/nvsd_neutron_agent.py +++ b/neutron/plugins/oneconvergence/agent/nvsd_neutron_agent.py @@ -21,6 +21,7 @@ import time import eventlet eventlet.monkey_patch() +from oslo_log import log as logging import oslo_messaging from neutron.agent.linux import ovs_lib @@ -31,7 +32,6 @@ from neutron.common import topics from neutron import context as n_context from neutron.extensions import securitygroup as ext_sg from neutron.i18n import _LE, _LI -from neutron.openstack.common import log as logging from neutron.plugins.oneconvergence.lib import config LOG = logging.getLogger(__name__) diff --git a/neutron/plugins/oneconvergence/lib/nvsdlib.py b/neutron/plugins/oneconvergence/lib/nvsdlib.py index ba6033a4154..84cc6ac8ebe 100644 --- a/neutron/plugins/oneconvergence/lib/nvsdlib.py +++ b/neutron/plugins/oneconvergence/lib/nvsdlib.py @@ -14,10 +14,10 @@ """Intermidiate NVSD Library.""" +from oslo_log import log as logging from oslo_serialization import jsonutils from oslo_utils import excutils -from neutron.openstack.common import log as logging import neutron.plugins.oneconvergence.lib.exception as nvsdexception from neutron.plugins.oneconvergence.lib import plugin_helper diff --git a/neutron/plugins/oneconvergence/lib/plugin_helper.py b/neutron/plugins/oneconvergence/lib/plugin_helper.py index 7b5ef69f7b7..58b94797cfc 100644 --- a/neutron/plugins/oneconvergence/lib/plugin_helper.py +++ b/neutron/plugins/oneconvergence/lib/plugin_helper.py @@ -18,12 +18,12 @@ import httplib import time from oslo_config import cfg +from oslo_log import log as logging from oslo_serialization import jsonutils import requests from six.moves.urllib import parse from neutron.i18n import _LE, _LW -from neutron.openstack.common import log as logging import neutron.plugins.oneconvergence.lib.exception as exception LOG = logging.getLogger(__name__) diff --git a/neutron/plugins/oneconvergence/plugin.py b/neutron/plugins/oneconvergence/plugin.py index 8d7c9fb2675..af6b5c1a6bd 100644 --- a/neutron/plugins/oneconvergence/plugin.py +++ b/neutron/plugins/oneconvergence/plugin.py @@ -15,6 +15,7 @@ """Implementation of OneConvergence Neutron Plugin.""" from oslo_config import cfg +from oslo_log import log as logging import oslo_messaging from oslo_utils import excutils from oslo_utils import importutils @@ -42,7 +43,6 @@ from neutron.db import quota_db # noqa from neutron.db import securitygroups_rpc_base as sg_db_rpc from neutron.extensions import portbindings from neutron.i18n import _LE -from neutron.openstack.common import log as logging from neutron.plugins.common import constants as svc_constants import neutron.plugins.oneconvergence.lib.config # noqa import neutron.plugins.oneconvergence.lib.exception as nvsdexception diff --git a/neutron/plugins/opencontrail/contrail_plugin.py b/neutron/plugins/opencontrail/contrail_plugin.py index 36fb9d016b2..50baba60867 100644 --- a/neutron/plugins/opencontrail/contrail_plugin.py +++ b/neutron/plugins/opencontrail/contrail_plugin.py @@ -14,6 +14,7 @@ # from oslo_config import cfg +from oslo_log import log as logging from oslo_serialization import jsonutils import requests @@ -24,7 +25,6 @@ from neutron.extensions import external_net from neutron.extensions import portbindings from neutron.extensions import securitygroup from neutron import neutron_plugin_base_v2 -from neutron.openstack.common import log as logging from neutron.plugins.opencontrail.common import exceptions as c_exc diff --git a/neutron/plugins/openvswitch/agent/ovs_dvr_neutron_agent.py b/neutron/plugins/openvswitch/agent/ovs_dvr_neutron_agent.py index f459902bee8..10bb956802f 100644 --- a/neutron/plugins/openvswitch/agent/ovs_dvr_neutron_agent.py +++ b/neutron/plugins/openvswitch/agent/ovs_dvr_neutron_agent.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. - +from oslo_log import log as logging import oslo_messaging from oslo_utils import excutils @@ -21,7 +21,6 @@ from neutron.api.rpc.handlers import dvr_rpc from neutron.common import constants as n_const from neutron.common import utils as n_utils from neutron.i18n import _LE, _LI, _LW -from neutron.openstack.common import log as logging from neutron.plugins.common import constants as p_const from neutron.plugins.openvswitch.common import constants diff --git a/neutron/plugins/openvswitch/agent/ovs_neutron_agent.py b/neutron/plugins/openvswitch/agent/ovs_neutron_agent.py index ab479b5c5fb..ecb600c5649 100644 --- a/neutron/plugins/openvswitch/agent/ovs_neutron_agent.py +++ b/neutron/plugins/openvswitch/agent/ovs_neutron_agent.py @@ -23,8 +23,8 @@ import eventlet eventlet.monkey_patch() import netaddr -from neutron.plugins.openvswitch.agent import ovs_dvr_neutron_agent from oslo_config import cfg +from oslo_log import log as logging import oslo_messaging from six import moves @@ -44,9 +44,9 @@ from neutron.common import topics from neutron.common import utils as q_utils from neutron import context from neutron.i18n import _LE, _LI, _LW -from neutron.openstack.common import log as logging from neutron.openstack.common import loopingcall from neutron.plugins.common import constants as p_const +from neutron.plugins.openvswitch.agent import ovs_dvr_neutron_agent from neutron.plugins.openvswitch.common import constants diff --git a/neutron/plugins/sriovnicagent/eswitch_manager.py b/neutron/plugins/sriovnicagent/eswitch_manager.py index 0397ffb0058..82b8a72c769 100644 --- a/neutron/plugins/sriovnicagent/eswitch_manager.py +++ b/neutron/plugins/sriovnicagent/eswitch_manager.py @@ -17,8 +17,9 @@ import glob import os import re +from oslo_log import log as logging + from neutron.i18n import _LE, _LW -from neutron.openstack.common import log as logging from neutron.plugins.sriovnicagent.common import exceptions as exc from neutron.plugins.sriovnicagent import pci_lib diff --git a/neutron/plugins/sriovnicagent/pci_lib.py b/neutron/plugins/sriovnicagent/pci_lib.py index e8b1df79172..545769fdaa5 100644 --- a/neutron/plugins/sriovnicagent/pci_lib.py +++ b/neutron/plugins/sriovnicagent/pci_lib.py @@ -15,9 +15,10 @@ import re +from oslo_log import log as logging + from neutron.agent.linux import ip_lib from neutron.i18n import _LE, _LW -from neutron.openstack.common import log as logging from neutron.plugins.sriovnicagent.common import exceptions as exc LOG = logging.getLogger(__name__) diff --git a/neutron/plugins/sriovnicagent/sriov_nic_agent.py b/neutron/plugins/sriovnicagent/sriov_nic_agent.py index 7928417bb24..7bb92c063f9 100644 --- a/neutron/plugins/sriovnicagent/sriov_nic_agent.py +++ b/neutron/plugins/sriovnicagent/sriov_nic_agent.py @@ -22,6 +22,7 @@ import eventlet eventlet.monkey_patch() from oslo_config import cfg +from oslo_log import log as logging import oslo_messaging from neutron.agent import rpc as agent_rpc @@ -32,7 +33,6 @@ from neutron.common import topics from neutron.common import utils as q_utils from neutron import context from neutron.i18n import _LE, _LI -from neutron.openstack.common import log as logging from neutron.openstack.common import loopingcall from neutron.plugins.sriovnicagent.common import config # noqa from neutron.plugins.sriovnicagent.common import exceptions as exc diff --git a/neutron/policy.py b/neutron/policy.py index 8fa8a38780d..65503535c40 100644 --- a/neutron/policy.py +++ b/neutron/policy.py @@ -19,9 +19,10 @@ Policy engine for neutron. Largely copied from nova. import collections import itertools -import logging +import logging as std_logging import re +from oslo_log import log as logging from oslo_utils import excutils from oslo_utils import importutils @@ -29,11 +30,10 @@ from neutron.api.v2 import attributes from neutron.common import constants as const from neutron.common import exceptions from neutron.i18n import _LE, _LI, _LW -from neutron.openstack.common import log from neutron.openstack.common import policy -LOG = log.getLogger(__name__) +LOG = logging.getLogger(__name__) _ENFORCER = None ADMIN_CTX_POLICY = 'context_is_admin' @@ -357,7 +357,7 @@ def _prepare_check(context, action, target): def log_rule_list(match_rule): - if LOG.isEnabledFor(logging.DEBUG): + if LOG.isEnabledFor(std_logging.DEBUG): rules = _process_rules_list([], match_rule) LOG.debug("Enforcing rules: %s", rules) diff --git a/neutron/quota.py b/neutron/quota.py index 25c6ad2c256..ae718cb9299 100644 --- a/neutron/quota.py +++ b/neutron/quota.py @@ -17,12 +17,12 @@ import sys from oslo_config import cfg +from oslo_log import log as logging from oslo_utils import importutils import webob from neutron.common import exceptions from neutron.i18n import _LI, _LW -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) QUOTA_DB_MODULE = 'neutron.db.quota_db' diff --git a/neutron/scheduler/dhcp_agent_scheduler.py b/neutron/scheduler/dhcp_agent_scheduler.py index 09afabfa590..d950864d1b7 100644 --- a/neutron/scheduler/dhcp_agent_scheduler.py +++ b/neutron/scheduler/dhcp_agent_scheduler.py @@ -17,13 +17,13 @@ import random from oslo_config import cfg from oslo_db import exception as db_exc +from oslo_log import log as logging from sqlalchemy import sql from neutron.common import constants from neutron.db import agents_db from neutron.db import agentschedulers_db from neutron.i18n import _LI, _LW -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/scheduler/l3_agent_scheduler.py b/neutron/scheduler/l3_agent_scheduler.py index d2d2b01cae8..aa407056cd7 100644 --- a/neutron/scheduler/l3_agent_scheduler.py +++ b/neutron/scheduler/l3_agent_scheduler.py @@ -19,6 +19,7 @@ import random from oslo_config import cfg from oslo_db import exception as db_exc +from oslo_log import log as logging import six from sqlalchemy import sql @@ -28,7 +29,6 @@ from neutron.db import l3_agentschedulers_db from neutron.db import l3_db from neutron.db import l3_hamode_db from neutron.i18n import _LE, _LW -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/server/__init__.py b/neutron/server/__init__.py index 8f286fbdb62..6c5bd4fe600 100755 --- a/neutron/server/__init__.py +++ b/neutron/server/__init__.py @@ -22,10 +22,10 @@ import sys import eventlet from oslo_config import cfg +from oslo_log import log as logging from neutron.common import config from neutron.i18n import _LI -from neutron.openstack.common import log as logging from neutron import service LOG = logging.getLogger(__name__) diff --git a/neutron/service.py b/neutron/service.py index be7254a817d..448251c383a 100644 --- a/neutron/service.py +++ b/neutron/service.py @@ -19,6 +19,7 @@ import os import random from oslo_config import cfg +from oslo_log import log as logging from oslo_messaging import server as rpc_server from oslo_utils import excutils from oslo_utils import importutils @@ -29,7 +30,6 @@ from neutron import context from neutron.db import api as session from neutron.i18n import _LE, _LI from neutron import manager -from neutron.openstack.common import log as logging from neutron.openstack.common import loopingcall from neutron.openstack.common import service as common_service from neutron import wsgi diff --git a/neutron/services/advanced_service.py b/neutron/services/advanced_service.py index fbca6cc0f75..62b7e023db1 100644 --- a/neutron/services/advanced_service.py +++ b/neutron/services/advanced_service.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -from neutron.openstack.common import log as logging +from oslo_log import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/services/firewall/agents/firewall_agent_api.py b/neutron/services/firewall/agents/firewall_agent_api.py index e9ed05af280..6e906a339fa 100644 --- a/neutron/services/firewall/agents/firewall_agent_api.py +++ b/neutron/services/firewall/agents/firewall_agent_api.py @@ -14,10 +14,10 @@ # under the License. from oslo_config import cfg +from oslo_log import log as logging import oslo_messaging from neutron.common import rpc as n_rpc -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/services/firewall/agents/l3reference/firewall_l3_agent.py b/neutron/services/firewall/agents/l3reference/firewall_l3_agent.py index 6c007a62a8b..41af391bb12 100644 --- a/neutron/services/firewall/agents/l3reference/firewall_l3_agent.py +++ b/neutron/services/firewall/agents/l3reference/firewall_l3_agent.py @@ -14,6 +14,7 @@ # under the License. from oslo_config import cfg +from oslo_log import log as logging from oslo_utils import importutils from neutron.agent.linux import ip_lib @@ -21,7 +22,6 @@ from neutron.common import exceptions as nexception from neutron.common import topics from neutron import context from neutron.i18n import _LE -from neutron.openstack.common import log as logging from neutron.plugins.common import constants from neutron.services.firewall.agents import firewall_agent_api as api from neutron.services import provider_configuration as provconf diff --git a/neutron/services/l3_router/brocade/l3_router_plugin.py b/neutron/services/l3_router/brocade/l3_router_plugin.py index ba92880333d..1be98dc5edc 100644 --- a/neutron/services/l3_router/brocade/l3_router_plugin.py +++ b/neutron/services/l3_router/brocade/l3_router_plugin.py @@ -18,11 +18,11 @@ """Implentation of Brocade SVI service Plugin.""" from oslo_config import cfg +from oslo_log import log as logging from oslo_utils import excutils from neutron.common import constants as l3_constants from neutron.i18n import _LE, _LI -from neutron.openstack.common import log as logging from neutron.plugins.ml2 import db from neutron.plugins.ml2.drivers.brocade.db import models as brocade_db from neutron.plugins.ml2.drivers.brocade.nos import nosdriver as driver diff --git a/neutron/services/l3_router/l3_arista.py b/neutron/services/l3_router/l3_arista.py index 3465eee3fad..583b511f054 100644 --- a/neutron/services/l3_router/l3_arista.py +++ b/neutron/services/l3_router/l3_arista.py @@ -18,6 +18,7 @@ import threading from networking_arista.common import db_lib from networking_arista.l3Plugin import arista_l3_driver from oslo_config import cfg +from oslo_log import log as logging from oslo_utils import excutils from neutron.api.rpc.agentnotifiers import l3_rpc_agent_api @@ -32,7 +33,6 @@ from neutron.db import extraroute_db from neutron.db import l3_agentschedulers_db from neutron.db import l3_gwmode_db from neutron.i18n import _LE, _LI -from neutron.openstack.common import log as logging from neutron.plugins.common import constants from neutron.plugins.ml2.driver_context import NetworkContext # noqa diff --git a/neutron/services/metering/agents/metering_agent.py b/neutron/services/metering/agents/metering_agent.py index aadaa8b0153..d2e6ab53c37 100644 --- a/neutron/services/metering/agents/metering_agent.py +++ b/neutron/services/metering/agents/metering_agent.py @@ -16,6 +16,7 @@ import sys import time from oslo_config import cfg +from oslo_log import log as logging import oslo_messaging from oslo_utils import importutils @@ -29,7 +30,6 @@ from neutron.common import utils from neutron import context from neutron.i18n import _LE, _LI, _LW from neutron import manager -from neutron.openstack.common import log as logging from neutron.openstack.common import loopingcall from neutron.openstack.common import periodic_task from neutron.openstack.common import service diff --git a/neutron/services/metering/drivers/iptables/iptables_driver.py b/neutron/services/metering/drivers/iptables/iptables_driver.py index 661fa6be463..8bdec808c73 100644 --- a/neutron/services/metering/drivers/iptables/iptables_driver.py +++ b/neutron/services/metering/drivers/iptables/iptables_driver.py @@ -13,6 +13,7 @@ # under the License. from oslo_config import cfg +from oslo_log import log as logging from oslo_utils import importutils import six @@ -23,7 +24,6 @@ from neutron.common import constants as constants from neutron.common import ipv6_utils from neutron.common import log from neutron.i18n import _LI -from neutron.openstack.common import log as logging from neutron.services.metering.drivers import abstract_driver diff --git a/neutron/services/provider_configuration.py b/neutron/services/provider_configuration.py index 2d9b456e861..5705858eeda 100644 --- a/neutron/services/provider_configuration.py +++ b/neutron/services/provider_configuration.py @@ -14,12 +14,12 @@ # under the License. from oslo_config import cfg +from oslo_log import log as logging import stevedore from neutron.common import exceptions as n_exc from neutron.common import repos from neutron.i18n import _LW -from neutron.openstack.common import log as logging from neutron.plugins.common import constants LOG = logging.getLogger(__name__) diff --git a/neutron/services/service_base.py b/neutron/services/service_base.py index 2a6225a0033..0cc8b3bdae1 100644 --- a/neutron/services/service_base.py +++ b/neutron/services/service_base.py @@ -15,6 +15,7 @@ import abc +from oslo_log import log as logging from oslo_utils import excutils from oslo_utils import importutils import six @@ -22,7 +23,6 @@ import six from neutron.api import extensions from neutron.db import servicetype_db as sdb from neutron.i18n import _LE, _LI -from neutron.openstack.common import log as logging from neutron.services import provider_configuration as pconf LOG = logging.getLogger(__name__) diff --git a/neutron/tests/api/contrib/clients.py b/neutron/tests/api/contrib/clients.py index 6ecaf7b4fb3..323ee9185ee 100644 --- a/neutron/tests/api/contrib/clients.py +++ b/neutron/tests/api/contrib/clients.py @@ -13,7 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. -from neutron.openstack.common import log as logging +from oslo_log import log as logging + from neutron.tests.tempest.common import cred_provider from neutron.tests.tempest import config from neutron.tests.tempest import manager diff --git a/neutron/tests/functional/agent/linux/test_ip_lib.py b/neutron/tests/functional/agent/linux/test_ip_lib.py index bacb51bd7d4..b87ce52378e 100644 --- a/neutron/tests/functional/agent/linux/test_ip_lib.py +++ b/neutron/tests/functional/agent/linux/test_ip_lib.py @@ -17,13 +17,13 @@ import collections import netaddr from oslo_config import cfg +from oslo_log import log as logging from oslo_utils import importutils from neutron.agent.common import config from neutron.agent.linux import interface from neutron.agent.linux import ip_lib from neutron.common import utils -from neutron.openstack.common import log as logging from neutron.tests.functional.agent.linux import base LOG = logging.getLogger(__name__) diff --git a/neutron/tests/functional/agent/test_l3_agent.py b/neutron/tests/functional/agent/test_l3_agent.py index f8569370bbb..7b23a8acf04 100755 --- a/neutron/tests/functional/agent/test_l3_agent.py +++ b/neutron/tests/functional/agent/test_l3_agent.py @@ -19,6 +19,7 @@ import functools import mock import netaddr from oslo_config import cfg +from oslo_log import log as logging import testtools import webob import webob.dec @@ -38,7 +39,6 @@ from neutron.agent.metadata import agent as metadata_agent from neutron.common import config as common_config from neutron.common import constants as l3_constants from neutron.common import utils as common_utils -from neutron.openstack.common import log as logging from neutron.openstack.common import uuidutils from neutron.services import advanced_service as adv_svc from neutron.tests.functional.agent.linux import base @@ -61,10 +61,7 @@ class L3AgentTestFramework(base.BaseOVSLinuxTestCase): config = cfg.ConfigOpts() config.register_opts(common_config.core_opts) config.register_opts(common_config.core_cli_opts) - config.register_cli_opts(logging.common_cli_opts) - config.register_cli_opts(logging.logging_cli_opts) - config.register_opts(logging.generic_log_opts) - config.register_opts(logging.log_opts) + logging.register_options(config) agent_config.register_process_monitor_opts(config) return config diff --git a/neutron/tests/tempest/api/network/base.py b/neutron/tests/tempest/api/network/base.py index b2c2e97617f..65fed5881f1 100644 --- a/neutron/tests/tempest/api/network/base.py +++ b/neutron/tests/tempest/api/network/base.py @@ -14,13 +14,13 @@ # under the License. import netaddr +from oslo_log import log as logging from tempest_lib import exceptions as lib_exc from neutron.tests.api.contrib import clients from neutron.tests.tempest.common.utils import data_utils from neutron.tests.tempest import config from neutron.tests.tempest import exceptions -from neutron.openstack.common import log as logging import neutron.tests.tempest.test CONF = config.CONF diff --git a/neutron/tests/tempest/api/network/test_metering_extensions.py b/neutron/tests/tempest/api/network/test_metering_extensions.py index 63d5eab47dc..15cc9b0100a 100644 --- a/neutron/tests/tempest/api/network/test_metering_extensions.py +++ b/neutron/tests/tempest/api/network/test_metering_extensions.py @@ -12,9 +12,10 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging + from neutron.tests.tempest.api.network import base from neutron.tests.tempest.common.utils import data_utils -from neutron.openstack.common import log as logging from neutron.tests.tempest import test diff --git a/neutron/tests/tempest/auth.py b/neutron/tests/tempest/auth.py index ceee2658082..8d64b87b86c 100644 --- a/neutron/tests/tempest/auth.py +++ b/neutron/tests/tempest/auth.py @@ -20,9 +20,9 @@ import exceptions import re import urlparse +from oslo_log import log as logging import six -from neutron.openstack.common import log as logging from neutron.tests.tempest.services.identity.v2.json import token_client as json_v2id from neutron.tests.tempest.services.identity.v3.json import token_client as json_v3id diff --git a/neutron/tests/tempest/common/accounts.py b/neutron/tests/tempest/common/accounts.py index 2cb8ceced34..e10817bb528 100644 --- a/neutron/tests/tempest/common/accounts.py +++ b/neutron/tests/tempest/common/accounts.py @@ -15,13 +15,13 @@ import hashlib import os +from oslo_concurrency import lockutils +from oslo_log import log as logging import yaml from neutron.tests.tempest.common import cred_provider from neutron.tests.tempest import config from neutron.tests.tempest import exceptions -from oslo_concurrency import lockutils -from neutron.openstack.common import log as logging CONF = config.CONF LOG = logging.getLogger(__name__) diff --git a/neutron/tests/tempest/common/commands.py b/neutron/tests/tempest/common/commands.py index f132e8627a8..392c9d06503 100644 --- a/neutron/tests/tempest/common/commands.py +++ b/neutron/tests/tempest/common/commands.py @@ -15,7 +15,7 @@ import shlex import subprocess -from neutron.openstack.common import log as logging +from oslo_log import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/tests/tempest/common/cred_provider.py b/neutron/tests/tempest/common/cred_provider.py index a999cfc1c8d..fda955c1e8e 100644 --- a/neutron/tests/tempest/common/cred_provider.py +++ b/neutron/tests/tempest/common/cred_provider.py @@ -14,12 +14,12 @@ import abc +from oslo_log import log as logging import six from neutron.tests.tempest import auth from neutron.tests.tempest import config from neutron.tests.tempest import exceptions -from neutron.openstack.common import log as logging CONF = config.CONF LOG = logging.getLogger(__name__) diff --git a/neutron/tests/tempest/common/generator/base_generator.py b/neutron/tests/tempest/common/generator/base_generator.py index 2771823d414..d3cae264c2a 100644 --- a/neutron/tests/tempest/common/generator/base_generator.py +++ b/neutron/tests/tempest/common/generator/base_generator.py @@ -17,8 +17,7 @@ import copy import functools import jsonschema - -from neutron.openstack.common import log as logging +from oslo_log import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/tests/tempest/common/generator/negative_generator.py b/neutron/tests/tempest/common/generator/negative_generator.py index 704d9fb1ba2..ba8884f1e89 100644 --- a/neutron/tests/tempest/common/generator/negative_generator.py +++ b/neutron/tests/tempest/common/generator/negative_generator.py @@ -15,9 +15,10 @@ import copy +from oslo_log import log as logging + import neutron.tests.tempest.common.generator.base_generator as base import neutron.tests.tempest.common.generator.valid_generator as valid -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/tests/tempest/common/generator/valid_generator.py b/neutron/tests/tempest/common/generator/valid_generator.py index 4d1906e5476..8ff9259bdce 100644 --- a/neutron/tests/tempest/common/generator/valid_generator.py +++ b/neutron/tests/tempest/common/generator/valid_generator.py @@ -13,8 +13,9 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging + import neutron.tests.tempest.common.generator.base_generator as base -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/tests/tempest/common/glance_http.py b/neutron/tests/tempest/common/glance_http.py index c802472fcd4..66fc2abd453 100644 --- a/neutron/tests/tempest/common/glance_http.py +++ b/neutron/tests/tempest/common/glance_http.py @@ -28,11 +28,11 @@ import urlparse import OpenSSL +from oslo_log import log as logging from six import moves from tempest_lib import exceptions as lib_exc from neutron.tests.tempest import exceptions as exc -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) USER_AGENT = 'tempest' diff --git a/neutron/tests/tempest/common/isolated_creds.py b/neutron/tests/tempest/common/isolated_creds.py index 41d7390bc04..e4b0b0803e6 100644 --- a/neutron/tests/tempest/common/isolated_creds.py +++ b/neutron/tests/tempest/common/isolated_creds.py @@ -13,6 +13,7 @@ # under the License. import netaddr +from oslo_log import log as logging from tempest_lib import exceptions as lib_exc from neutron.tests.api.contrib import clients @@ -20,7 +21,6 @@ from neutron.tests.tempest.common import cred_provider from neutron.tests.tempest.common.utils import data_utils from neutron.tests.tempest import config from neutron.tests.tempest import exceptions -from neutron.openstack.common import log as logging CONF = config.CONF LOG = logging.getLogger(__name__) diff --git a/neutron/tests/tempest/common/ssh.py b/neutron/tests/tempest/common/ssh.py index de1ad886dfb..00febc6295c 100644 --- a/neutron/tests/tempest/common/ssh.py +++ b/neutron/tests/tempest/common/ssh.py @@ -20,10 +20,10 @@ import socket import time import warnings +from oslo_log import log as logging import six from neutron.tests.tempest import exceptions -from neutron.openstack.common import log as logging with warnings.catch_warnings(): diff --git a/neutron/tests/tempest/common/utils/misc.py b/neutron/tests/tempest/common/utils/misc.py index cc0004d5c44..b97dd8627a9 100644 --- a/neutron/tests/tempest/common/utils/misc.py +++ b/neutron/tests/tempest/common/utils/misc.py @@ -16,7 +16,7 @@ import inspect import re -from neutron.openstack.common import log as logging +from oslo_log import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/tests/tempest/common/waiters.py b/neutron/tests/tempest/common/waiters.py index b54ef733703..049d5ca925f 100644 --- a/neutron/tests/tempest/common/waiters.py +++ b/neutron/tests/tempest/common/waiters.py @@ -13,10 +13,11 @@ import time +from oslo_log import log as logging + from neutron.tests.tempest.common.utils import misc as misc_utils from neutron.tests.tempest import config from neutron.tests.tempest import exceptions -from neutron.openstack.common import log as logging CONF = config.CONF LOG = logging.getLogger(__name__) diff --git a/neutron/tests/tempest/config.py b/neutron/tests/tempest/config.py index deab8906692..569fc4b9b75 100644 --- a/neutron/tests/tempest/config.py +++ b/neutron/tests/tempest/config.py @@ -18,10 +18,9 @@ from __future__ import print_function import logging as std_logging import os -from oslo.config import cfg - from oslo_concurrency import lockutils -from neutron.openstack.common import log as logging +from oslo_config import cfg +from oslo_log import log as logging def register_opt_group(conf, opt_group, options): @@ -1099,6 +1098,8 @@ def register_opts(): register_opt_group(cfg.CONF, g, o) +# TODO(ihrachys): this function should probably be removed since it's not used +# anywhere, and accesses internal implementation details of olso libraries def list_opts(): """Return a list of oslo.config options available. @@ -1197,7 +1198,7 @@ class TempestConfigPrivate(object): cfg.CONF([], project='tempest', default_config_files=config_files) else: cfg.CONF([], project='tempest') - logging.setup('tempest') + logging.setup(cfg.CONF, 'tempest') LOG = logging.getLogger('tempest') LOG.info("Using tempest config file %s" % path) register_opts() @@ -1218,6 +1219,8 @@ class TempestConfigProxy(object): def _fix_log_levels(self): """Tweak the oslo log defaults.""" + # TODO(ihrachys): this code accesses internal details of oslo.log + # library (and does it wrong), hence should be fixed for opt in logging.log_opts: if opt.dest == 'default_log_levels': opt.default.extend(self._extra_log_defaults) diff --git a/neutron/tests/tempest/test.py b/neutron/tests/tempest/test.py index 27975b34576..11ea90fef56 100644 --- a/neutron/tests/tempest/test.py +++ b/neutron/tests/tempest/test.py @@ -24,6 +24,8 @@ import urllib import uuid import fixtures +from oslo_log import log as logging +from oslo_utils import importutils import six import testscenarios import testtools @@ -33,8 +35,6 @@ from neutron.tests.tempest.common import credentials import neutron.tests.tempest.common.generator.valid_generator as valid from neutron.tests.tempest import config from neutron.tests.tempest import exceptions -from oslo_utils import importutils -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/tests/unit/database_stubs.py b/neutron/tests/unit/database_stubs.py index b332d4a957b..8997497a6d6 100644 --- a/neutron/tests/unit/database_stubs.py +++ b/neutron/tests/unit/database_stubs.py @@ -15,8 +15,9 @@ """stubs.py provides interface methods for the database test cases""" +from oslo_log import log as logging + from neutron.db import api as db -from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/tests/unit/hacking/test_checks.py b/neutron/tests/unit/hacking/test_checks.py index 4d14416c692..b87ad18bcb6 100644 --- a/neutron/tests/unit/hacking/test_checks.py +++ b/neutron/tests/unit/hacking/test_checks.py @@ -20,7 +20,6 @@ class HackingTestCase(base.BaseTestCase): def test_log_translations(self): expected_marks = { - 'audit': '_', 'error': '_LE', 'info': '_LI', 'warn': '_LW', diff --git a/neutron/tests/unit/ml2/drivers/brocade/test_brocade_l3_plugin.py b/neutron/tests/unit/ml2/drivers/brocade/test_brocade_l3_plugin.py index b939663bc21..85119008c0d 100644 --- a/neutron/tests/unit/ml2/drivers/brocade/test_brocade_l3_plugin.py +++ b/neutron/tests/unit/ml2/drivers/brocade/test_brocade_l3_plugin.py @@ -18,10 +18,10 @@ import mock from oslo_config import cfg from oslo_context import context as oslo_context +from oslo_log import log as logging from oslo_utils import importutils from neutron.db import api as db -from neutron.openstack.common import log as logging from neutron.tests.unit import test_l3_plugin LOG = logging.getLogger(__name__) diff --git a/neutron/tests/unit/ml2/drivers/brocade/test_brocade_mechanism_driver.py b/neutron/tests/unit/ml2/drivers/brocade/test_brocade_mechanism_driver.py index b2969ab4cd0..cbb1df6ad6d 100644 --- a/neutron/tests/unit/ml2/drivers/brocade/test_brocade_mechanism_driver.py +++ b/neutron/tests/unit/ml2/drivers/brocade/test_brocade_mechanism_driver.py @@ -14,9 +14,9 @@ # limitations under the License. import mock +from oslo_log import log as logging from oslo_utils import importutils -from neutron.openstack.common import log as logging from neutron.plugins.ml2 import config as ml2_config from neutron.plugins.ml2.drivers.brocade import (mechanism_brocade as brocademechanism) diff --git a/neutron/tests/unit/ml2/drivers/mech_fake_agent.py b/neutron/tests/unit/ml2/drivers/mech_fake_agent.py index 9a66e0bdb48..4aeca4e4daf 100644 --- a/neutron/tests/unit/ml2/drivers/mech_fake_agent.py +++ b/neutron/tests/unit/ml2/drivers/mech_fake_agent.py @@ -20,14 +20,15 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging + from neutron.agent import securitygroups_rpc from neutron.common import constants from neutron.extensions import portbindings -from neutron.openstack.common import log from neutron.plugins.common import constants as p_constants from neutron.plugins.ml2.drivers import mech_agent -LOG = log.getLogger(__name__) +LOG = logging.getLogger(__name__) class FakeAgentMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase): diff --git a/neutron/tests/unit/ml2/drivers/mechanism_logger.py b/neutron/tests/unit/ml2/drivers/mechanism_logger.py index da4edbb981f..48b24d58181 100644 --- a/neutron/tests/unit/ml2/drivers/mechanism_logger.py +++ b/neutron/tests/unit/ml2/drivers/mechanism_logger.py @@ -13,7 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. -from neutron.openstack.common import log +from oslo_log import log + from neutron.plugins.ml2 import driver_api as api LOG = log.getLogger(__name__) diff --git a/neutron/tests/unit/openvswitch/test_ovs_neutron_agent.py b/neutron/tests/unit/openvswitch/test_ovs_neutron_agent.py index 03463d35d18..4b33bd7247b 100644 --- a/neutron/tests/unit/openvswitch/test_ovs_neutron_agent.py +++ b/neutron/tests/unit/openvswitch/test_ovs_neutron_agent.py @@ -19,6 +19,7 @@ import time import mock import netaddr from oslo_config import cfg +from oslo_log import log import testtools from neutron.agent.linux import async_process @@ -26,7 +27,6 @@ from neutron.agent.linux import ip_lib from neutron.agent.linux import ovs_lib from neutron.agent.linux import utils from neutron.common import constants as n_const -from neutron.openstack.common import log from neutron.plugins.common import constants as p_const from neutron.plugins.ml2.drivers.l2pop import rpc as l2pop_rpc from neutron.plugins.openvswitch.agent import ovs_neutron_agent @@ -1004,7 +1004,7 @@ class TestOvsNeutronAgent(base.BaseTestCase): with contextlib.nested( mock.patch.object(async_process.AsyncProcess, "_spawn"), - mock.patch.object(log.ContextAdapter, 'exception'), + mock.patch.object(log.KeywordArgumentAdapter, 'exception'), mock.patch.object(ovs_neutron_agent.OVSNeutronAgent, 'scan_ports'), mock.patch.object(ovs_neutron_agent.OVSNeutronAgent, diff --git a/neutron/tests/unit/openvswitch/test_ovs_tunnel.py b/neutron/tests/unit/openvswitch/test_ovs_tunnel.py index af89685ff40..c2fe7db5951 100644 --- a/neutron/tests/unit/openvswitch/test_ovs_tunnel.py +++ b/neutron/tests/unit/openvswitch/test_ovs_tunnel.py @@ -19,10 +19,10 @@ import time import mock from oslo_config import cfg +from oslo_log import log from neutron.agent.linux import ip_lib from neutron.agent.linux import ovs_lib -from neutron.openstack.common import log from neutron.plugins.common import constants as p_const from neutron.plugins.openvswitch.agent import ovs_neutron_agent from neutron.plugins.openvswitch.common import constants @@ -514,7 +514,7 @@ class TunnelTest(base.BaseTestCase): ] with contextlib.nested( - mock.patch.object(log.ContextAdapter, 'exception'), + mock.patch.object(log.KeywordArgumentAdapter, 'exception'), mock.patch.object(ovs_neutron_agent.OVSNeutronAgent, 'scan_ports'), mock.patch.object(ovs_neutron_agent.OVSNeutronAgent, diff --git a/neutron/tests/unit/test_agent_ext_plugin.py b/neutron/tests/unit/test_agent_ext_plugin.py index b56af9e1896..af925208b4c 100644 --- a/neutron/tests/unit/test_agent_ext_plugin.py +++ b/neutron/tests/unit/test_agent_ext_plugin.py @@ -17,6 +17,7 @@ import copy import time from oslo_config import cfg +from oslo_log import log as logging from oslo_utils import timeutils from webob import exc @@ -27,7 +28,6 @@ from neutron import context from neutron.db import agents_db from neutron.db import db_base_plugin_v2 from neutron.extensions import agent -from neutron.openstack.common import log as logging from neutron.openstack.common import uuidutils from neutron.tests.unit import test_api_v2 from neutron.tests.unit import test_db_plugin diff --git a/neutron/tests/unit/test_extension_ext_net.py b/neutron/tests/unit/test_extension_ext_net.py index 9f03e38d519..6cb0f1fb9d4 100644 --- a/neutron/tests/unit/test_extension_ext_net.py +++ b/neutron/tests/unit/test_extension_ext_net.py @@ -17,6 +17,7 @@ import contextlib import itertools import mock +from oslo_log import log as logging import testtools from webob import exc @@ -24,7 +25,6 @@ from neutron import context from neutron.db import models_v2 from neutron.extensions import external_net as external_net from neutron import manager -from neutron.openstack.common import log as logging from neutron.openstack.common import uuidutils from neutron.tests.unit import test_api_v2 from neutron.tests.unit import test_db_plugin diff --git a/neutron/tests/unit/test_extension_extradhcpopts.py b/neutron/tests/unit/test_extension_extradhcpopts.py index ea9b60d5868..03fe2a377f0 100644 --- a/neutron/tests/unit/test_extension_extradhcpopts.py +++ b/neutron/tests/unit/test_extension_extradhcpopts.py @@ -14,12 +14,13 @@ # limitations under the License. import copy + +from oslo_log import log as logging import webob.exc from neutron.db import db_base_plugin_v2 from neutron.db import extradhcpopt_db as edo_db from neutron.extensions import extra_dhcp_opt as edo_ext -from neutron.openstack.common import log as logging from neutron.tests.unit import test_db_plugin LOG = logging.getLogger(__name__) diff --git a/neutron/tests/unit/test_extension_extraroute.py b/neutron/tests/unit/test_extension_extraroute.py index b3daa19323f..ece89c0662f 100644 --- a/neutron/tests/unit/test_extension_extraroute.py +++ b/neutron/tests/unit/test_extension_extraroute.py @@ -14,14 +14,15 @@ # under the License. import contextlib + from oslo_config import cfg +from oslo_log import log as logging from webob import exc from neutron.common import constants from neutron.db import extraroute_db from neutron.extensions import extraroute from neutron.extensions import l3 -from neutron.openstack.common import log as logging from neutron.openstack.common import uuidutils from neutron.tests.unit import test_api_v2 from neutron.tests.unit import test_l3_plugin as test_l3 diff --git a/neutron/tests/unit/test_extensions.py b/neutron/tests/unit/test_extensions.py index 8cef68933af..e1407299334 100644 --- a/neutron/tests/unit/test_extensions.py +++ b/neutron/tests/unit/test_extensions.py @@ -16,6 +16,7 @@ import abc import mock +from oslo_log import log as logging from oslo_serialization import jsonutils import routes import webob @@ -25,7 +26,6 @@ from neutron.api import extensions from neutron.common import config from neutron.common import exceptions from neutron.db import db_base_plugin_v2 -from neutron.openstack.common import log as logging from neutron.plugins.common import constants from neutron.tests import base from neutron.tests.unit import extension_stubs as ext_stubs diff --git a/neutron/tests/unit/test_l3_agent.py b/neutron/tests/unit/test_l3_agent.py index bb7272d83e2..026f4e649e6 100644 --- a/neutron/tests/unit/test_l3_agent.py +++ b/neutron/tests/unit/test_l3_agent.py @@ -15,10 +15,11 @@ import contextlib import copy -import eventlet +import eventlet import mock import netaddr +from oslo_log import log import oslo_messaging from testtools import matchers @@ -40,7 +41,6 @@ from neutron.common import config as base_config from neutron.common import constants as l3_constants from neutron.common import exceptions as n_exc from neutron.i18n import _LE -from neutron.openstack.common import log from neutron.openstack.common import uuidutils from neutron.plugins.common import constants as p_const from neutron.tests import base @@ -179,8 +179,7 @@ class BasicRouterOperationsFramework(base.BaseTestCase): super(BasicRouterOperationsFramework, self).setUp() self.conf = agent_config.setup_conf() self.conf.register_opts(base_config.core_opts) - self.conf.register_cli_opts(log.common_cli_opts) - self.conf.register_cli_opts(log.logging_cli_opts) + log.register_options(self.conf) self.conf.register_opts(l3_config.OPTS) self.conf.register_opts(ha.OPTS) agent_config.register_interface_driver_opts_helper(self.conf) diff --git a/neutron/tests/unit/test_l3_plugin.py b/neutron/tests/unit/test_l3_plugin.py index 5766ff46a9f..7bf9e6f10d2 100644 --- a/neutron/tests/unit/test_l3_plugin.py +++ b/neutron/tests/unit/test_l3_plugin.py @@ -20,6 +20,7 @@ import copy import mock import netaddr from oslo_config import cfg +from oslo_log import log as logging from oslo_utils import importutils from webob import exc @@ -42,7 +43,6 @@ from neutron.extensions import external_net from neutron.extensions import l3 from neutron.extensions import portbindings from neutron import manager -from neutron.openstack.common import log as logging from neutron.openstack.common import uuidutils from neutron.plugins.common import constants as service_constants from neutron.tests import base diff --git a/neutron/tests/unit/test_linux_dhcp.py b/neutron/tests/unit/test_linux_dhcp.py index 779bd7108e7..62de4ef9269 100644 --- a/neutron/tests/unit/test_linux_dhcp.py +++ b/neutron/tests/unit/test_linux_dhcp.py @@ -18,6 +18,7 @@ import os import mock import netaddr from oslo_config import cfg +from oslo_log import log as logging from neutron.agent.common import config from neutron.agent.dhcp import config as dhcp_config @@ -25,7 +26,6 @@ from neutron.agent.linux import dhcp from neutron.agent.linux import external_process from neutron.common import config as base_config from neutron.common import constants -from neutron.openstack.common import log as logging from neutron.tests import base LOG = logging.getLogger(__name__) diff --git a/neutron/tests/unit/test_neutron_context.py b/neutron/tests/unit/test_neutron_context.py index c04f5d7ee76..3af92997dc6 100644 --- a/neutron/tests/unit/test_neutron_context.py +++ b/neutron/tests/unit/test_neutron_context.py @@ -14,10 +14,10 @@ # under the License. import mock +from oslo_context import context as oslo_context from testtools import matchers from neutron import context -from neutron.openstack.common import local from neutron.tests import base @@ -129,23 +129,26 @@ class TestNeutronContext(base.BaseTestCase): def test_neutron_context_overwrite(self): ctx1 = context.Context('user_id', 'tenant_id') - self.assertEqual(ctx1.request_id, local.store.context.request_id) + self.assertEqual(ctx1.request_id, + oslo_context.get_current().request_id) # If overwrite is not specified, request_id should be updated. ctx2 = context.Context('user_id', 'tenant_id') self.assertNotEqual(ctx2.request_id, ctx1.request_id) - self.assertEqual(ctx2.request_id, local.store.context.request_id) + self.assertEqual(ctx2.request_id, + oslo_context.get_current().request_id) # If overwrite is specified, request_id should be kept. ctx3 = context.Context('user_id', 'tenant_id', overwrite=False) self.assertNotEqual(ctx3.request_id, ctx2.request_id) - self.assertEqual(ctx2.request_id, local.store.context.request_id) + self.assertEqual(ctx2.request_id, + oslo_context.get_current().request_id) def test_neutron_context_get_admin_context_not_update_local_store(self): ctx = context.Context('user_id', 'tenant_id') - req_id_before = local.store.context.request_id + req_id_before = oslo_context.get_current().request_id self.assertEqual(ctx.request_id, req_id_before) ctx_admin = context.get_admin_context() - self.assertEqual(req_id_before, local.store.context.request_id) + self.assertEqual(req_id_before, oslo_context.get_current().request_id) self.assertNotEqual(req_id_before, ctx_admin.request_id) diff --git a/neutron/tests/unit/test_neutron_manager.py b/neutron/tests/unit/test_neutron_manager.py index 69f13eb68ea..e86f3a0c365 100644 --- a/neutron/tests/unit/test_neutron_manager.py +++ b/neutron/tests/unit/test_neutron_manager.py @@ -16,11 +16,10 @@ import types import fixtures - from oslo_config import cfg +from oslo_log import log as logging from neutron import manager -from neutron.openstack.common import log as logging from neutron.plugins.common import constants from neutron.tests import base from neutron.tests.unit import dummy_plugin diff --git a/neutron/tests/unit/test_wsgi.py b/neutron/tests/unit/test_wsgi.py index 38b407071d0..da147f5c771 100644 --- a/neutron/tests/unit/test_wsgi.py +++ b/neutron/tests/unit/test_wsgi.py @@ -139,7 +139,7 @@ class TestWSGIServer(base.BaseTestCase): server.stop() @mock.patch.object(wsgi, 'eventlet') - @mock.patch.object(wsgi, 'logging') + @mock.patch.object(wsgi, 'loggers') def test__run(self, logging_mock, eventlet_mock): server = wsgi.Server('test') server._run("app", "socket") diff --git a/neutron/wsgi.py b/neutron/wsgi.py index d99cdaafc41..a24d3a63d90 100644 --- a/neutron/wsgi.py +++ b/neutron/wsgi.py @@ -28,6 +28,8 @@ import time import eventlet.wsgi from oslo_config import cfg import oslo_i18n +from oslo_log import log as logging +from oslo_log import loggers from oslo_serialization import jsonutils from oslo_utils import excutils import routes.middleware @@ -38,7 +40,6 @@ from neutron.common import exceptions as exception from neutron import context from neutron.db import api from neutron.i18n import _LE, _LI -from neutron.openstack.common import log as logging from neutron.openstack.common import service as common_service from neutron.openstack.common import systemd @@ -258,7 +259,7 @@ class Server(object): """Start a WSGI server in a new green thread.""" eventlet.wsgi.server(socket, application, max_size=self.num_threads, - log=logging.WritableLogger(LOG), + log=loggers.WritableLogger(LOG), keepalive=CONF.wsgi_keep_alive, socket_timeout=self.client_socket_timeout) diff --git a/openstack-common.conf b/openstack-common.conf index d6cd8711ead..1793a9d3ab4 100644 --- a/openstack-common.conf +++ b/openstack-common.conf @@ -4,8 +4,6 @@ module=cache module=eventlet_backdoor module=fileutils module=install_venv_common -module=local -module=log module=loopingcall module=middleware module=periodic_task @@ -14,6 +12,7 @@ module=service module=systemd module=threadgroup module=uuidutils +module=versionutils # The base module to hold the copy of openstack.common base=neutron