Browse Source

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
changes/24/199024/3
Gary Kotton 7 years ago
parent
commit
94aead783a
  1. 6
      openstack-common.conf
  2. 1
      requirements.txt
  3. 2
      tox.ini
  4. 2
      vmware_nsx/neutron/plugins/vmware/api_client/base.py
  5. 2
      vmware_nsx/neutron/plugins/vmware/api_client/client.py
  6. 2
      vmware_nsx/neutron/plugins/vmware/api_client/eventlet_client.py
  7. 2
      vmware_nsx/neutron/plugins/vmware/api_client/eventlet_request.py
  8. 2
      vmware_nsx/neutron/plugins/vmware/api_client/request.py
  9. 2
      vmware_nsx/neutron/plugins/vmware/api_client/version.py
  10. 2
      vmware_nsx/neutron/plugins/vmware/common/config.py
  11. 2
      vmware_nsx/neutron/plugins/vmware/common/nsx_utils.py
  12. 4
      vmware_nsx/neutron/plugins/vmware/common/sync.py
  13. 2
      vmware_nsx/neutron/plugins/vmware/dbexts/nsxv_db.py
  14. 2
      vmware_nsx/neutron/plugins/vmware/dbexts/qos_db.py
  15. 2
      vmware_nsx/neutron/plugins/vmware/dhcp_meta/lsnmanager.py
  16. 2
      vmware_nsx/neutron/plugins/vmware/dhcp_meta/migration.py
  17. 2
      vmware_nsx/neutron/plugins/vmware/dhcp_meta/nsx.py
  18. 2
      vmware_nsx/neutron/plugins/vmware/dhcp_meta/rpc.py
  19. 2
      vmware_nsx/neutron/plugins/vmware/dhcpmeta_modes.py
  20. 2
      vmware_nsx/neutron/plugins/vmware/dvs/dvs.py
  21. 2
      vmware_nsx/neutron/plugins/vmware/nsx_cluster.py
  22. 2
      vmware_nsx/neutron/plugins/vmware/nsxlib/router.py
  23. 2
      vmware_nsx/neutron/plugins/vmware/nsxlib/secgroup.py
  24. 2
      vmware_nsx/neutron/plugins/vmware/nsxlib/switch.py
  25. 2
      vmware_nsx/neutron/plugins/vmware/nsxlib/v3/__init__.py
  26. 2
      vmware_nsx/neutron/plugins/vmware/plugins/base.py
  27. 2
      vmware_nsx/neutron/plugins/vmware/plugins/dvs.py
  28. 2
      vmware_nsx/neutron/plugins/vmware/plugins/managers.py
  29. 2
      vmware_nsx/neutron/plugins/vmware/plugins/nsx_v.py
  30. 2
      vmware_nsx/neutron/plugins/vmware/plugins/nsx_v3_plugin.py
  31. 2
      vmware_nsx/neutron/plugins/vmware/plugins/nsx_v_md_proxy.py
  32. 2
      vmware_nsx/neutron/plugins/vmware/vshield/edge_appliance_driver.py
  33. 2
      vmware_nsx/neutron/plugins/vmware/vshield/edge_firewall_driver.py
  34. 2
      vmware_nsx/neutron/plugins/vmware/vshield/edge_ipsecvpn_driver.py
  35. 2
      vmware_nsx/neutron/plugins/vmware/vshield/edge_loadbalancer_driver.py
  36. 2
      vmware_nsx/neutron/plugins/vmware/vshield/edge_utils.py
  37. 4
      vmware_nsx/neutron/plugins/vmware/vshield/tasks/tasks.py
  38. 3
      vmware_nsx/neutron/tests/unit/vmware/apiclient/test_api_eventlet_request.py
  39. 0
      vmware_nsx/openstack/__init__.py
  40. 0
      vmware_nsx/openstack/common/__init__.py
  41. 45
      vmware_nsx/openstack/common/_i18n.py
  42. 147
      vmware_nsx/openstack/common/loopingcall.py

6
openstack-common.conf

@ -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

1
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

2
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

2
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__)

2
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__)

2
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__)

2
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"

2
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__)

2
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__)

2
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__)

2
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__)

4
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

2
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__)

2
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__)

2
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__)

2
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__)

2
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

2
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

2
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__)

2
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__)

2
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

2
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 :(

2
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"

2
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"

2
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__)

2
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__)

2
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__)

2
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"]

2
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'

2
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__)

2
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

2
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__)

2
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__)

2
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__)

2
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

2
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

4
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

3
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__)

0
vmware_nsx/openstack/__init__.py

0
vmware_nsx/openstack/common/__init__.py

45
vmware_nsx/openstack/common/_i18n.py

@ -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

147
vmware_nsx/openstack/common/loopingcall.py

@ -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
Loading…
Cancel
Save