From 94aead783abedef1d590d617c84df028cef16df4 Mon Sep 17 00:00:00 2001 From: Gary Kotton Date: Tue, 7 Jul 2015 02:04:55 -0700 Subject: [PATCH] Make use of oslo_service for loopingcall No longer need openstack-common conf that pulls in the above code. In addition this this uses the translation imports from Neutron. Change-Id: I475aa6936f126264d6de3ba9e25838d5dffddf3d --- openstack-common.conf | 6 - requirements.txt | 1 + tox.ini | 2 +- .../neutron/plugins/vmware/api_client/base.py | 2 +- .../plugins/vmware/api_client/client.py | 2 +- .../vmware/api_client/eventlet_client.py | 2 +- .../vmware/api_client/eventlet_request.py | 2 +- .../plugins/vmware/api_client/request.py | 2 +- .../plugins/vmware/api_client/version.py | 2 +- .../neutron/plugins/vmware/common/config.py | 2 +- .../plugins/vmware/common/nsx_utils.py | 2 +- .../neutron/plugins/vmware/common/sync.py | 4 +- .../neutron/plugins/vmware/dbexts/nsxv_db.py | 2 +- .../neutron/plugins/vmware/dbexts/qos_db.py | 2 +- .../plugins/vmware/dhcp_meta/lsnmanager.py | 2 +- .../plugins/vmware/dhcp_meta/migration.py | 2 +- .../neutron/plugins/vmware/dhcp_meta/nsx.py | 2 +- .../neutron/plugins/vmware/dhcp_meta/rpc.py | 2 +- .../neutron/plugins/vmware/dhcpmeta_modes.py | 2 +- vmware_nsx/neutron/plugins/vmware/dvs/dvs.py | 2 +- .../neutron/plugins/vmware/nsx_cluster.py | 2 +- .../neutron/plugins/vmware/nsxlib/router.py | 2 +- .../neutron/plugins/vmware/nsxlib/secgroup.py | 2 +- .../neutron/plugins/vmware/nsxlib/switch.py | 2 +- .../plugins/vmware/nsxlib/v3/__init__.py | 2 +- .../neutron/plugins/vmware/plugins/base.py | 2 +- .../neutron/plugins/vmware/plugins/dvs.py | 2 +- .../plugins/vmware/plugins/managers.py | 2 +- .../neutron/plugins/vmware/plugins/nsx_v.py | 2 +- .../plugins/vmware/plugins/nsx_v3_plugin.py | 2 +- .../plugins/vmware/plugins/nsx_v_md_proxy.py | 2 +- .../vmware/vshield/edge_appliance_driver.py | 2 +- .../vmware/vshield/edge_firewall_driver.py | 2 +- .../vmware/vshield/edge_ipsecvpn_driver.py | 2 +- .../vshield/edge_loadbalancer_driver.py | 2 +- .../plugins/vmware/vshield/edge_utils.py | 2 +- .../plugins/vmware/vshield/tasks/tasks.py | 4 +- .../apiclient/test_api_eventlet_request.py | 3 +- vmware_nsx/openstack/__init__.py | 0 vmware_nsx/openstack/common/__init__.py | 0 vmware_nsx/openstack/common/_i18n.py | 45 ------ vmware_nsx/openstack/common/loopingcall.py | 147 ------------------ 42 files changed, 39 insertions(+), 237 deletions(-) delete mode 100644 openstack-common.conf delete mode 100644 vmware_nsx/openstack/__init__.py delete mode 100644 vmware_nsx/openstack/common/__init__.py delete mode 100644 vmware_nsx/openstack/common/_i18n.py delete mode 100644 vmware_nsx/openstack/common/loopingcall.py diff --git a/openstack-common.conf b/openstack-common.conf deleted file mode 100644 index dfe79b7d2b..0000000000 --- a/openstack-common.conf +++ /dev/null @@ -1,6 +0,0 @@ -[DEFAULT] -# The list of modules to copy from oslo-incubator.git -module=loopingcall - -# The base module to hold the copy of openstack.common -base=vmware_nsx diff --git a/requirements.txt b/requirements.txt index 63dad1e21e..7fa1959246 100644 --- a/requirements.txt +++ b/requirements.txt @@ -16,6 +16,7 @@ oslo.db>=1.12.0 # Apache-2.0 oslo.i18n>=1.5.0 # Apache-2.0 oslo.log>=1.2.0 # Apache-2.0 oslo.serialization>=1.4.0 # Apache-2.0 +oslo.service>=0.1.0 # Apache-2.0 oslo.utils>=1.6.0 # Apache-2.0 oslo.vmware>=0.13.1 # Apache-2.0 tooz>=0.16.0 # Apache-2.0 diff --git a/tox.ini b/tox.ini index f5f91687b0..7c7d287c0a 100644 --- a/tox.ini +++ b/tox.ini @@ -82,5 +82,5 @@ commands = pylint --rcfile=.pylintrc --output-format=colorized {posargs:vmware_nsx/neutron} [hacking] -import_exceptions = vmware_nsx.openstack.common._i18n +import_exceptions = neutron.i18n local-check-factory = neutron.hacking.checks.factory diff --git a/vmware_nsx/neutron/plugins/vmware/api_client/base.py b/vmware_nsx/neutron/plugins/vmware/api_client/base.py index 53a653be1e..8399ce97c4 100644 --- a/vmware_nsx/neutron/plugins/vmware/api_client/base.py +++ b/vmware_nsx/neutron/plugins/vmware/api_client/base.py @@ -22,8 +22,8 @@ import time from oslo_config import cfg from oslo_log import log as logging +from neutron.i18n import _LE, _LI, _LW from vmware_nsx.neutron.plugins.vmware import api_client -from vmware_nsx.openstack.common._i18n import _LE, _LI, _LW LOG = logging.getLogger(__name__) diff --git a/vmware_nsx/neutron/plugins/vmware/api_client/client.py b/vmware_nsx/neutron/plugins/vmware/api_client/client.py index 715b777c4a..0ba063ecdd 100644 --- a/vmware_nsx/neutron/plugins/vmware/api_client/client.py +++ b/vmware_nsx/neutron/plugins/vmware/api_client/client.py @@ -19,12 +19,12 @@ import httplib from oslo_log import log as logging +from neutron.i18n import _LE from vmware_nsx.neutron.plugins.vmware.api_client import base from vmware_nsx.neutron.plugins.vmware.api_client import eventlet_client from vmware_nsx.neutron.plugins.vmware.api_client import eventlet_request from vmware_nsx.neutron.plugins.vmware.api_client import exception from vmware_nsx.neutron.plugins.vmware.api_client import version -from vmware_nsx.openstack.common._i18n import _LE LOG = logging.getLogger(__name__) diff --git a/vmware_nsx/neutron/plugins/vmware/api_client/eventlet_client.py b/vmware_nsx/neutron/plugins/vmware/api_client/eventlet_client.py index 1d01b03b47..e2d284fa37 100644 --- a/vmware_nsx/neutron/plugins/vmware/api_client/eventlet_client.py +++ b/vmware_nsx/neutron/plugins/vmware/api_client/eventlet_client.py @@ -21,9 +21,9 @@ import eventlet eventlet.monkey_patch() from oslo_log import log as logging +from neutron.i18n import _LE from vmware_nsx.neutron.plugins.vmware.api_client import base from vmware_nsx.neutron.plugins.vmware.api_client import eventlet_request -from vmware_nsx.openstack.common._i18n import _LE LOG = logging.getLogger(__name__) diff --git a/vmware_nsx/neutron/plugins/vmware/api_client/eventlet_request.py b/vmware_nsx/neutron/plugins/vmware/api_client/eventlet_request.py index c488dc523e..d839c56111 100644 --- a/vmware_nsx/neutron/plugins/vmware/api_client/eventlet_request.py +++ b/vmware_nsx/neutron/plugins/vmware/api_client/eventlet_request.py @@ -21,8 +21,8 @@ import eventlet from oslo_log import log as logging from oslo_serialization import jsonutils +from neutron.i18n import _LI, _LW from vmware_nsx.neutron.plugins.vmware.api_client import request -from vmware_nsx.openstack.common._i18n import _LI, _LW LOG = logging.getLogger(__name__) USER_AGENT = "Neutron eventlet client/2.0" diff --git a/vmware_nsx/neutron/plugins/vmware/api_client/request.py b/vmware_nsx/neutron/plugins/vmware/api_client/request.py index a61326ddb0..d68accdc3b 100644 --- a/vmware_nsx/neutron/plugins/vmware/api_client/request.py +++ b/vmware_nsx/neutron/plugins/vmware/api_client/request.py @@ -26,8 +26,8 @@ from oslo_utils import excutils import six import six.moves.urllib.parse as urlparse +from neutron.i18n import _LI, _LW from vmware_nsx.neutron.plugins.vmware import api_client -from vmware_nsx.openstack.common._i18n import _LI, _LW LOG = logging.getLogger(__name__) diff --git a/vmware_nsx/neutron/plugins/vmware/api_client/version.py b/vmware_nsx/neutron/plugins/vmware/api_client/version.py index 3451e4a697..56ccb0e32f 100644 --- a/vmware_nsx/neutron/plugins/vmware/api_client/version.py +++ b/vmware_nsx/neutron/plugins/vmware/api_client/version.py @@ -17,7 +17,7 @@ from oslo_log import log as logging -from vmware_nsx.openstack.common._i18n import _LW +from neutron.i18n import _LW LOG = logging.getLogger(__name__) diff --git a/vmware_nsx/neutron/plugins/vmware/common/config.py b/vmware_nsx/neutron/plugins/vmware/common/config.py index cb24b6091d..2377d982c6 100644 --- a/vmware_nsx/neutron/plugins/vmware/common/config.py +++ b/vmware_nsx/neutron/plugins/vmware/common/config.py @@ -16,8 +16,8 @@ import logging from oslo_config import cfg +from neutron.i18n import _LW from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc -from vmware_nsx.openstack.common._i18n import _LW LOG = logging.getLogger(__name__) diff --git a/vmware_nsx/neutron/plugins/vmware/common/nsx_utils.py b/vmware_nsx/neutron/plugins/vmware/common/nsx_utils.py index 373a69ef3e..c220e804c4 100644 --- a/vmware_nsx/neutron/plugins/vmware/common/nsx_utils.py +++ b/vmware_nsx/neutron/plugins/vmware/common/nsx_utils.py @@ -17,6 +17,7 @@ from neutron.api.v2 import attributes as attr from neutron.common import exceptions as n_exc from neutron.extensions import multiprovidernet as mpnet from neutron.extensions import providernet as pnet +from neutron.i18n import _LW from oslo_log import log import six @@ -30,7 +31,6 @@ from vmware_nsx.neutron.plugins.vmware.nsxlib import l2gateway as l2gwlib from vmware_nsx.neutron.plugins.vmware.nsxlib import router as routerlib from vmware_nsx.neutron.plugins.vmware.nsxlib import secgroup as secgrouplib from vmware_nsx.neutron.plugins.vmware.nsxlib import switch as switchlib -from vmware_nsx.openstack.common._i18n import _LW LOG = log.getLogger(__name__) diff --git a/vmware_nsx/neutron/plugins/vmware/common/sync.py b/vmware_nsx/neutron/plugins/vmware/common/sync.py index 86293387e3..09a8192e05 100644 --- a/vmware_nsx/neutron/plugins/vmware/common/sync.py +++ b/vmware_nsx/neutron/plugins/vmware/common/sync.py @@ -17,6 +17,7 @@ import random from oslo_log import log from oslo_serialization import jsonutils +from oslo_service import loopingcall from oslo_utils import timeutils import six @@ -27,6 +28,7 @@ from neutron.db import external_net_db from neutron.db import l3_db from neutron.db import models_v2 from neutron.extensions import l3 +from neutron.i18n import _LE, _LI, _LW from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc @@ -34,8 +36,6 @@ from vmware_nsx.neutron.plugins.vmware.common import nsx_utils from vmware_nsx.neutron.plugins.vmware import nsxlib from vmware_nsx.neutron.plugins.vmware.nsxlib import router as routerlib from vmware_nsx.neutron.plugins.vmware.nsxlib import switch as switchlib -from vmware_nsx.openstack.common._i18n import _LE, _LI, _LW -from vmware_nsx.openstack.common import loopingcall # Maximum page size for a single request # NOTE(salv-orlando): This might become a version-dependent map should the diff --git a/vmware_nsx/neutron/plugins/vmware/dbexts/nsxv_db.py b/vmware_nsx/neutron/plugins/vmware/dbexts/nsxv_db.py index a27b8090e8..af144f7c45 100644 --- a/vmware_nsx/neutron/plugins/vmware/dbexts/nsxv_db.py +++ b/vmware_nsx/neutron/plugins/vmware/dbexts/nsxv_db.py @@ -23,10 +23,10 @@ import six from sqlalchemy.orm import exc from sqlalchemy.sql import expression as expr +from neutron.i18n import _, _LE from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc from vmware_nsx.neutron.plugins.vmware.common import nsxv_constants from vmware_nsx.neutron.plugins.vmware.vshield.common import constants -from vmware_nsx.openstack.common._i18n import _, _LE LOG = logging.getLogger(__name__) diff --git a/vmware_nsx/neutron/plugins/vmware/dbexts/qos_db.py b/vmware_nsx/neutron/plugins/vmware/dbexts/qos_db.py index 422f3e0608..6a4bfe9375 100644 --- a/vmware_nsx/neutron/plugins/vmware/dbexts/qos_db.py +++ b/vmware_nsx/neutron/plugins/vmware/dbexts/qos_db.py @@ -23,7 +23,7 @@ from neutron.plugins.vmware.extensions import qos from oslo_log import log from oslo_utils import uuidutils -from vmware_nsx.openstack.common._i18n import _LI +from neutron.i18n import _LI LOG = log.getLogger(__name__) diff --git a/vmware_nsx/neutron/plugins/vmware/dhcp_meta/lsnmanager.py b/vmware_nsx/neutron/plugins/vmware/dhcp_meta/lsnmanager.py index d6d0899efb..6ec85c8eb7 100644 --- a/vmware_nsx/neutron/plugins/vmware/dhcp_meta/lsnmanager.py +++ b/vmware_nsx/neutron/plugins/vmware/dhcp_meta/lsnmanager.py @@ -21,6 +21,7 @@ from oslo_db import exception as db_exc from oslo_log import log as logging from oslo_utils import excutils +from neutron.i18n import _LE, _LW from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc from vmware_nsx.neutron.plugins.vmware.common import exceptions as p_exc from vmware_nsx.neutron.plugins.vmware.common import nsx_utils @@ -28,7 +29,6 @@ from vmware_nsx.neutron.plugins.vmware.dbexts import lsn_db from vmware_nsx.neutron.plugins.vmware.dhcp_meta import constants as const from vmware_nsx.neutron.plugins.vmware.nsxlib import lsn as lsn_api from vmware_nsx.neutron.plugins.vmware.nsxlib import switch as switch_api -from vmware_nsx.openstack.common._i18n import _LE, _LW LOG = logging.getLogger(__name__) diff --git a/vmware_nsx/neutron/plugins/vmware/dhcp_meta/migration.py b/vmware_nsx/neutron/plugins/vmware/dhcp_meta/migration.py index 8418f3d4c9..284f9b8cf2 100644 --- a/vmware_nsx/neutron/plugins/vmware/dhcp_meta/migration.py +++ b/vmware_nsx/neutron/plugins/vmware/dhcp_meta/migration.py @@ -20,10 +20,10 @@ from neutron.common import exceptions as n_exc from neutron.extensions import external_net from oslo_log import log as logging +from neutron.i18n import _LE from vmware_nsx.neutron.plugins.vmware.common import exceptions as p_exc from vmware_nsx.neutron.plugins.vmware.dhcp_meta import nsx from vmware_nsx.neutron.plugins.vmware.dhcp_meta import rpc -from vmware_nsx.openstack.common._i18n import _LE LOG = logging.getLogger(__name__) diff --git a/vmware_nsx/neutron/plugins/vmware/dhcp_meta/nsx.py b/vmware_nsx/neutron/plugins/vmware/dhcp_meta/nsx.py index 02876fd06a..91ff9d715c 100644 --- a/vmware_nsx/neutron/plugins/vmware/dhcp_meta/nsx.py +++ b/vmware_nsx/neutron/plugins/vmware/dhcp_meta/nsx.py @@ -25,7 +25,7 @@ from neutron.common import exceptions as n_exc from neutron.db import db_base_plugin_v2 from neutron.db import l3_db from neutron.extensions import external_net -from vmware_nsx.openstack.common._i18n import _LE, _LI +from neutron.i18n import _LE, _LI from vmware_nsx.neutron.plugins.vmware.common import exceptions as p_exc from vmware_nsx.neutron.plugins.vmware.dhcp_meta import constants as d_const from vmware_nsx.neutron.plugins.vmware.nsxlib import lsn as lsn_api diff --git a/vmware_nsx/neutron/plugins/vmware/dhcp_meta/rpc.py b/vmware_nsx/neutron/plugins/vmware/dhcp_meta/rpc.py index 014fc77eb9..e761f63162 100644 --- a/vmware_nsx/neutron/plugins/vmware/dhcp_meta/rpc.py +++ b/vmware_nsx/neutron/plugins/vmware/dhcp_meta/rpc.py @@ -25,7 +25,7 @@ from neutron.common import constants as const from neutron.common import exceptions as ntn_exc from neutron.db import db_base_plugin_v2 from neutron.db import models_v2 -from vmware_nsx.openstack.common._i18n import _LE, _LI, _LW +from neutron.i18n import _LE, _LI, _LW from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc from vmware_nsx.neutron.plugins.vmware.common import config from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc diff --git a/vmware_nsx/neutron/plugins/vmware/dhcpmeta_modes.py b/vmware_nsx/neutron/plugins/vmware/dhcpmeta_modes.py index 208ae86b15..2270319b99 100644 --- a/vmware_nsx/neutron/plugins/vmware/dhcpmeta_modes.py +++ b/vmware_nsx/neutron/plugins/vmware/dhcpmeta_modes.py @@ -27,6 +27,7 @@ from neutron.common import constants as const from neutron.common import rpc as n_rpc from neutron.common import topics from neutron.db import agents_db +from neutron.i18n import _LW from neutron.plugins.vmware.extensions import lsn from vmware_nsx.neutron.plugins.vmware.common import config @@ -36,7 +37,6 @@ from vmware_nsx.neutron.plugins.vmware.dhcp_meta import lsnmanager from vmware_nsx.neutron.plugins.vmware.dhcp_meta import migration from vmware_nsx.neutron.plugins.vmware.dhcp_meta import nsx as nsx_svc from vmware_nsx.neutron.plugins.vmware.dhcp_meta import rpc as nsx_rpc -from vmware_nsx.openstack.common._i18n import _LW LOG = logging.getLogger(__name__) diff --git a/vmware_nsx/neutron/plugins/vmware/dvs/dvs.py b/vmware_nsx/neutron/plugins/vmware/dvs/dvs.py index d60cf8f09d..fa8753f54b 100644 --- a/vmware_nsx/neutron/plugins/vmware/dvs/dvs.py +++ b/vmware_nsx/neutron/plugins/vmware/dvs/dvs.py @@ -17,9 +17,9 @@ from oslo_log import log as logging from oslo_utils import excutils from oslo_vmware import vim_util +from neutron.i18n import _LE, _LI from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc from vmware_nsx.neutron.plugins.vmware.dvs import dvs_utils -from vmware_nsx.openstack.common._i18n import _LE, _LI LOG = logging.getLogger(__name__) diff --git a/vmware_nsx/neutron/plugins/vmware/nsx_cluster.py b/vmware_nsx/neutron/plugins/vmware/nsx_cluster.py index 36a7710f84..a2c4fa6d2a 100644 --- a/vmware_nsx/neutron/plugins/vmware/nsx_cluster.py +++ b/vmware_nsx/neutron/plugins/vmware/nsx_cluster.py @@ -17,8 +17,8 @@ from oslo_config import cfg from oslo_log import log as logging import six +from neutron.i18n import _LI from vmware_nsx.neutron.plugins.vmware.common import exceptions -from vmware_nsx.openstack.common._i18n import _LI LOG = logging.getLogger(__name__) DEFAULT_PORT = 443 diff --git a/vmware_nsx/neutron/plugins/vmware/nsxlib/router.py b/vmware_nsx/neutron/plugins/vmware/nsxlib/router.py index 884eb3f101..506449b182 100644 --- a/vmware_nsx/neutron/plugins/vmware/nsxlib/router.py +++ b/vmware_nsx/neutron/plugins/vmware/nsxlib/router.py @@ -20,13 +20,13 @@ from oslo_serialization import jsonutils from oslo_utils import excutils import six +from neutron.i18n import _LE, _LI, _LW from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc from vmware_nsx.neutron.plugins.vmware.common import utils from vmware_nsx.neutron.plugins.vmware import nsxlib from vmware_nsx.neutron.plugins.vmware.nsxlib import switch from vmware_nsx.neutron.plugins.vmware.nsxlib import versioning -from vmware_nsx.openstack.common._i18n import _LE, _LI, _LW # @versioning.versioned decorator makes the apparent function body # totally unrelated to the real function. This confuses pylint :( diff --git a/vmware_nsx/neutron/plugins/vmware/nsxlib/secgroup.py b/vmware_nsx/neutron/plugins/vmware/nsxlib/secgroup.py index aa3f8bda1f..d97c89ef87 100644 --- a/vmware_nsx/neutron/plugins/vmware/nsxlib/secgroup.py +++ b/vmware_nsx/neutron/plugins/vmware/nsxlib/secgroup.py @@ -19,10 +19,10 @@ from oslo_utils import excutils from neutron.common import constants from neutron.common import exceptions +from neutron.i18n import _LW from vmware_nsx.neutron.plugins.vmware.common import utils from vmware_nsx.neutron.plugins.vmware import nsxlib -from vmware_nsx.openstack.common._i18n import _LW HTTP_GET = "GET" HTTP_POST = "POST" diff --git a/vmware_nsx/neutron/plugins/vmware/nsxlib/switch.py b/vmware_nsx/neutron/plugins/vmware/nsxlib/switch.py index 327670cd63..036fbe80bb 100644 --- a/vmware_nsx/neutron/plugins/vmware/nsxlib/switch.py +++ b/vmware_nsx/neutron/plugins/vmware/nsxlib/switch.py @@ -20,12 +20,12 @@ from oslo_serialization import jsonutils from neutron.common import constants from neutron.common import exceptions as exception +from neutron.i18n import _LE, _LI, _LW from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc from vmware_nsx.neutron.plugins.vmware.common import utils from vmware_nsx.neutron.plugins.vmware import nsxlib -from vmware_nsx.openstack.common._i18n import _LE, _LI, _LW HTTP_GET = "GET" HTTP_POST = "POST" diff --git a/vmware_nsx/neutron/plugins/vmware/nsxlib/v3/__init__.py b/vmware_nsx/neutron/plugins/vmware/nsxlib/v3/__init__.py index 3f535c396b..67cdf9ca37 100644 --- a/vmware_nsx/neutron/plugins/vmware/nsxlib/v3/__init__.py +++ b/vmware_nsx/neutron/plugins/vmware/nsxlib/v3/__init__.py @@ -19,9 +19,9 @@ from oslo_serialization import jsonutils import requests from requests import auth +from neutron.i18n import _LI, _LW from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc from vmware_nsx.neutron.plugins.vmware.common import nsx_constants -from vmware_nsx.openstack.common._i18n import _LI, _LW LOG = log.getLogger(__name__) diff --git a/vmware_nsx/neutron/plugins/vmware/plugins/base.py b/vmware_nsx/neutron/plugins/vmware/plugins/base.py index cf778e5513..cea2764a91 100644 --- a/vmware_nsx/neutron/plugins/vmware/plugins/base.py +++ b/vmware_nsx/neutron/plugins/vmware/plugins/base.py @@ -53,6 +53,7 @@ from neutron.extensions import portbindings as pbin from neutron.extensions import portsecurity as psec from neutron.extensions import providernet as pnet from neutron.extensions import securitygroup as ext_sg +from neutron.i18n import _LE, _LI, _LW from neutron.plugins.common import constants as plugin_const from neutron.plugins.common import utils from neutron.plugins.vmware.dbexts import nsx_models @@ -78,7 +79,6 @@ from vmware_nsx.neutron.plugins.vmware.nsxlib import queue as queuelib from vmware_nsx.neutron.plugins.vmware.nsxlib import router as routerlib from vmware_nsx.neutron.plugins.vmware.nsxlib import secgroup as secgrouplib from vmware_nsx.neutron.plugins.vmware.nsxlib import switch as switchlib -from vmware_nsx.openstack.common._i18n import _LE, _LI, _LW LOG = logging.getLogger(__name__) diff --git a/vmware_nsx/neutron/plugins/vmware/plugins/dvs.py b/vmware_nsx/neutron/plugins/vmware/plugins/dvs.py index f958327757..e39f7df584 100644 --- a/vmware_nsx/neutron/plugins/vmware/plugins/dvs.py +++ b/vmware_nsx/neutron/plugins/vmware/plugins/dvs.py @@ -35,6 +35,7 @@ from neutron.extensions import portbindings as pbin from neutron.extensions import portsecurity as psec from neutron.extensions import providernet as pnet from neutron.extensions import securitygroup as ext_sg +from neutron.i18n import _LE, _LW from neutron.plugins.common import constants from neutron.plugins.common import utils @@ -46,7 +47,6 @@ from vmware_nsx.neutron.plugins.vmware.dbexts import db as nsx_db from vmware_nsx.neutron.plugins.vmware import dhcpmeta_modes from vmware_nsx.neutron.plugins.vmware.dvs import dvs from vmware_nsx.neutron.plugins.vmware.dvs import dvs_utils -from vmware_nsx.openstack.common._i18n import _LE, _LW LOG = logging.getLogger(__name__) diff --git a/vmware_nsx/neutron/plugins/vmware/plugins/managers.py b/vmware_nsx/neutron/plugins/vmware/plugins/managers.py index 7cdb91d8e0..a063ca65ca 100644 --- a/vmware_nsx/neutron/plugins/vmware/plugins/managers.py +++ b/vmware_nsx/neutron/plugins/vmware/plugins/managers.py @@ -18,8 +18,8 @@ import stevedore from oslo_log import log +from neutron.i18n import _LE, _LI from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc -from vmware_nsx.openstack.common._i18n import _LE, _LI LOG = log.getLogger(__name__) ROUTER_TYPE_DRIVERS = ["distributed", "exclusive", "shared"] diff --git a/vmware_nsx/neutron/plugins/vmware/plugins/nsx_v.py b/vmware_nsx/neutron/plugins/vmware/plugins/nsx_v.py index a137521365..26d07cfbcf 100644 --- a/vmware_nsx/neutron/plugins/vmware/plugins/nsx_v.py +++ b/vmware_nsx/neutron/plugins/vmware/plugins/nsx_v.py @@ -46,6 +46,7 @@ from neutron.extensions import portbindings as pbin from neutron.extensions import portsecurity as psec from neutron.extensions import providernet as pnet from neutron.extensions import securitygroup as ext_sg +from neutron.i18n import _LE, _LI, _LW from neutron.plugins.common import constants as plugin_const from neutron.plugins.common import utils from neutron.plugins.vmware.extensions import ( @@ -72,7 +73,6 @@ from vmware_nsx.neutron.plugins.vmware.vshield.common import ( from vmware_nsx.neutron.plugins.vmware.vshield import edge_utils from vmware_nsx.neutron.plugins.vmware.vshield import securitygroup_utils from vmware_nsx.neutron.plugins.vmware.vshield import vcns_driver -from vmware_nsx.openstack.common._i18n import _LE, _LI, _LW LOG = logging.getLogger(__name__) PORTGROUP_PREFIX = 'dvportgroup' diff --git a/vmware_nsx/neutron/plugins/vmware/plugins/nsx_v3_plugin.py b/vmware_nsx/neutron/plugins/vmware/plugins/nsx_v3_plugin.py index 30f0633531..20b9af014f 100644 --- a/vmware_nsx/neutron/plugins/vmware/plugins/nsx_v3_plugin.py +++ b/vmware_nsx/neutron/plugins/vmware/plugins/nsx_v3_plugin.py @@ -36,13 +36,13 @@ from neutron.db import l3_db from neutron.db import models_v2 from neutron.db import portbindings_db from neutron.db import securitygroups_db +from neutron.i18n import _LW from vmware_nsx.neutron.plugins.vmware.common import config # noqa from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc from vmware_nsx.neutron.plugins.vmware.common import utils from vmware_nsx.neutron.plugins.vmware.dbexts import db as nsx_db from vmware_nsx.neutron.plugins.vmware.nsxlib import v3 as nsxlib -from vmware_nsx.openstack.common._i18n import _LW LOG = log.getLogger(__name__) diff --git a/vmware_nsx/neutron/plugins/vmware/plugins/nsx_v_md_proxy.py b/vmware_nsx/neutron/plugins/vmware/plugins/nsx_v_md_proxy.py index 4c6aa7157d..7f031c122e 100644 --- a/vmware_nsx/neutron/plugins/vmware/plugins/nsx_v_md_proxy.py +++ b/vmware_nsx/neutron/plugins/vmware/plugins/nsx_v_md_proxy.py @@ -25,6 +25,7 @@ from oslo_config import cfg from oslo_log import log as logging from oslo_utils import excutils +from neutron.i18n import _LE from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsxv_exc from vmware_nsx.neutron.plugins.vmware.common import locking from vmware_nsx.neutron.plugins.vmware.common import nsxv_constants @@ -34,7 +35,6 @@ from vmware_nsx.neutron.plugins.vmware.vshield import ( from vmware_nsx.neutron.plugins.vmware.vshield.common import ( constants as vcns_const) from vmware_nsx.neutron.plugins.vmware.vshield import edge_utils -from vmware_nsx.openstack.common._i18n import _LE METADATA_IP_ADDR = '169.254.169.254' METADATA_TCP_PORT = 80 diff --git a/vmware_nsx/neutron/plugins/vmware/vshield/edge_appliance_driver.py b/vmware_nsx/neutron/plugins/vmware/vshield/edge_appliance_driver.py index 6622a24251..76b74465e4 100644 --- a/vmware_nsx/neutron/plugins/vmware/vshield/edge_appliance_driver.py +++ b/vmware_nsx/neutron/plugins/vmware/vshield/edge_appliance_driver.py @@ -21,6 +21,7 @@ from oslo_log import log as logging from oslo_serialization import jsonutils from oslo_utils import excutils +from neutron.i18n import _LE, _LI, _LW from vmware_nsx.neutron.plugins.vmware.common import nsxv_constants from vmware_nsx.neutron.plugins.vmware.common import utils from vmware_nsx.neutron.plugins.vmware.vshield.common import constants @@ -28,7 +29,6 @@ from vmware_nsx.neutron.plugins.vmware.vshield.common import exceptions from vmware_nsx.neutron.plugins.vmware.vshield.tasks import ( constants as task_constants) from vmware_nsx.neutron.plugins.vmware.vshield.tasks import tasks -from vmware_nsx.openstack.common._i18n import _LE, _LI, _LW LOG = logging.getLogger(__name__) diff --git a/vmware_nsx/neutron/plugins/vmware/vshield/edge_firewall_driver.py b/vmware_nsx/neutron/plugins/vmware/vshield/edge_firewall_driver.py index a123cceada..2642f45e6f 100644 --- a/vmware_nsx/neutron/plugins/vmware/vshield/edge_firewall_driver.py +++ b/vmware_nsx/neutron/plugins/vmware/vshield/edge_firewall_driver.py @@ -16,13 +16,13 @@ from neutron.db import db_base_plugin_v2 from oslo_log import log as logging from oslo_utils import excutils +from neutron.i18n import _, _LE from vmware_nsx.neutron.plugins.vmware.dbexts import nsxv_db from vmware_nsx.neutron.plugins.vmware.vshield.common import ( exceptions as vcns_exc) from vmware_nsx.neutron.plugins.vmware.vshield.tasks import ( constants as task_const) from vmware_nsx.neutron.plugins.vmware.vshield.tasks import tasks -from vmware_nsx.openstack.common._i18n import _, _LE LOG = logging.getLogger(__name__) diff --git a/vmware_nsx/neutron/plugins/vmware/vshield/edge_ipsecvpn_driver.py b/vmware_nsx/neutron/plugins/vmware/vshield/edge_ipsecvpn_driver.py index fe315992e5..79a12558db 100644 --- a/vmware_nsx/neutron/plugins/vmware/vshield/edge_ipsecvpn_driver.py +++ b/vmware_nsx/neutron/plugins/vmware/vshield/edge_ipsecvpn_driver.py @@ -15,9 +15,9 @@ from oslo_log import log as logging from oslo_utils import excutils +from neutron.i18n import _LE, _LW from vmware_nsx.neutron.plugins.vmware.vshield.common import ( exceptions as vcns_exc) -from vmware_nsx.openstack.common._i18n import _LE, _LW LOG = logging.getLogger(__name__) diff --git a/vmware_nsx/neutron/plugins/vmware/vshield/edge_loadbalancer_driver.py b/vmware_nsx/neutron/plugins/vmware/vshield/edge_loadbalancer_driver.py index b7ae84065c..854aaf18eb 100644 --- a/vmware_nsx/neutron/plugins/vmware/vshield/edge_loadbalancer_driver.py +++ b/vmware_nsx/neutron/plugins/vmware/vshield/edge_loadbalancer_driver.py @@ -19,13 +19,13 @@ import netaddr from oslo_log import log as logging from oslo_utils import excutils +from neutron.i18n import _LE from neutron import manager from neutron.plugins.common import constants from vmware_nsx.neutron.plugins.vmware.dbexts import nsxv_db from vmware_nsx.neutron.plugins.vmware.vshield.common import ( exceptions as nsxv_exc) from vmware_nsx.neutron.plugins.vmware.vshield import vcns as nsxv_api -from vmware_nsx.openstack.common._i18n import _LE # TODO(kobis): protect in nsx_v.py against detaching of interface while diff --git a/vmware_nsx/neutron/plugins/vmware/vshield/edge_utils.py b/vmware_nsx/neutron/plugins/vmware/vshield/edge_utils.py index 2f902af7f4..8b9f338cd0 100644 --- a/vmware_nsx/neutron/plugins/vmware/vshield/edge_utils.py +++ b/vmware_nsx/neutron/plugins/vmware/vshield/edge_utils.py @@ -28,6 +28,7 @@ from sqlalchemy.orm import exc as sa_exc from neutron.common import exceptions as n_exc from neutron import context as q_context from neutron.extensions import l3 +from neutron.i18n import _LE, _LW from neutron.plugins.common import constants as plugin_const from vmware_nsx.neutron.plugins.vmware.common import locking @@ -39,7 +40,6 @@ from vmware_nsx.neutron.plugins.vmware.vshield.common import ( from vmware_nsx.neutron.plugins.vmware.vshield.tasks import ( constants as task_const) from vmware_nsx.neutron.plugins.vmware.vshield.tasks import tasks -from vmware_nsx.openstack.common._i18n import _LE, _LW from vmware_nsx.neutron.plugins.vmware.vshield import vcns WORKER_POOL_SIZE = 8 diff --git a/vmware_nsx/neutron/plugins/vmware/vshield/tasks/tasks.py b/vmware_nsx/neutron/plugins/vmware/vshield/tasks/tasks.py index 37c4434da1..1989ea0236 100644 --- a/vmware_nsx/neutron/plugins/vmware/vshield/tasks/tasks.py +++ b/vmware_nsx/neutron/plugins/vmware/vshield/tasks/tasks.py @@ -20,11 +20,11 @@ from eventlet import event from eventlet import greenthread from neutron.common import exceptions from oslo_log import log as logging +from oslo_service import loopingcall import six +from neutron.i18n import _LE, _LI from vmware_nsx.neutron.plugins.vmware.vshield.tasks import constants -from vmware_nsx.openstack.common._i18n import _LE, _LI -from vmware_nsx.openstack.common import loopingcall DEFAULT_INTERVAL = 1000 diff --git a/vmware_nsx/neutron/tests/unit/vmware/apiclient/test_api_eventlet_request.py b/vmware_nsx/neutron/tests/unit/vmware/apiclient/test_api_eventlet_request.py index 27efabe7b4..725317217a 100644 --- a/vmware_nsx/neutron/tests/unit/vmware/apiclient/test_api_eventlet_request.py +++ b/vmware_nsx/neutron/tests/unit/vmware/apiclient/test_api_eventlet_request.py @@ -18,16 +18,15 @@ import random import eventlet from eventlet.green import urllib2 import mock +from neutron.i18n import _LI from neutron.tests import base from oslo_log import log as logging - from vmware_nsx.neutron.plugins.vmware.api_client import ( eventlet_client as client) from vmware_nsx.neutron.plugins.vmware.api_client import ( eventlet_request as request) from vmware_nsx.neutron.tests.unit import vmware -from vmware_nsx.openstack.common._i18n import _LI LOG = logging.getLogger(__name__) diff --git a/vmware_nsx/openstack/__init__.py b/vmware_nsx/openstack/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/vmware_nsx/openstack/common/__init__.py b/vmware_nsx/openstack/common/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/vmware_nsx/openstack/common/_i18n.py b/vmware_nsx/openstack/common/_i18n.py deleted file mode 100644 index b78e57a267..0000000000 --- a/vmware_nsx/openstack/common/_i18n.py +++ /dev/null @@ -1,45 +0,0 @@ -# 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. - -"""oslo.i18n integration module. - -See http://docs.openstack.org/developer/oslo.i18n/usage.html - -""" - -try: - import oslo_i18n - - # NOTE(dhellmann): This reference to o-s-l-o will be replaced by the - # application name when this module is synced into the separate - # repository. It is OK to have more than one translation function - # using the same domain, since there will still only be one message - # catalog. - _translators = oslo_i18n.TranslatorFactory(domain='vmware_nsx') - - # The primary translation function using the well-known name "_" - _ = _translators.primary - - # Translators for log levels. - # - # The abbreviated names are meant to reflect the usual use of a short - # name like '_'. The "L" is for "log" and the other letter comes from - # the level. - _LI = _translators.log_info - _LW = _translators.log_warning - _LE = _translators.log_error - _LC = _translators.log_critical -except ImportError: - # NOTE(dims): Support for cases where a project wants to use - # code from oslo-incubator, but is not ready to be internationalized - # (like tempest) - _ = _LI = _LW = _LE = _LC = lambda x: x diff --git a/vmware_nsx/openstack/common/loopingcall.py b/vmware_nsx/openstack/common/loopingcall.py deleted file mode 100644 index c7377fd625..0000000000 --- a/vmware_nsx/openstack/common/loopingcall.py +++ /dev/null @@ -1,147 +0,0 @@ -# Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. -# Copyright 2011 Justin Santa Barbara -# 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. - -import logging -import sys -import time - -from eventlet import event -from eventlet import greenthread - -from vmware_nsx.openstack.common._i18n import _LE, _LW - -LOG = logging.getLogger(__name__) - -# NOTE(zyluo): This lambda function was declared to avoid mocking collisions -# with time.time() called in the standard logging module -# during unittests. -_ts = lambda: time.time() - - -class LoopingCallDone(Exception): - """Exception to break out and stop a LoopingCallBase. - - The poll-function passed to LoopingCallBase can raise this exception to - break out of the loop normally. This is somewhat analogous to - StopIteration. - - An optional return-value can be included as the argument to the exception; - this return-value will be returned by LoopingCallBase.wait() - - """ - - def __init__(self, retvalue=True): - """:param retvalue: Value that LoopingCallBase.wait() should return.""" - self.retvalue = retvalue - - -class LoopingCallBase(object): - def __init__(self, f=None, *args, **kw): - self.args = args - self.kw = kw - self.f = f - self._running = False - self.done = None - - def stop(self): - self._running = False - - def wait(self): - return self.done.wait() - - -class FixedIntervalLoopingCall(LoopingCallBase): - """A fixed interval looping call.""" - - def start(self, interval, initial_delay=None): - self._running = True - done = event.Event() - - def _inner(): - if initial_delay: - greenthread.sleep(initial_delay) - - try: - while self._running: - start = _ts() - self.f(*self.args, **self.kw) - end = _ts() - if not self._running: - break - delay = end - start - interval - if delay > 0: - LOG.warn(_LW('task %(func_name)r run outlasted ' - 'interval by %(delay).2f sec'), - {'func_name': self.f, 'delay': delay}) - greenthread.sleep(-delay if delay < 0 else 0) - except LoopingCallDone as e: - self.stop() - done.send(e.retvalue) - except Exception: - LOG.exception(_LE('in fixed duration looping call')) - done.send_exception(*sys.exc_info()) - return - else: - done.send(True) - - self.done = done - - greenthread.spawn_n(_inner) - return self.done - - -class DynamicLoopingCall(LoopingCallBase): - """A looping call which sleeps until the next known event. - - The function called should return how long to sleep for before being - called again. - """ - - def start(self, initial_delay=None, periodic_interval_max=None): - self._running = True - done = event.Event() - - def _inner(): - if initial_delay: - greenthread.sleep(initial_delay) - - try: - while self._running: - idle = self.f(*self.args, **self.kw) - if not self._running: - break - - if periodic_interval_max is not None: - idle = min(idle, periodic_interval_max) - LOG.debug('Dynamic looping call %(func_name)r sleeping ' - 'for %(idle).02f seconds', - {'func_name': self.f, 'idle': idle}) - greenthread.sleep(idle) - except LoopingCallDone as e: - self.stop() - done.send(e.retvalue) - except Exception: - LOG.exception(_LE('in dynamic looping call')) - done.send_exception(*sys.exc_info()) - return - else: - done.send(True) - - self.done = done - - greenthread.spawn(_inner) - return self.done