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
diff --git a/neutron/tests/tempest/api/network/base.py b/neutron/tests/tempest/api/network/base.py
index b2c2e97..65fed58 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 63d5eab..15cc9b0 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 ceee265..8d64b87 100644
--- a/neutron/tests/tempest/auth.py
+++ b/neutron/tests/tempest/auth.py
@@ -20,9 +20,9 @@
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 2cb8cec..e10817b 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 f132e86..392c9d0 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 a999cfc..fda955c 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 2771823..d3cae26 100644
--- a/neutron/tests/tempest/common/generator/base_generator.py
+++ b/neutron/tests/tempest/common/generator/base_generator.py
@@ -17,8 +17,7 @@
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 704d9fb..ba8884f 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 4d1906e..8ff9259 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 c802472..66fc2ab 100644
--- a/neutron/tests/tempest/common/glance_http.py
+++ b/neutron/tests/tempest/common/glance_http.py
@@ -28,11 +28,11 @@
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 41d7390..e4b0b08 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.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 de1ad88..00febc6 100644
--- a/neutron/tests/tempest/common/ssh.py
+++ b/neutron/tests/tempest/common/ssh.py
@@ -20,10 +20,10 @@
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 cc0004d..b97dd86 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 b54ef73..049d5ca 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 deab890..569fc4b 100644
--- a/neutron/tests/tempest/config.py
+++ b/neutron/tests/tempest/config.py
@@ -18,10 +18,9 @@
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 @@
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 @@
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 @@
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 27975b3..11ea90f 100644
--- a/neutron/tests/tempest/test.py
+++ b/neutron/tests/tempest/test.py
@@ -24,6 +24,8 @@
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 @@
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__)