diff --git a/ironic/api/controllers/v1/types.py b/ironic/api/controllers/v1/types.py index f15adfc3d8..8c3187b1d4 100644 --- a/ironic/api/controllers/v1/types.py +++ b/ironic/api/controllers/v1/types.py @@ -15,12 +15,12 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo.utils import strutils import wsme from wsme import types as wtypes from ironic.common import exception from ironic.common import utils -from ironic.openstack.common import strutils class MacAddressType(wtypes.UserType): diff --git a/ironic/common/glance_service/service_utils.py b/ironic/common/glance_service/service_utils.py index 4bbd3aab52..c402f9e4cc 100644 --- a/ironic/common/glance_service/service_utils.py +++ b/ironic/common/glance_service/service_utils.py @@ -18,12 +18,12 @@ import copy import logging from oslo.config import cfg +from oslo.utils import timeutils import six import six.moves.urllib.parse as urlparse from ironic.common import exception from ironic.openstack.common import jsonutils -from ironic.openstack.common import timeutils CONF = cfg.CONF diff --git a/ironic/common/image_service.py b/ironic/common/image_service.py index fff7135a3a..d20b50dda3 100644 --- a/ironic/common/image_service.py +++ b/ironic/common/image_service.py @@ -15,9 +15,8 @@ # under the License. -from ironic.openstack.common import importutils - from oslo.config import cfg +from oslo.utils import importutils glance_opts = [ @@ -58,7 +57,7 @@ def import_versioned_module(version, submodule=None): module = 'ironic.common.glance_service.v%s' % version if submodule: module = '.'.join((module, submodule)) - return importutils.import_module(module) + return importutils.try_import(module) def Service(client=None, version=1, context=None): diff --git a/ironic/common/service.py b/ironic/common/service.py index 97b262e062..b313e8196c 100644 --- a/ironic/common/service.py +++ b/ironic/common/service.py @@ -20,13 +20,13 @@ import socket from oslo.config import cfg from oslo import messaging +from oslo.utils import importutils from ironic.common import config from ironic.common import rpc from ironic.objects import base as objects_base from ironic.openstack.common import context from ironic.openstack.common.gettextutils import _LI -from ironic.openstack.common import importutils from ironic.openstack.common import log from ironic.openstack.common import service @@ -54,7 +54,7 @@ class RPCService(service.Service): def __init__(self, host, manager_module, manager_class): super(RPCService, self).__init__() self.host = host - manager_module = importutils.import_module(manager_module) + manager_module = importutils.try_import(manager_module) manager_class = getattr(manager_module, manager_class) self.manager = manager_class(host, manager_module.MANAGER_TOPIC) self.topic = self.manager.topic diff --git a/ironic/conductor/manager.py b/ironic/conductor/manager.py index 517518f060..fb0b523f75 100644 --- a/ironic/conductor/manager.py +++ b/ironic/conductor/manager.py @@ -50,6 +50,7 @@ from eventlet import greenpool from oslo.config import cfg from oslo import messaging +from oslo.utils import excutils from ironic.common import driver_factory from ironic.common import exception @@ -63,7 +64,6 @@ from ironic.conductor import task_manager from ironic.conductor import utils from ironic.db import api as dbapi from ironic import objects -from ironic.openstack.common import excutils from ironic.openstack.common import lockutils from ironic.openstack.common import log from ironic.openstack.common import periodic_task diff --git a/ironic/conductor/task_manager.py b/ironic/conductor/task_manager.py index db0b3fd626..b89b95ed6c 100644 --- a/ironic/conductor/task_manager.py +++ b/ironic/conductor/task_manager.py @@ -88,8 +88,7 @@ code when the spawned task generates an exception: import retrying from oslo.config import cfg - -from ironic.openstack.common import excutils +from oslo.utils import excutils from ironic.common import driver_factory from ironic.common import exception diff --git a/ironic/conductor/utils.py b/ironic/conductor/utils.py index fe771189d6..c78af0ce12 100644 --- a/ironic/conductor/utils.py +++ b/ironic/conductor/utils.py @@ -12,10 +12,11 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo.utils import excutils + from ironic.common import exception from ironic.common import states from ironic.conductor import task_manager -from ironic.openstack.common import excutils from ironic.openstack.common.gettextutils import _LI from ironic.openstack.common import log diff --git a/ironic/db/sqlalchemy/api.py b/ironic/db/sqlalchemy/api.py index 1d29353ae7..96de0c7815 100644 --- a/ironic/db/sqlalchemy/api.py +++ b/ironic/db/sqlalchemy/api.py @@ -24,6 +24,7 @@ from oslo.db import exception as db_exc from oslo.db import options as db_options from oslo.db.sqlalchemy import session as db_session from oslo.db.sqlalchemy import utils as db_utils +from oslo.utils import timeutils from sqlalchemy.orm.exc import NoResultFound from ironic.common import exception @@ -34,7 +35,6 @@ from ironic.db import api from ironic.db.sqlalchemy import models from ironic import objects from ironic.openstack.common import log -from ironic.openstack.common import timeutils CONF = cfg.CONF CONF.import_opt('heartbeat_timeout', diff --git a/ironic/drivers/fake.py b/ironic/drivers/fake.py index 474576cb8e..b5b2bb33fa 100644 --- a/ironic/drivers/fake.py +++ b/ironic/drivers/fake.py @@ -17,6 +17,8 @@ Fake drivers used in testing. """ +from oslo.utils import importutils + from ironic.common import exception from ironic.drivers import base from ironic.drivers.modules import agent @@ -28,7 +30,6 @@ from ironic.drivers.modules import pxe from ironic.drivers.modules import seamicro from ironic.drivers.modules import ssh from ironic.drivers import utils -from ironic.openstack.common import importutils class FakeDriver(base.BaseDriver): diff --git a/ironic/drivers/ilo.py b/ironic/drivers/ilo.py index 65fb8c1f83..338bc96707 100644 --- a/ironic/drivers/ilo.py +++ b/ironic/drivers/ilo.py @@ -15,10 +15,11 @@ iLO Driver for managing HP Proliant Gen8 and above servers. """ +from oslo.utils import importutils + from ironic.common import exception from ironic.drivers import base from ironic.drivers.modules.ilo import power -from ironic.openstack.common import importutils class IloDriver(base.BaseDriver): diff --git a/ironic/drivers/modules/agent.py b/ironic/drivers/modules/agent.py index 0ed95edba2..92ce5decf0 100644 --- a/ironic/drivers/modules/agent.py +++ b/ironic/drivers/modules/agent.py @@ -16,6 +16,7 @@ import os import time from oslo.config import cfg +from oslo.utils import excutils from ironic.common import exception from ironic.common import i18n @@ -33,7 +34,6 @@ from ironic.drivers import base from ironic.drivers.modules import agent_client from ironic.drivers.modules import image_cache from ironic import objects -from ironic.openstack.common import excutils from ironic.openstack.common import fileutils from ironic.openstack.common import log diff --git a/ironic/drivers/modules/deploy_utils.py b/ironic/drivers/modules/deploy_utils.py index 3864acc0a5..b63ea9a615 100644 --- a/ironic/drivers/modules/deploy_utils.py +++ b/ironic/drivers/modules/deploy_utils.py @@ -20,10 +20,11 @@ import socket import stat import time +from oslo.utils import excutils + from ironic.common import disk_partitioner from ironic.common import exception from ironic.common import utils -from ironic.openstack.common import excutils from ironic.openstack.common import log as logging from ironic.openstack.common import processutils diff --git a/ironic/drivers/modules/iboot.py b/ironic/drivers/modules/iboot.py index 6a4be83542..865413dde9 100644 --- a/ironic/drivers/modules/iboot.py +++ b/ironic/drivers/modules/iboot.py @@ -19,11 +19,12 @@ Ironic iBoot PDU power manager. """ +from oslo.utils import importutils + from ironic.common import exception from ironic.common import states from ironic.conductor import task_manager from ironic.drivers import base -from ironic.openstack.common import importutils from ironic.openstack.common import log as logging iboot = importutils.try_import('iboot') diff --git a/ironic/drivers/modules/ilo/common.py b/ironic/drivers/modules/ilo/common.py index 80d503bd43..a386f02944 100644 --- a/ironic/drivers/modules/ilo/common.py +++ b/ironic/drivers/modules/ilo/common.py @@ -17,9 +17,9 @@ Common functionalities shared between different iLO modules. """ from oslo.config import cfg +from oslo.utils import importutils from ironic.common import exception -from ironic.openstack.common import importutils from ironic.openstack.common import log as logging ilo_client = importutils.try_import('proliantutils.ilo.ribcl') diff --git a/ironic/drivers/modules/ilo/power.py b/ironic/drivers/modules/ilo/power.py index 5faf74282b..e6465da923 100644 --- a/ironic/drivers/modules/ilo/power.py +++ b/ironic/drivers/modules/ilo/power.py @@ -17,13 +17,13 @@ iLO Power Driver """ from oslo.config import cfg +from oslo.utils import importutils from ironic.common import exception from ironic.common import states from ironic.conductor import task_manager from ironic.drivers import base from ironic.drivers.modules.ilo import common as ilo_common -from ironic.openstack.common import importutils from ironic.openstack.common import log as logging from ironic.openstack.common import loopingcall diff --git a/ironic/drivers/modules/ipminative.py b/ironic/drivers/modules/ipminative.py index 6b6bcada95..70961d8646 100644 --- a/ironic/drivers/modules/ipminative.py +++ b/ironic/drivers/modules/ipminative.py @@ -20,6 +20,7 @@ Ironic Native IPMI power manager. """ from oslo.config import cfg +from oslo.utils import importutils from ironic.common import boot_devices from ironic.common import exception @@ -27,7 +28,6 @@ from ironic.common import i18n from ironic.common import states from ironic.conductor import task_manager from ironic.drivers import base -from ironic.openstack.common import importutils from ironic.openstack.common import log as logging pyghmi = importutils.try_import('pyghmi') diff --git a/ironic/drivers/modules/ipmitool.py b/ironic/drivers/modules/ipmitool.py index 0c32ca8a00..24faca8722 100644 --- a/ironic/drivers/modules/ipmitool.py +++ b/ironic/drivers/modules/ipmitool.py @@ -37,6 +37,7 @@ import tempfile import time from oslo.config import cfg +from oslo.utils import excutils from ironic.common import boot_devices from ironic.common import exception @@ -46,7 +47,6 @@ from ironic.common import utils from ironic.conductor import task_manager from ironic.drivers import base from ironic.drivers.modules import console_utils -from ironic.openstack.common import excutils from ironic.openstack.common import log as logging from ironic.openstack.common import loopingcall from ironic.openstack.common import processutils diff --git a/ironic/drivers/modules/pxe.py b/ironic/drivers/modules/pxe.py index 961f021d79..9322bfea01 100644 --- a/ironic/drivers/modules/pxe.py +++ b/ironic/drivers/modules/pxe.py @@ -20,6 +20,7 @@ PXE Driver and supporting meta-classes. import os from oslo.config import cfg +from oslo.utils import strutils from ironic.common import exception from ironic.common import image_service as service @@ -38,7 +39,6 @@ from ironic.drivers.modules import image_cache from ironic.drivers import utils as driver_utils from ironic.openstack.common import fileutils from ironic.openstack.common import log as logging -from ironic.openstack.common import strutils pxe_opts = [ diff --git a/ironic/drivers/modules/seamicro.py b/ironic/drivers/modules/seamicro.py index 0ab2c549f2..0274e0f374 100644 --- a/ironic/drivers/modules/seamicro.py +++ b/ironic/drivers/modules/seamicro.py @@ -20,6 +20,7 @@ Provides vendor passthru methods for SeaMicro specific functionality. """ from oslo.config import cfg +from oslo.utils import importutils from ironic.common import boot_devices from ironic.common import exception @@ -27,7 +28,6 @@ from ironic.common import i18n from ironic.common import states from ironic.conductor import task_manager from ironic.drivers import base -from ironic.openstack.common import importutils from ironic.openstack.common import log as logging from ironic.openstack.common import loopingcall diff --git a/ironic/drivers/pxe.py b/ironic/drivers/pxe.py index 3c5dc18ec6..d7b856d278 100644 --- a/ironic/drivers/pxe.py +++ b/ironic/drivers/pxe.py @@ -17,6 +17,8 @@ PXE Driver and supporting meta-classes. """ +from oslo.utils import importutils + from ironic.common import exception from ironic.drivers import base from ironic.drivers.modules import iboot @@ -26,7 +28,6 @@ from ironic.drivers.modules import pxe from ironic.drivers.modules import seamicro from ironic.drivers.modules import ssh from ironic.drivers import utils -from ironic.openstack.common import importutils class PXEAndIPMIToolDriver(base.BaseDriver): diff --git a/ironic/objects/utils.py b/ironic/objects/utils.py index 4cda17b01e..c9761f0e61 100644 --- a/ironic/objects/utils.py +++ b/ironic/objects/utils.py @@ -19,10 +19,9 @@ import datetime import iso8601 import netaddr +from oslo.utils import timeutils import six -from ironic.openstack.common import timeutils - def datetime_or_none(dt): """Validate a datetime or None value.""" diff --git a/ironic/tests/api/v1/test_chassis.py b/ironic/tests/api/v1/test_chassis.py index 0567c59e5a..d8165a02f1 100644 --- a/ironic/tests/api/v1/test_chassis.py +++ b/ironic/tests/api/v1/test_chassis.py @@ -20,10 +20,10 @@ import datetime import mock from oslo.config import cfg from oslo.db.openstack.common import timeutils as db_timeutils +from oslo.utils import timeutils from six.moves.urllib import parse as urlparse from ironic.common import utils -from ironic.openstack.common import timeutils from ironic.tests.api import base from ironic.tests.api import utils as apiutils from ironic.tests.db import utils as dbutils diff --git a/ironic/tests/api/v1/test_nodes.py b/ironic/tests/api/v1/test_nodes.py index 858449317a..751e9a59b9 100644 --- a/ironic/tests/api/v1/test_nodes.py +++ b/ironic/tests/api/v1/test_nodes.py @@ -20,6 +20,7 @@ import datetime import mock from oslo.config import cfg from oslo.db.openstack.common import timeutils as db_timeutils +from oslo.utils import timeutils from six.moves.urllib import parse as urlparse from testtools.matchers import HasLength @@ -29,7 +30,6 @@ from ironic.common import utils from ironic.conductor import rpcapi from ironic import objects from ironic.openstack.common import context -from ironic.openstack.common import timeutils from ironic.tests.api import base from ironic.tests.api import utils as apiutils from ironic.tests.db import utils as dbutils diff --git a/ironic/tests/api/v1/test_ports.py b/ironic/tests/api/v1/test_ports.py index 3b345f9442..0198f13943 100644 --- a/ironic/tests/api/v1/test_ports.py +++ b/ironic/tests/api/v1/test_ports.py @@ -20,6 +20,7 @@ import datetime import mock from oslo.config import cfg from oslo.db.openstack.common import timeutils as db_timeutils +from oslo.utils import timeutils from six.moves.urllib import parse as urlparse from testtools.matchers import HasLength @@ -27,7 +28,6 @@ from ironic.common import exception from ironic.common import utils from ironic.conductor import rpcapi from ironic.openstack.common import context -from ironic.openstack.common import timeutils from ironic.tests.api import base from ironic.tests.api import utils as apiutils from ironic.tests.db import utils as dbutils diff --git a/ironic/tests/db/test_conductor.py b/ironic/tests/db/test_conductor.py index c392287652..e9b54de6b9 100644 --- a/ironic/tests/db/test_conductor.py +++ b/ironic/tests/db/test_conductor.py @@ -18,10 +18,10 @@ import datetime import mock +from oslo.utils import timeutils from ironic.common import exception from ironic.db import api as dbapi -from ironic.openstack.common import timeutils from ironic.tests.db import base from ironic.tests.db import utils diff --git a/ironic/tests/db/test_nodes.py b/ironic/tests/db/test_nodes.py index 0f81e62a5a..1b066398b9 100644 --- a/ironic/tests/db/test_nodes.py +++ b/ironic/tests/db/test_nodes.py @@ -18,13 +18,13 @@ import datetime import mock +from oslo.utils import timeutils import six from ironic.common import exception from ironic.common import states from ironic.common import utils as ironic_utils from ironic.db import api as dbapi -from ironic.openstack.common import timeutils from ironic.tests.db import base from ironic.tests.db import utils diff --git a/ironic/tests/drivers/ilo/test_common.py b/ironic/tests/drivers/ilo/test_common.py index 75db201167..397279145b 100644 --- a/ironic/tests/drivers/ilo/test_common.py +++ b/ironic/tests/drivers/ilo/test_common.py @@ -18,12 +18,12 @@ import mock from oslo.config import cfg +from oslo.utils import importutils from ironic.common import exception from ironic.db import api as dbapi from ironic.drivers.modules.ilo import common as ilo_common from ironic.openstack.common import context -from ironic.openstack.common import importutils from ironic.tests import base from ironic.tests.db import utils as db_utils from ironic.tests.objects import utils as obj_utils diff --git a/ironic/tests/drivers/ilo/test_power.py b/ironic/tests/drivers/ilo/test_power.py index 2dbfe72ae2..7f65326fca 100644 --- a/ironic/tests/drivers/ilo/test_power.py +++ b/ironic/tests/drivers/ilo/test_power.py @@ -17,6 +17,7 @@ import mock from oslo.config import cfg +from oslo.utils import importutils from ironic.common import exception from ironic.common import states @@ -25,7 +26,6 @@ from ironic.db import api as dbapi from ironic.drivers.modules.ilo import common as ilo_common from ironic.drivers.modules.ilo import power as ilo_power from ironic.openstack.common import context -from ironic.openstack.common import importutils from ironic.tests import base from ironic.tests.conductor import utils as mgr_utils from ironic.tests.db import utils as db_utils diff --git a/ironic/tests/drivers/third_party_driver_mocks.py b/ironic/tests/drivers/third_party_driver_mocks.py index 4eb656e856..f9877f06a3 100644 --- a/ironic/tests/drivers/third_party_driver_mocks.py +++ b/ironic/tests/drivers/third_party_driver_mocks.py @@ -29,9 +29,9 @@ Current list of mocked libraries: import sys import mock +from oslo.utils import importutils from ironic.drivers.modules import ipmitool -from ironic.openstack.common import importutils # attempt to load the external 'seamicroclient' library, which is diff --git a/ironic/tests/objects/test_conductor.py b/ironic/tests/objects/test_conductor.py index 4851249adc..599de39d2d 100644 --- a/ironic/tests/objects/test_conductor.py +++ b/ironic/tests/objects/test_conductor.py @@ -17,12 +17,12 @@ import datetime import mock +from oslo.utils import timeutils from ironic.db import api as db_api from ironic.db.sqlalchemy import models from ironic import objects from ironic.objects import utils as obj_utils -from ironic.openstack.common import timeutils from ironic.tests.db import base from ironic.tests.db import utils diff --git a/ironic/tests/objects/test_node.py b/ironic/tests/objects/test_node.py index cea5445a02..8e421a09c8 100644 --- a/ironic/tests/objects/test_node.py +++ b/ironic/tests/objects/test_node.py @@ -16,12 +16,12 @@ import datetime import mock +from oslo.utils import timeutils from ironic.common import exception from ironic.db import api as db_api from ironic.db.sqlalchemy import models from ironic import objects -from ironic.openstack.common import timeutils from ironic.tests.db import base from ironic.tests.db import utils diff --git a/ironic/tests/objects/test_objects.py b/ironic/tests/objects/test_objects.py index b6c45da568..0a7bb2e8cc 100644 --- a/ironic/tests/objects/test_objects.py +++ b/ironic/tests/objects/test_objects.py @@ -18,13 +18,13 @@ import gettext import iso8601 import netaddr +from oslo.utils import timeutils import six from ironic.common import exception from ironic.objects import base from ironic.objects import utils from ironic.openstack.common import context -from ironic.openstack.common import timeutils from ironic.tests import base as test_base gettext.install('ironic') diff --git a/ironic/tests/test_images.py b/ironic/tests/test_images.py index 42e8c1e614..1a432a2c66 100644 --- a/ironic/tests/test_images.py +++ b/ironic/tests/test_images.py @@ -19,9 +19,10 @@ import contextlib import fixtures +from oslo.utils import excutils + from ironic.common import exception from ironic.common import images -from ironic.openstack.common import excutils from ironic.tests import base diff --git a/openstack-common.conf b/openstack-common.conf index 4562c7dc0a..abf4460f46 100644 --- a/openstack-common.conf +++ b/openstack-common.conf @@ -9,18 +9,15 @@ module=excutils module=fileutils module=gettextutils module=imageutils -module=importutils module=jsonutils module=local module=lockutils module=log module=loopingcall -module=network_utils module=periodic_task module=policy module=processutils module=service -module=strutils module=timeutils module=versionutils diff --git a/requirements.txt b/requirements.txt index 5244eebfc6..e60a785bfe 100644 --- a/requirements.txt +++ b/requirements.txt @@ -25,6 +25,7 @@ oslo.config>=1.4.0.0a3 oslo.db>=0.2.0 # Apache-2.0 oslo.rootwrap>=1.3.0.0a1 oslo.i18n>=0.1.0 # Apache-2.0 +oslo.utils>=0.1.1 # Apache-2.0 pecan>=0.5.0 six>=1.7.0 jsonpatch>=1.1