]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Move oslo.db to oslo_db namespace
authorJay S. Bryant <jsbryant@us.ibm.com>
Thu, 15 Jan 2015 00:16:32 +0000 (18:16 -0600)
committerJay S. Bryant <jsbryant@us.ibm.com>
Thu, 15 Jan 2015 20:59:22 +0000 (14:59 -0600)
This is the second in a series of changes to move to using
the new oslo_<library> namespace that is being used for
oslo libraries.

There is currently a shim in place that is allowing the old
oslo.<library> imports to work, but we need to be prepared for
when the shims go away.  Thus, we need patches like this one to
move to the new namespace.

This patch also updates our hacking check to ensure that no instances
of oslo.db sneak back in.

Change-Id: Ibebed114a362e199e03c83d7d229841e8f88932b

14 files changed:
cinder/cmd/manage.py
cinder/db/api.py
cinder/db/migration.py
cinder/db/sqlalchemy/api.py
cinder/db/sqlalchemy/models.py
cinder/hacking/checks.py
cinder/service.py
cinder/tests/test_cmd.py
cinder/tests/test_hacking.py
cinder/tests/test_migrations.py
cinder/tests/test_qos_specs.py
cinder/tests/test_service.py
cinder/volume/qos_specs.py
cinder/volume/volume_types.py

index 05b491746a260a5a8a0f31a5552883c612fd9bf5..f278a210c0bb039043bb8ca8009258f449169764 100644 (file)
@@ -62,8 +62,8 @@ import warnings
 warnings.simplefilter('once', DeprecationWarning)
 
 from oslo.config import cfg
-from oslo.db.sqlalchemy import migration
 from oslo import messaging
+from oslo_db.sqlalchemy import migration
 
 from cinder import i18n
 i18n.enable_lazy()
index 4a393e60d752dd2f8741da9edbb5bf17c4771db3..ecd3d4bf2221f7286756a7adfdcabf6083f3077b 100644 (file)
@@ -42,8 +42,8 @@ these objects be simple dictionaries.
 """
 
 from oslo.config import cfg
-from oslo.db import concurrency as db_concurrency
-from oslo.db import options as db_options
+from oslo_db import concurrency as db_concurrency
+from oslo_db import options as db_options
 
 
 db_opts = [
index 29f5b7ec9c82c0869b4944985191d49e518a9830..f00cf55c1152c9dc0cc3f7bdaef84aface74f612 100644 (file)
@@ -20,7 +20,7 @@ import os
 import threading
 
 from oslo.config import cfg
-from oslo import db
+from oslo_db import options
 from stevedore import driver
 
 from cinder.db.sqlalchemy import api as db_api
@@ -30,7 +30,7 @@ INIT_VERSION = 000
 _IMPL = None
 _LOCK = threading.Lock()
 
-db.options.set_defaults(cfg.CONF)
+options.set_defaults(cfg.CONF)
 
 MIGRATE_REPO_PATH = os.path.join(
     os.path.abspath(os.path.dirname(__file__)),
index fd771a9b8155692b4bccd14fd6d38db720e5087f..2a3c2d4b226cd325d3ce547ac77ed8fcf6eb41aa 100644 (file)
@@ -27,10 +27,10 @@ import uuid
 import warnings
 
 from oslo.config import cfg
-from oslo.db import exception as db_exc
-from oslo.db import options
-from oslo.db.sqlalchemy import session as db_session
 from oslo.utils import timeutils
+from oslo_db import exception as db_exc
+from oslo_db import options
+from oslo_db.sqlalchemy import session as db_session
 import osprofiler.sqlalchemy
 import six
 import sqlalchemy
index 73f960a33eb3d5a00809b786409eae78c5569478..b61a127da8e83a72e0ed740f8f72121ba0f83d0c 100644 (file)
@@ -20,8 +20,8 @@ SQLAlchemy models for cinder data.
 """
 
 from oslo.config import cfg
-from oslo.db.sqlalchemy import models
 from oslo.utils import timeutils
+from oslo_db.sqlalchemy import models
 from sqlalchemy import Column, Integer, String, Text, schema
 from sqlalchemy.ext.declarative import declarative_base
 from sqlalchemy import ForeignKey, DateTime, Boolean
index 36da480acb7e8bce99692bc8cac8902886600623..ff4e1dd3342dccf1df230b11f1477cc452441519 100644 (file)
@@ -43,7 +43,7 @@ no_audit_log = re.compile(r"(.)*LOG\.audit(.)*")
 
 # NOTE(jsbryant): When other oslo libraries switch over non-namespaced
 # imports, we will need to add them to the regex below.
-oslo_namespace_imports = re.compile(r"from[\s]*oslo[.](concurrency)")
+oslo_namespace_imports = re.compile(r"from[\s]*oslo[.](concurrency|db)")
 
 
 def no_vi_headers(physical_line, line_number, lines):
index 4401373ba90da8a8a087d219332657b2a84b12f3..5e9a3b6bd3e932318b3ff5b8ae3351cd35b5d46f 100644 (file)
@@ -23,10 +23,10 @@ import os
 import random
 
 from oslo.config import cfg
-from oslo.db import exception as db_exc
 from oslo import messaging
 from oslo.utils import importutils
 from oslo_concurrency import processutils
+from oslo_db import exception as db_exc
 import osprofiler.notifier
 from osprofiler import profiler
 import osprofiler.web
index f0016bb5626201912dcc63d1738c230641c35f3c..18c9e81ddea2ef0810a846a90583b85bb7d29518 100644 (file)
@@ -337,7 +337,7 @@ class TestCinderManageCmd(test.TestCase):
         db_cmds.sync(version=version)
         db_sync.assert_called_once_with(version)
 
-    @mock.patch('oslo.db.sqlalchemy.migration.db_version')
+    @mock.patch('oslo_db.sqlalchemy.migration.db_version')
     def test_db_commands_version(self, db_version):
         db_cmds = cinder_manage.DbCommands()
         db_cmds.version()
index 1849eecab9e0a4d19ddf692e3d1b361c412935e6..95ffcba90e5ac95ba99c79199d92a6ba5023676f 100644 (file)
@@ -116,3 +116,7 @@ class HackingTestCase(test.TestCase):
             "from oslo.concurrency import foo"))))
         self.assertEqual(0, len(list(checks.check_oslo_namespace_imports(
             "from oslo_concurrency import bar"))))
+        self.assertEqual(1, len(list(checks.check_oslo_namespace_imports(
+            "from oslo.db import foo"))))
+        self.assertEqual(0, len(list(checks.check_oslo_namespace_imports(
+            "from oslo_db import bar"))))
index 739090c1206dc764d81ad74b4424281c0fe59795..2c0ead4ac0d9127e11293c9e717af902d11f2630 100644 (file)
@@ -24,9 +24,9 @@ import uuid
 
 from migrate.versioning import api as migration_api
 from migrate.versioning import repository
-from oslo.db.sqlalchemy import test_base
-from oslo.db.sqlalchemy import test_migrations
-from oslo.db.sqlalchemy import utils as db_utils
+from oslo_db.sqlalchemy import test_base
+from oslo_db.sqlalchemy import test_migrations
+from oslo_db.sqlalchemy import utils as db_utils
 import sqlalchemy
 
 from cinder.db import migration
index ea8d2bb534774a02d9beec44186249725b394492..01ec065b625db0fa07f269470de82ff36f5670b7 100644 (file)
@@ -19,7 +19,7 @@ Unit Tests for qos specs internal API
 
 import time
 
-from oslo.db import exception as db_exc
+from oslo_db import exception as db_exc
 
 from cinder import context
 from cinder import db
index 2ddb3162a4100a22fd615021903b8c1310c8c74c..2f80cea3f5c6712d3e74defa7c84ab54badd2ccf 100644 (file)
@@ -23,8 +23,8 @@ Unit Tests for remote procedure calls using queue
 import mock
 import mox
 from oslo.config import cfg
-from oslo.db import exception as db_exc
 from oslo_concurrency import processutils
+from oslo_db import exception as db_exc
 
 from cinder import context
 from cinder import db
index 3ab430ea95a3de4065fbae6ab2334f407bf6a552..020e215c85de7a85ad107d785c5a77e470239804 100644 (file)
@@ -17,7 +17,7 @@
 
 
 from oslo.config import cfg
-from oslo.db import exception as db_exc
+from oslo_db import exception as db_exc
 
 from cinder import context
 from cinder import db
index 5bff32ba5bc9d844ddaa8e9842085023429ecf23..19959681fc244671333e74fd465af91dc6c745e5 100644 (file)
@@ -21,7 +21,7 @@
 
 
 from oslo.config import cfg
-from oslo.db import exception as db_exc
+from oslo_db import exception as db_exc
 import six
 
 from cinder import context