Adopt oslo incubator

This patch removes usage of incubated libraries from
neutron.openstack.common and starts "copying" such libraries from
the oslo incubator as any other project.

As vmware-nsx currently only uses i18n, and loopingcall, these are
the only modules added to openstack-common.conf
All the imports pointing out to neutron.i18n or
neutron.openstack.common.loopingcall are amended in this patch.

Closes-Bug: #1432783
Change-Id: I6b9d576bad33310598139c7169627c44014301af
This commit is contained in:
Salvatore Orlando
2015-03-16 07:43:58 -07:00
committed by Kobi Samoray
parent 74662b3387
commit ce0e969681
39 changed files with 257 additions and 49 deletions

6
openstack-common.conf Normal file
View File

@@ -0,0 +1,6 @@
[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

View File

@@ -81,5 +81,5 @@ commands =
pylint --rcfile=.pylintrc --output-format=colorized {posargs:vmware_nsx/neutron} pylint --rcfile=.pylintrc --output-format=colorized {posargs:vmware_nsx/neutron}
[hacking] [hacking]
import_exceptions = neutron.i18n import_exceptions = vmware_nsx.openstack.common._i18n
local-check-factory = neutron.hacking.checks.factory local-check-factory = neutron.hacking.checks.factory

View File

@@ -22,8 +22,8 @@ import time
from oslo_config import cfg from oslo_config import cfg
from oslo_log import log as logging 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.neutron.plugins.vmware import api_client
from vmware_nsx.openstack.common._i18n import _LE, _LI, _LW
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@@ -17,7 +17,6 @@
import httplib import httplib
from neutron.i18n import _LE
from oslo_log import log as logging from oslo_log import log as logging
from vmware_nsx.neutron.plugins.vmware.api_client import base from vmware_nsx.neutron.plugins.vmware.api_client import base
@@ -25,6 +24,7 @@ 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 eventlet_request
from vmware_nsx.neutron.plugins.vmware.api_client import exception from vmware_nsx.neutron.plugins.vmware.api_client import exception
from vmware_nsx.neutron.plugins.vmware.api_client import version from vmware_nsx.neutron.plugins.vmware.api_client import version
from vmware_nsx.openstack.common._i18n import _LE
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@@ -21,9 +21,9 @@ import eventlet
eventlet.monkey_patch() eventlet.monkey_patch()
from oslo_log import log as logging 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 base
from vmware_nsx.neutron.plugins.vmware.api_client import eventlet_request from vmware_nsx.neutron.plugins.vmware.api_client import eventlet_request
from vmware_nsx.openstack.common._i18n import _LE
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@@ -21,8 +21,8 @@ import eventlet
from oslo_log import log as logging from oslo_log import log as logging
from oslo_serialization import jsonutils from oslo_serialization import jsonutils
from neutron.i18n import _LI, _LW
from vmware_nsx.neutron.plugins.vmware.api_client import request from vmware_nsx.neutron.plugins.vmware.api_client import request
from vmware_nsx.openstack.common._i18n import _LI, _LW
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
USER_AGENT = "Neutron eventlet client/2.0" USER_AGENT = "Neutron eventlet client/2.0"

View File

@@ -26,8 +26,8 @@ from oslo_utils import excutils
import six import six
import six.moves.urllib.parse as urlparse 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.neutron.plugins.vmware import api_client
from vmware_nsx.openstack.common._i18n import _LI, _LW
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@@ -15,9 +15,11 @@
# under the License. # under the License.
# #
from neutron.i18n import _LW
from oslo_log import log as logging from oslo_log import log as logging
from vmware_nsx.openstack.common._i18n import _LW
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@@ -16,8 +16,8 @@ import logging
from oslo_config import cfg 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.neutron.plugins.vmware.common import exceptions as nsx_exc
from vmware_nsx.openstack.common._i18n import _LW
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@@ -17,7 +17,6 @@ from neutron.api.v2 import attributes as attr
from neutron.common import exceptions as n_exc from neutron.common import exceptions as n_exc
from neutron.extensions import multiprovidernet as mpnet from neutron.extensions import multiprovidernet as mpnet
from neutron.extensions import providernet as pnet from neutron.extensions import providernet as pnet
from neutron.i18n import _LW
from oslo_log import log from oslo_log import log
from vmware_nsx.neutron.plugins.vmware.api_client import client from vmware_nsx.neutron.plugins.vmware.api_client import client
@@ -30,6 +29,7 @@ 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 router as routerlib
from vmware_nsx.neutron.plugins.vmware.nsxlib import secgroup as secgrouplib 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.neutron.plugins.vmware.nsxlib import switch as switchlib
from vmware_nsx.openstack.common._i18n import _LW
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)

View File

@@ -26,14 +26,15 @@ from neutron.db import external_net_db
from neutron.db import l3_db from neutron.db import l3_db
from neutron.db import models_v2 from neutron.db import models_v2
from neutron.extensions import l3 from neutron.extensions import l3
from neutron.i18n import _LE, _LI, _LW
from neutron.openstack.common import loopingcall
from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc 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 exceptions as nsx_exc
from vmware_nsx.neutron.plugins.vmware.common import nsx_utils from vmware_nsx.neutron.plugins.vmware.common import nsx_utils
from vmware_nsx.neutron.plugins.vmware import nsxlib 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 router as routerlib
from vmware_nsx.neutron.plugins.vmware.nsxlib import switch as switchlib 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 # Maximum page size for a single request
# NOTE(salv-orlando): This might become a version-dependent map should the # NOTE(salv-orlando): This might become a version-dependent map should the

View File

@@ -21,13 +21,12 @@ from sqlalchemy.orm import exc
from sqlalchemy.sql import expression as expr from sqlalchemy.sql import expression as expr
import neutron.db.api as db import neutron.db.api as db
from neutron.i18n import _, _LE
from neutron.plugins.vmware.dbexts import nsxv_models from neutron.plugins.vmware.dbexts import nsxv_models
from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc 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.common import nsxv_constants
from vmware_nsx.neutron.plugins.vmware.vshield.common import constants from vmware_nsx.neutron.plugins.vmware.vshield.common import constants
from vmware_nsx.openstack.common._i18n import _, _LE
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@@ -18,12 +18,13 @@ from sqlalchemy.orm import exc
from neutron.api.v2 import attributes as attr from neutron.api.v2 import attributes as attr
from neutron.db import db_base_plugin_v2 from neutron.db import db_base_plugin_v2
from neutron.db import models_v2 from neutron.db import models_v2
from neutron.i18n import _LI
from neutron.plugins.vmware.dbexts import nsx_models from neutron.plugins.vmware.dbexts import nsx_models
from neutron.plugins.vmware.extensions import qos from neutron.plugins.vmware.extensions import qos
from oslo_log import log from oslo_log import log
from oslo_utils import uuidutils from oslo_utils import uuidutils
from vmware_nsx.openstack.common._i18n import _LI
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)

View File

@@ -15,13 +15,12 @@
# under the License. # under the License.
# #
from neutron.common import exceptions as n_exc
from oslo_config import cfg from oslo_config import cfg
from oslo_db import exception as db_exc from oslo_db import exception as db_exc
from oslo_log import log as logging from oslo_log import log as logging
from oslo_utils import excutils from oslo_utils import excutils
from neutron.common import exceptions as n_exc
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.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 exceptions as p_exc
from vmware_nsx.neutron.plugins.vmware.common import nsx_utils from vmware_nsx.neutron.plugins.vmware.common import nsx_utils
@@ -29,6 +28,7 @@ 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.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 lsn as lsn_api
from vmware_nsx.neutron.plugins.vmware.nsxlib import switch as switch_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__) LOG = logging.getLogger(__name__)

View File

@@ -18,12 +18,12 @@
from neutron.common import constants as const from neutron.common import constants as const
from neutron.common import exceptions as n_exc from neutron.common import exceptions as n_exc
from neutron.extensions import external_net from neutron.extensions import external_net
from neutron.i18n import _LE
from oslo_log import log as logging from oslo_log import log as logging
from vmware_nsx.neutron.plugins.vmware.common import exceptions as p_exc 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 nsx
from vmware_nsx.neutron.plugins.vmware.dhcp_meta import rpc from vmware_nsx.neutron.plugins.vmware.dhcp_meta import rpc
from vmware_nsx.openstack.common._i18n import _LE
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@@ -25,7 +25,7 @@ from neutron.common import exceptions as n_exc
from neutron.db import db_base_plugin_v2 from neutron.db import db_base_plugin_v2
from neutron.db import l3_db from neutron.db import l3_db
from neutron.extensions import external_net from neutron.extensions import external_net
from neutron.i18n import _LE, _LI from vmware_nsx.openstack.common._i18n import _LE, _LI
from vmware_nsx.neutron.plugins.vmware.common import exceptions as p_exc 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.dhcp_meta import constants as d_const
from vmware_nsx.neutron.plugins.vmware.nsxlib import lsn as lsn_api from vmware_nsx.neutron.plugins.vmware.nsxlib import lsn as lsn_api

View File

@@ -25,7 +25,7 @@ from neutron.common import constants as const
from neutron.common import exceptions as ntn_exc from neutron.common import exceptions as ntn_exc
from neutron.db import db_base_plugin_v2 from neutron.db import db_base_plugin_v2
from neutron.db import models_v2 from neutron.db import models_v2
from neutron.i18n import _LE, _LI, _LW from vmware_nsx.openstack.common._i18n import _LE, _LI, _LW
from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc 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 config
from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc

View File

@@ -27,7 +27,6 @@ from neutron.common import constants as const
from neutron.common import rpc as n_rpc from neutron.common import rpc as n_rpc
from neutron.common import topics from neutron.common import topics
from neutron.db import agents_db from neutron.db import agents_db
from neutron.i18n import _LW
from neutron.plugins.vmware.extensions import lsn from neutron.plugins.vmware.extensions import lsn
from vmware_nsx.neutron.plugins.vmware.common import config from vmware_nsx.neutron.plugins.vmware.common import config
@@ -37,6 +36,7 @@ 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 migration
from vmware_nsx.neutron.plugins.vmware.dhcp_meta import nsx as nsx_svc 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.neutron.plugins.vmware.dhcp_meta import rpc as nsx_rpc
from vmware_nsx.openstack.common._i18n import _LW
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@@ -12,14 +12,14 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from neutron.common import exceptions
from oslo_log import log as logging
from oslo_utils import excutils from oslo_utils import excutils
from oslo_vmware import vim_util from oslo_vmware import vim_util
from neutron.common import exceptions
from neutron.i18n import _LE, _LI
from oslo_log import log as logging
from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc 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.neutron.plugins.vmware.dvs import dvs_utils
from vmware_nsx.openstack.common._i18n import _LE, _LI
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@@ -16,8 +16,8 @@
from oslo_config import cfg from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
from neutron.i18n import _LI
from vmware_nsx.neutron.plugins.vmware.common import exceptions from vmware_nsx.neutron.plugins.vmware.common import exceptions
from vmware_nsx.openstack.common._i18n import _LI
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
DEFAULT_PORT = 443 DEFAULT_PORT = 443

View File

@@ -19,13 +19,14 @@ from oslo_serialization import jsonutils
from oslo_utils import excutils from oslo_utils import excutils
from neutron.common import exceptions as exception 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.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 exceptions as nsx_exc
from vmware_nsx.neutron.plugins.vmware.common import utils from vmware_nsx.neutron.plugins.vmware.common import utils
from vmware_nsx.neutron.plugins.vmware import nsxlib 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 switch
from vmware_nsx.neutron.plugins.vmware.nsxlib import versioning 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 # @versioning.versioned decorator makes the apparent function body
# totally unrelated to the real function. This confuses pylint :( # totally unrelated to the real function. This confuses pylint :(

View File

@@ -19,9 +19,10 @@ from oslo_utils import excutils
from neutron.common import constants from neutron.common import constants
from neutron.common import exceptions 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.common import utils
from vmware_nsx.neutron.plugins.vmware import nsxlib from vmware_nsx.neutron.plugins.vmware import nsxlib
from vmware_nsx.openstack.common._i18n import _LW
HTTP_GET = "GET" HTTP_GET = "GET"
HTTP_POST = "POST" HTTP_POST = "POST"

View File

@@ -20,11 +20,12 @@ from oslo_serialization import jsonutils
from neutron.common import constants from neutron.common import constants
from neutron.common import exceptions as exception 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.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 exceptions as nsx_exc
from vmware_nsx.neutron.plugins.vmware.common import utils from vmware_nsx.neutron.plugins.vmware.common import utils
from vmware_nsx.neutron.plugins.vmware import nsxlib from vmware_nsx.neutron.plugins.vmware import nsxlib
from vmware_nsx.openstack.common._i18n import _LE, _LI, _LW
HTTP_GET = "GET" HTTP_GET = "GET"
HTTP_POST = "POST" HTTP_POST = "POST"

View File

@@ -53,7 +53,6 @@ from neutron.extensions import portbindings as pbin
from neutron.extensions import portsecurity as psec from neutron.extensions import portsecurity as psec
from neutron.extensions import providernet as pnet from neutron.extensions import providernet as pnet
from neutron.extensions import securitygroup as ext_sg 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 constants as plugin_const
from neutron.plugins.vmware.dbexts import nsx_models from neutron.plugins.vmware.dbexts import nsx_models
from neutron.plugins.vmware.extensions import maclearning as mac_ext from neutron.plugins.vmware.extensions import maclearning as mac_ext
@@ -78,6 +77,7 @@ 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 router as routerlib
from vmware_nsx.neutron.plugins.vmware.nsxlib import secgroup as secgrouplib 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.neutron.plugins.vmware.nsxlib import switch as switchlib
from vmware_nsx.openstack.common._i18n import _LE, _LI, _LW
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@@ -35,7 +35,7 @@ from neutron.extensions import multiprovidernet as mpnet
from neutron.extensions import portbindings as pbin from neutron.extensions import portbindings as pbin
from neutron.extensions import portsecurity as psec from neutron.extensions import portsecurity as psec
from neutron.extensions import providernet as pnet from neutron.extensions import providernet as pnet
from neutron.i18n import _LE, _LW
from vmware_nsx.neutron.plugins import vmware from vmware_nsx.neutron.plugins import vmware
from vmware_nsx.neutron.plugins.vmware.common import config # noqa 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 exceptions as nsx_exc
@@ -44,6 +44,7 @@ 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 import dhcpmeta_modes
from vmware_nsx.neutron.plugins.vmware.dvs import dvs from vmware_nsx.neutron.plugins.vmware.dvs import dvs
from vmware_nsx.neutron.plugins.vmware.dvs import dvs_utils from vmware_nsx.neutron.plugins.vmware.dvs import dvs_utils
from vmware_nsx.openstack.common._i18n import _LE, _LW
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@@ -18,9 +18,8 @@ import stevedore
from oslo_log import log 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.neutron.plugins.vmware.common import exceptions as nsx_exc
from vmware_nsx.openstack.common._i18n import _LE, _LI
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)
ROUTER_TYPE_DRIVERS = ["distributed", "exclusive", "shared"] ROUTER_TYPE_DRIVERS = ["distributed", "exclusive", "shared"]

View File

@@ -47,11 +47,11 @@ from neutron.extensions import portbindings as pbin
from neutron.extensions import portsecurity as psec from neutron.extensions import portsecurity as psec
from neutron.extensions import providernet as pnet from neutron.extensions import providernet as pnet
from neutron.extensions import securitygroup as ext_sg from neutron.extensions import securitygroup as ext_sg
from neutron.i18n import _LE, _LI, _LW
from neutron.plugins.vmware.extensions import ( from neutron.plugins.vmware.extensions import (
advancedserviceproviders as as_providers) advancedserviceproviders as as_providers)
from neutron.plugins.vmware.extensions import ( from neutron.plugins.vmware.extensions import (
vnicindex as ext_vnic_idx) vnicindex as ext_vnic_idx)
from vmware_nsx.neutron.plugins import vmware from vmware_nsx.neutron.plugins import vmware
from vmware_nsx.neutron.plugins.vmware.common import config # noqa 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 exceptions as nsx_exc
@@ -70,6 +70,7 @@ 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 edge_utils
from vmware_nsx.neutron.plugins.vmware.vshield import securitygroup_utils from vmware_nsx.neutron.plugins.vmware.vshield import securitygroup_utils
from vmware_nsx.neutron.plugins.vmware.vshield import vcns_driver from vmware_nsx.neutron.plugins.vmware.vshield import vcns_driver
from vmware_nsx.openstack.common._i18n import _LE, _LI, _LW
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
PORTGROUP_PREFIX = 'dvportgroup' PORTGROUP_PREFIX = 'dvportgroup'

View File

@@ -19,15 +19,14 @@ import hmac
import time import time
import netaddr import netaddr
from neutron.api.v2 import attributes as attr
from neutron.common import constants
from neutron import context as neutron_context
from oslo_config import cfg from oslo_config import cfg
from oslo_db import exception as db_exc from oslo_db import exception as db_exc
from oslo_log import log as logging from oslo_log import log as logging
from oslo_utils import excutils from oslo_utils import excutils
from neutron.api.v2 import attributes as attr
from neutron.common import constants
from neutron import context as neutron_context
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 exceptions as nsxv_exc
from vmware_nsx.neutron.plugins.vmware.common import nsxv_constants from vmware_nsx.neutron.plugins.vmware.common import nsxv_constants
from vmware_nsx.neutron.plugins.vmware.dbexts import nsxv_db from vmware_nsx.neutron.plugins.vmware.dbexts import nsxv_db
@@ -36,6 +35,7 @@ from vmware_nsx.neutron.plugins.vmware.vshield import (
from vmware_nsx.neutron.plugins.vmware.vshield.common import ( from vmware_nsx.neutron.plugins.vmware.vshield.common import (
constants as vcns_const) constants as vcns_const)
from vmware_nsx.neutron.plugins.vmware.vshield import edge_utils 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_IP_ADDR = '169.254.169.254'
METADATA_TCP_PORT = 80 METADATA_TCP_PORT = 80

View File

@@ -21,7 +21,6 @@ from oslo_log import log as logging
from oslo_serialization import jsonutils from oslo_serialization import jsonutils
from oslo_utils import excutils 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 nsxv_constants
from vmware_nsx.neutron.plugins.vmware.common import utils from vmware_nsx.neutron.plugins.vmware.common import utils
from vmware_nsx.neutron.plugins.vmware.vshield.common import constants from vmware_nsx.neutron.plugins.vmware.vshield.common import constants
@@ -29,6 +28,7 @@ from vmware_nsx.neutron.plugins.vmware.vshield.common import exceptions
from vmware_nsx.neutron.plugins.vmware.vshield.tasks import ( from vmware_nsx.neutron.plugins.vmware.vshield.tasks import (
constants as task_constants) constants as task_constants)
from vmware_nsx.neutron.plugins.vmware.vshield.tasks import tasks from vmware_nsx.neutron.plugins.vmware.vshield.tasks import tasks
from vmware_nsx.openstack.common._i18n import _LE, _LI, _LW
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@@ -12,18 +12,18 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from neutron.db import db_base_plugin_v2
from neutron.plugins.common import constants
from oslo_log import log as logging from oslo_log import log as logging
from oslo_utils import excutils from oslo_utils import excutils
from neutron.db import db_base_plugin_v2
from neutron.i18n import _, _LE
from neutron.plugins.common import constants
from vmware_nsx.neutron.plugins.vmware.dbexts import nsxv_db from vmware_nsx.neutron.plugins.vmware.dbexts import nsxv_db
from vmware_nsx.neutron.plugins.vmware.vshield.common import ( from vmware_nsx.neutron.plugins.vmware.vshield.common import (
exceptions as vcns_exc) exceptions as vcns_exc)
from vmware_nsx.neutron.plugins.vmware.vshield.tasks import ( from vmware_nsx.neutron.plugins.vmware.vshield.tasks import (
constants as task_const) constants as task_const)
from vmware_nsx.neutron.plugins.vmware.vshield.tasks import tasks from vmware_nsx.neutron.plugins.vmware.vshield.tasks import tasks
from vmware_nsx.openstack.common._i18n import _, _LE
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@@ -12,12 +12,12 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from oslo_log import log as logging
from oslo_utils import excutils from oslo_utils import excutils
from neutron.i18n import _LE, _LW
from oslo_log import log as logging
from vmware_nsx.neutron.plugins.vmware.vshield.common import ( from vmware_nsx.neutron.plugins.vmware.vshield.common import (
exceptions as vcns_exc) exceptions as vcns_exc)
from vmware_nsx.openstack.common._i18n import _LE, _LW
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@@ -14,13 +14,15 @@
from oslo_utils import excutils from oslo_utils import excutils
from neutron.i18n import _LE
from oslo_log import log as logging from oslo_log import log as logging
from vmware_nsx.neutron.plugins.vmware.dbexts import nsxv_db from vmware_nsx.neutron.plugins.vmware.dbexts import nsxv_db
from vmware_nsx.neutron.plugins.vmware.vshield.common import ( from vmware_nsx.neutron.plugins.vmware.vshield.common import (
constants as vcns_const) constants as vcns_const)
from vmware_nsx.neutron.plugins.vmware.vshield.common import ( from vmware_nsx.neutron.plugins.vmware.vshield.common import (
exceptions as vcns_exc) exceptions as vcns_exc)
from vmware_nsx.openstack.common._i18n import _LE
try: try:
from neutron_lbaas.services.loadbalancer import constants as lb_constants from neutron_lbaas.services.loadbalancer import constants as lb_constants
except Exception: except Exception:

View File

@@ -26,8 +26,8 @@ from sqlalchemy.orm import exc as sa_exc
from neutron.common import exceptions as n_exc from neutron.common import exceptions as n_exc
from neutron import context as q_context from neutron import context as q_context
from neutron.extensions import l3 from neutron.extensions import l3
from neutron.i18n import _LE, _LW
from neutron.plugins.common import constants as plugin_const from neutron.plugins.common import constants as plugin_const
from vmware_nsx.neutron.plugins.vmware.common import nsxv_constants from vmware_nsx.neutron.plugins.vmware.common import nsxv_constants
from vmware_nsx.neutron.plugins.vmware.dbexts import db as nsx_db from vmware_nsx.neutron.plugins.vmware.dbexts import db as nsx_db
from vmware_nsx.neutron.plugins.vmware.dbexts import nsxv_db from vmware_nsx.neutron.plugins.vmware.dbexts import nsxv_db
@@ -36,7 +36,7 @@ from vmware_nsx.neutron.plugins.vmware.vshield.common import (
from vmware_nsx.neutron.plugins.vmware.vshield.tasks import ( from vmware_nsx.neutron.plugins.vmware.vshield.tasks import (
constants as task_const) constants as task_const)
from vmware_nsx.neutron.plugins.vmware.vshield.tasks import tasks from vmware_nsx.neutron.plugins.vmware.vshield.tasks import tasks
from vmware_nsx.openstack.common._i18n import _LE, _LW
WORKER_POOL_SIZE = 8 WORKER_POOL_SIZE = 8
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@@ -19,11 +19,11 @@ import uuid
from eventlet import event from eventlet import event
from eventlet import greenthread from eventlet import greenthread
from neutron.common import exceptions from neutron.common import exceptions
from neutron.i18n import _LE, _LI
from neutron.openstack.common import loopingcall
from oslo_log import log as logging from oslo_log import log as logging
from vmware_nsx.neutron.plugins.vmware.vshield.tasks import constants 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 DEFAULT_INTERVAL = 1000

View File

@@ -18,15 +18,16 @@ import random
import eventlet import eventlet
from eventlet.green import urllib2 from eventlet.green import urllib2
import mock import mock
from neutron.i18n import _LI
from neutron.tests import base from neutron.tests import base
from oslo_log import log as logging from oslo_log import log as logging
from vmware_nsx.neutron.plugins.vmware.api_client import ( from vmware_nsx.neutron.plugins.vmware.api_client import (
eventlet_client as client) eventlet_client as client)
from vmware_nsx.neutron.plugins.vmware.api_client import ( from vmware_nsx.neutron.plugins.vmware.api_client import (
eventlet_request as request) eventlet_request as request)
from vmware_nsx.neutron.tests.unit import vmware from vmware_nsx.neutron.tests.unit import vmware
from vmware_nsx.openstack.common._i18n import _LI
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

View File

View File

@@ -0,0 +1,45 @@
# 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

View File

@@ -0,0 +1,147 @@
# 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