remove SHARED constant that now lives in neutron-lib

The SHARED constant was rehomed into neutron-lib with commit
If123044496b54a8bfc115ab41b8506ec5d7ba5a3
This patch removes the SHARED constant from vmware-nsx and switches all
uses to neutron-lib's version.

Change-Id: I8ab75021399b5a85f5bfe8de858d8c4309b741dc
This commit is contained in:
Boden R 2018-03-01 15:51:12 -07:00
parent 2825e30777
commit 5106963756
5 changed files with 7 additions and 7 deletions

View File

@ -20,7 +20,6 @@ XLARGE = 'xlarge'
QUADLARGE = 'quadlarge' QUADLARGE = 'quadlarge'
SHARED = "shared"
EXCLUSIVE = "exclusive" EXCLUSIVE = "exclusive"
# Edge type # Edge type

View File

@ -14,7 +14,8 @@
# under the License. # under the License.
# #
from vmware_nsx.common import nsxv_constants from neutron_lib import constants
from vmware_nsx.db import ( from vmware_nsx.db import (
distributedrouter as dist_rtr) distributedrouter as dist_rtr)
from vmware_nsx.extensions import routertype as rt_rtr from vmware_nsx.extensions import routertype as rt_rtr
@ -26,5 +27,5 @@ class RouterType_mixin(dist_rtr.DistributedRouter_mixin):
nsx_attributes = ( nsx_attributes = (
dist_rtr.DistributedRouter_mixin.nsx_attributes + [{ dist_rtr.DistributedRouter_mixin.nsx_attributes + [{
'name': rt_rtr.ROUTER_TYPE, 'name': rt_rtr.ROUTER_TYPE,
'default': nsxv_constants.SHARED 'default': constants.SHARED
}]) }])

View File

@ -37,7 +37,6 @@ from sqlalchemy.orm import exc as sa_exc
import webob.exc import webob.exc
from neutron.api import extensions as neutron_extensions from neutron.api import extensions as neutron_extensions
from neutron.api.v2 import attributes as attr
from neutron.db import _model_query as model_query from neutron.db import _model_query as model_query
from neutron.db import _resource_extend as resource_extend from neutron.db import _resource_extend as resource_extend
from neutron.db import _utils as db_utils from neutron.db import _utils as db_utils
@ -963,7 +962,7 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin,
self.cluster, net_data['id'], self.cluster, net_data['id'],
tenant_id, net_data.get('name'), tenant_id, net_data.get('name'),
transport_zone_config, transport_zone_config,
shared=net_data.get(attr.SHARED)) shared=net_data.get(constants.SHARED))
with db_api.context_manager.writer.using(context): with db_api.context_manager.writer.using(context):
new_net = super(NsxPluginV2, self).create_network(context, new_net = super(NsxPluginV2, self).create_network(context,

View File

@ -3067,7 +3067,7 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
# exception. # exception.
r = router['router'] r = router['router']
if validators.is_attr_set(r.get(ROUTER_SIZE)): if validators.is_attr_set(r.get(ROUTER_SIZE)):
if r.get('router_type') == nsxv_constants.SHARED: if r.get('router_type') == constants.SHARED:
msg = _("Cannot specify router-size for shared router") msg = _("Cannot specify router-size for shared router")
raise n_exc.BadRequest(resource="router", msg=msg) raise n_exc.BadRequest(resource="router", msg=msg)
elif r.get('distributed') is True: elif r.get('distributed') is True:

View File

@ -13,6 +13,7 @@
# 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_lib import constants
from neutron_vpnaas.db.vpn import vpn_validator from neutron_vpnaas.db.vpn import vpn_validator
from oslo_log import log as logging from oslo_log import log as logging
@ -80,7 +81,7 @@ class IPsecValidator(vpn_validator.VpnReferenceValidator):
break break
def _is_shared_router(self, router): def _is_shared_router(self, router):
return router.get('router_type') == nsxv_constants.SHARED return router.get('router_type') == constants.SHARED
def _validate_router(self, context, router_id): def _validate_router(self, context, router_id):
# Only support distributed and exclusive router type # Only support distributed and exclusive router type