From 7b84b07f0b20b57ea875b4d2cfdcedbe9b0b66e5 Mon Sep 17 00:00:00 2001 From: terryyao Date: Thu, 23 Oct 2014 00:07:25 +0800 Subject: [PATCH] move to use oslo.i18/utils/serialization nova is switching to use oslo.i18n, oslo.utils, oslo.serialization with change https://github.com/openstack/nova/commit/d0e0ade702c2976e6ff66df7e8a27493930097bf nova.openstack.common removed some modules that has been replaced by the ones from oslo.i18n, oslo.utils, oslo.serialization. Closes-Bug: #1384039 Change-Id: I9fae9b61599a50b54fc40552b2c90fceb75d8522 --- cinder-powervc/bin/cinder-powervc | 6 +++--- .../test/powervc/volume/driver/test_powervc_cinder.py | 6 +++--- .../test/powervc/volume/manager/test_manager.py | 6 +++--- common-powervc/powervc/common/client/service.py | 2 +- common-powervc/powervc/common/utils.py | 4 ++-- common-powervc/test/common/client/test_glance.py | 6 +++--- glance-powervc/bin/glance-powervc | 8 ++++---- glance-powervc/powervc/glance/manager/manager.py | 6 +++--- neutron-powervc/bin/neutron-powervc-agent | 6 +++--- nova-powervc/bin/nova-powervc | 6 +----- nova-powervc/powervc/nova/driver/compute/manager.py | 8 ++++---- nova-powervc/powervc/nova/driver/virt/powervc/driver.py | 6 +++--- nova-powervc/powervc/nova/driver/virt/powervc/service.py | 4 ++-- .../powervc/nova/extension/host_maintenance_mode.py | 2 +- nova-powervc/test/compute/test_sync_instance.py | 5 ++--- nova-powervc/test/nova/driver/virt/powervc/test_driver.py | 2 +- 16 files changed, 39 insertions(+), 44 deletions(-) diff --git a/cinder-powervc/bin/cinder-powervc b/cinder-powervc/bin/cinder-powervc index 9f83dbf..a293dec 100644 --- a/cinder-powervc/bin/cinder-powervc +++ b/cinder-powervc/bin/cinder-powervc @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2013 IBM Corp. +# Copyright 2013, 2014 IBM Corp. """Starter script for the PowerVC cinder-volume Service.""" @@ -18,11 +18,11 @@ POSSIBLE_TOPDIR = os.path.normpath(os.path.join( if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'powervc', '__init__.py')): sys.path.insert(0, POSSIBLE_TOPDIR) -from cinder.openstack.common import gettextutils +from oslo import i18n # TODO RYKAL # This should go in the base __init__ folder I think -gettextutils.install('cinder') +i18n.install('cinder') # NOTE: Import powervc driver common config at the very beginning to parse # AMQP. diff --git a/cinder-powervc/test/powervc/volume/driver/test_powervc_cinder.py b/cinder-powervc/test/powervc/volume/driver/test_powervc_cinder.py index a47207b..7d22d2e 100644 --- a/cinder-powervc/test/powervc/volume/driver/test_powervc_cinder.py +++ b/cinder-powervc/test/powervc/volume/driver/test_powervc_cinder.py @@ -1,4 +1,4 @@ -# Copyright 2013 IBM Corp. +# Copyright 2013, 2014 IBM Corp. # mock module import mock import sys @@ -7,8 +7,8 @@ import unittest sys.modules['powervc.common.client'] = mock.MagicMock() # import _ -from cinder.openstack.common import gettextutils -gettextutils.install('cinder') +from oslo import i18n +i18n.install('cinder') from powervc.common import config from cinder import exception from cinder import db diff --git a/cinder-powervc/test/powervc/volume/manager/test_manager.py b/cinder-powervc/test/powervc/volume/manager/test_manager.py index 1c7d7a9..6eca260 100644 --- a/cinder-powervc/test/powervc/volume/manager/test_manager.py +++ b/cinder-powervc/test/powervc/volume/manager/test_manager.py @@ -1,6 +1,6 @@ -# Copyright 2013 IBM Corp. -from cinder.openstack.common import gettextutils -gettextutils.install('cinder') +# Copyright 2013, 2014 IBM Corp. +from oslo import i18n +i18n.install('cinder') import unittest import mox from powervc.volume.manager.manager import PowerVCCinderManager diff --git a/common-powervc/powervc/common/client/service.py b/common-powervc/powervc/common/client/service.py index 916b010..2d72752 100644 --- a/common-powervc/powervc/common/client/service.py +++ b/common-powervc/powervc/common/client/service.py @@ -5,7 +5,7 @@ import re import urlparse import powervc.common.client.delegate as delegate -from glanceclient.openstack.common import importutils +from oslo.utils import importutils from powervc.common.constants import SERVICE_TYPES as SERVICE_TYPES from powervc.common import netutils from powervc.common.client.extensions.glance import Extended_V2_Client diff --git a/common-powervc/powervc/common/utils.py b/common-powervc/powervc/common/utils.py index a335f72..1ef5bf3 100644 --- a/common-powervc/powervc/common/utils.py +++ b/common-powervc/powervc/common/utils.py @@ -1,4 +1,4 @@ -# Copyright 2013 IBM Corp. +# Copyright 2013, 2014 IBM Corp. import logging import exception import os @@ -7,7 +7,7 @@ import threading import time from eventlet.semaphore import Semaphore -from glanceclient.openstack.common import importutils +from oslo.utils import importutils from powervc.common import config from powervc.common import constants from powervc.common.exception import StorageConnectivityGroupNotFound diff --git a/common-powervc/test/common/client/test_glance.py b/common-powervc/test/common/client/test_glance.py index 3834df4..bf8c015 100644 --- a/common-powervc/test/common/client/test_glance.py +++ b/common-powervc/test/common/client/test_glance.py @@ -1,12 +1,12 @@ -# Copyright 2013 IBM Corp. +# Copyright 2013, 2014 IBM Corp. import unittest import mox from mock import MagicMock import glanceclient.v1.images as imagesV1 import glanceclient.v1.image_members as membersV1 -from glanceclient.openstack.common import gettextutils -gettextutils.install('common-glance-client-ut') +from oslo import i18n +i18n.install('common-glance-client-ut') import powervc.common.utils as common_utils diff --git a/glance-powervc/bin/glance-powervc b/glance-powervc/bin/glance-powervc index 77a8e96..f424340 100644 --- a/glance-powervc/bin/glance-powervc +++ b/glance-powervc/bin/glance-powervc @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2013 IBM Corp. +# Copyright 2013, 2014 IBM Corp. """Starter script for the PowerVC Driver ImageManager Service.""" @@ -24,8 +24,8 @@ if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'powervc', '__init__.py')): # TODO RYKAL # This should go in the base __init__ folder I think -from nova.openstack.common import gettextutils -gettextutils.install('glance') +from oslo import i18n +i18n.install('glance') # NOTE: Import powervc driver common config at the very beginning to parse # AMQP. @@ -35,7 +35,7 @@ from powervc.glance.common import config as glance_config from nova.openstack.common import log from nova.openstack.common import service -from nova.openstack.common import importutils +from oslo.utils import importutils CONF = glance_config.CONF diff --git a/glance-powervc/powervc/glance/manager/manager.py b/glance-powervc/powervc/glance/manager/manager.py index 9dfb697..fca5e57 100644 --- a/glance-powervc/powervc/glance/manager/manager.py +++ b/glance-powervc/powervc/glance/manager/manager.py @@ -1,4 +1,4 @@ -# Copyright 2013 IBM Corp. +# Copyright 2013, 2014 IBM Corp. """ PowerVC Driver ImageManager service @@ -16,8 +16,8 @@ from powervc.common import config from nova.openstack.common import service from nova.openstack.common import log as logging -from nova.openstack.common import timeutils -from nova.openstack.common import jsonutils +from oslo.utils import timeutils +from oslo.serialization import jsonutils from glanceclient.v1 import images as v1images from glanceclient.exc import CommunicationError from glanceclient.exc import HTTPNotFound diff --git a/neutron-powervc/bin/neutron-powervc-agent b/neutron-powervc/bin/neutron-powervc-agent index e47af2a..f35de54 100755 --- a/neutron-powervc/bin/neutron-powervc-agent +++ b/neutron-powervc/bin/neutron-powervc-agent @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2013 IBM Corp. +# Copyright 2013, 2014 IBM Corp. import os import sys @@ -31,8 +31,8 @@ if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'powervc', '__init__.py')): # TODO RYKAL # This should go in the base __init__ folder I think -from neutron.openstack.common import gettextutils -gettextutils.install('neutron') +from oslo import i18n +i18n.install('neutron') # NOTE: Import powervc driver common config at the very beginning to parse # AMQP. diff --git a/nova-powervc/bin/nova-powervc b/nova-powervc/bin/nova-powervc index 645577a..73a36c5 100644 --- a/nova-powervc/bin/nova-powervc +++ b/nova-powervc/bin/nova-powervc @@ -13,11 +13,7 @@ POSSIBLE_TOPDIR = os.path.normpath(os.path.join( if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'powervc', '__init__.py')): sys.path.insert(0, POSSIBLE_TOPDIR) -from nova.openstack.common import gettextutils - -# TODO RYKAL -# This should go in the base __init__ folder I think -gettextutils.install('nova') +from nova import i18n from powervc.nova.cmd.compute import main diff --git a/nova-powervc/powervc/nova/driver/compute/manager.py b/nova-powervc/powervc/nova/driver/compute/manager.py index d3738fb..dc6186c 100644 --- a/nova-powervc/powervc/nova/driver/compute/manager.py +++ b/nova-powervc/powervc/nova/driver/compute/manager.py @@ -1,4 +1,4 @@ -# Copyright 2013 IBM Corp. +# Copyright 2013, 2014 IBM Corp. """ Doing PowerVC initialize work, including image, instance sync. @@ -25,12 +25,12 @@ from nova.image import glance from nova.compute import flavors from nova.compute import task_states from nova.compute import vm_states -from nova.openstack.common import importutils +from oslo.utils import importutils from nova.openstack.common import log as logging -from nova.openstack.common import timeutils +from oslo.utils import timeutils from nova.openstack.common import loopingcall from nova.openstack.common.loopingcall import LoopingCallDone -from nova.openstack.common import jsonutils +from oslo.serialization import jsonutils from nova import objects from nova.objects import instance as instance_obj from nova.objects import base as obj_base diff --git a/nova-powervc/powervc/nova/driver/virt/powervc/driver.py b/nova-powervc/powervc/nova/driver/virt/powervc/driver.py index d840219..6251d11 100644 --- a/nova-powervc/powervc/nova/driver/virt/powervc/driver.py +++ b/nova-powervc/powervc/nova/driver/virt/powervc/driver.py @@ -1,4 +1,4 @@ -# Copyright 2013 IBM Corp. +# Copyright 2013, 2014 IBM Corp. import nova from novaclient.exceptions import NotFound from novaclient.exceptions import BadRequest @@ -6,9 +6,9 @@ from nova import exception from nova.compute import task_states from nova.image import glance from nova.virt import driver -from nova.openstack.common import jsonutils +from oslo.serialization import jsonutils from nova.openstack.common import log as logging -from nova.openstack.common import excutils +from oslo.utils import excutils from powervc.nova.driver.virt.powervc import service from powervc.nova.driver.compute import constants from powervc.nova.common import exception as pvc_exception diff --git a/nova-powervc/powervc/nova/driver/virt/powervc/service.py b/nova-powervc/powervc/nova/driver/virt/powervc/service.py index 1e7da64..3fe3e77 100644 --- a/nova-powervc/powervc/nova/driver/virt/powervc/service.py +++ b/nova-powervc/powervc/nova/driver/virt/powervc/service.py @@ -1,4 +1,4 @@ -# Copyright 2013 IBM Corp. +# Copyright 2013, 2014 IBM Corp. import httplib from novaclient import exceptions @@ -17,7 +17,7 @@ from powervc.common import utils from powervc import utils as powervc_utils from powervc.common.gettextutils import _ from nova.exception import Invalid -from nova.openstack.common import excutils +from oslo.utils import excutils from powervc.nova.driver.compute import task_states from nova.compute import flavors from novaclient.v1_1 import servers diff --git a/nova-powervc/powervc/nova/extension/host_maintenance_mode.py b/nova-powervc/powervc/nova/extension/host_maintenance_mode.py index 7f4ed1b..20f6f18 100644 --- a/nova-powervc/powervc/nova/extension/host_maintenance_mode.py +++ b/nova-powervc/powervc/nova/extension/host_maintenance_mode.py @@ -4,7 +4,7 @@ from webob import exc from nova.api.openstack import extensions from nova.api.openstack import wsgi from nova import compute -from nova.openstack.common.gettextutils import _ +from nova.i18n import _ from powervc.common import constants as common_constants from powervc.common import config diff --git a/nova-powervc/test/compute/test_sync_instance.py b/nova-powervc/test/compute/test_sync_instance.py index 445c12b..51231c2 100644 --- a/nova-powervc/test/compute/test_sync_instance.py +++ b/nova-powervc/test/compute/test_sync_instance.py @@ -1,9 +1,8 @@ -# Copyright 2013 IBM Corp. +# Copyright 2013, 2014 IBM Corp. import unittest import mox -from nova.openstack.common import gettextutils -gettextutils.install('nova') +from nova.i18n import _ from nova.compute import flavors diff --git a/nova-powervc/test/nova/driver/virt/powervc/test_driver.py b/nova-powervc/test/nova/driver/virt/powervc/test_driver.py index 51aafd8..aabb164 100644 --- a/nova-powervc/test/nova/driver/virt/powervc/test_driver.py +++ b/nova-powervc/test/nova/driver/virt/powervc/test_driver.py @@ -7,7 +7,7 @@ import os from nova import exception os.environ['EVENTLET_NO_GREENDNS'] = 'yes' from nova import test -from nova.openstack.common import jsonutils +from oslo.serialization import jsonutils from nova.compute import task_states from nova.image import glance from nova import db