Merge "NSX: remove depracted DB warnings"
This commit is contained in:
commit
bf4f17d24a
@ -25,8 +25,8 @@ from oslo_utils import timeutils
|
|||||||
import six
|
import six
|
||||||
|
|
||||||
from neutron import context
|
from neutron import context
|
||||||
from neutron.db import external_net_db
|
from neutron.db.models import external_net as external_net_db
|
||||||
from neutron.db import l3_db
|
from neutron.db.models import l3 as l3_db
|
||||||
from neutron.db import models_v2
|
from neutron.db import models_v2
|
||||||
from neutron.extensions import l3
|
from neutron.extensions import l3
|
||||||
|
|
||||||
|
@ -42,6 +42,7 @@ from neutron.db import extraroute_db
|
|||||||
from neutron.db import l3_db
|
from neutron.db import l3_db
|
||||||
from neutron.db import l3_dvr_db
|
from neutron.db import l3_dvr_db
|
||||||
from neutron.db import l3_gwmode_db
|
from neutron.db import l3_gwmode_db
|
||||||
|
from neutron.db.models import l3 as l3_db_models
|
||||||
from neutron.db.models import securitygroup as securitygroup_model # noqa
|
from neutron.db.models import securitygroup as securitygroup_model # noqa
|
||||||
from neutron.db import models_v2
|
from neutron.db import models_v2
|
||||||
from neutron.db import portbindings_db
|
from neutron.db import portbindings_db
|
||||||
@ -143,8 +144,8 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
|||||||
subnetpool=models_v2.SubnetPool,
|
subnetpool=models_v2.SubnetPool,
|
||||||
security_group=securitygroup_model.SecurityGroup,
|
security_group=securitygroup_model.SecurityGroup,
|
||||||
security_group_rule=securitygroup_model.SecurityGroupRule,
|
security_group_rule=securitygroup_model.SecurityGroupRule,
|
||||||
router=l3_db.Router,
|
router=l3_db_models.Router,
|
||||||
floatingip=l3_db.FloatingIP)
|
floatingip=l3_db_models.FloatingIP)
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
LOG.warning(_LW("The NSX-MH plugin is deprecated and may be removed "
|
LOG.warning(_LW("The NSX-MH plugin is deprecated and may be removed "
|
||||||
"in the O or the P cycle"))
|
"in the O or the P cycle"))
|
||||||
@ -1475,7 +1476,8 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
|||||||
# Transaction nesting is needed to avoid foreign key violations
|
# Transaction nesting is needed to avoid foreign key violations
|
||||||
# when processing the distributed router binding
|
# when processing the distributed router binding
|
||||||
with context.session.begin(subtransactions=True):
|
with context.session.begin(subtransactions=True):
|
||||||
router_db = l3_db.Router(id=neutron_router_id,
|
router_db = l3_db_models.Router(
|
||||||
|
id=neutron_router_id,
|
||||||
tenant_id=tenant_id,
|
tenant_id=tenant_id,
|
||||||
name=r['name'],
|
name=r['name'],
|
||||||
admin_state_up=r['admin_state_up'],
|
admin_state_up=r['admin_state_up'],
|
||||||
@ -1991,7 +1993,7 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
|||||||
|
|
||||||
def disassociate_floatingips(self, context, port_id):
|
def disassociate_floatingips(self, context, port_id):
|
||||||
try:
|
try:
|
||||||
fip_qry = context.session.query(l3_db.FloatingIP)
|
fip_qry = context.session.query(l3_db_models.FloatingIP)
|
||||||
fip_dbs = fip_qry.filter_by(fixed_port_id=port_id)
|
fip_dbs = fip_qry.filter_by(fixed_port_id=port_id)
|
||||||
|
|
||||||
for fip_db in fip_dbs:
|
for fip_db in fip_dbs:
|
||||||
|
@ -16,6 +16,7 @@ import netaddr
|
|||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
|
|
||||||
from neutron.db import l3_db
|
from neutron.db import l3_db
|
||||||
|
from neutron.db.models import l3 as l3_db_models
|
||||||
from neutron.db import models_v2
|
from neutron.db import models_v2
|
||||||
from neutron_lib.api import validators
|
from neutron_lib.api import validators
|
||||||
from neutron_lib import constants
|
from neutron_lib import constants
|
||||||
@ -117,7 +118,7 @@ class RouterSharedDriver(router_driver.RouterBaseDriver):
|
|||||||
context, router_id)
|
context, router_id)
|
||||||
|
|
||||||
def _get_router_next_hop(self, context, router_id):
|
def _get_router_next_hop(self, context, router_id):
|
||||||
router_qry = context.session.query(l3_db.Router)
|
router_qry = context.session.query(l3_db_models.Router)
|
||||||
router_db = router_qry.filter_by(id=router_id).one()
|
router_db = router_qry.filter_by(id=router_id).one()
|
||||||
return self.plugin._get_external_attachment_info(
|
return self.plugin._get_external_attachment_info(
|
||||||
context, router_db)[2]
|
context, router_db)[2]
|
||||||
@ -206,7 +207,7 @@ class RouterSharedDriver(router_driver.RouterBaseDriver):
|
|||||||
vnics_by_router = self._get_all_routers_vnic_indices(
|
vnics_by_router = self._get_all_routers_vnic_indices(
|
||||||
context, router_ids)
|
context, router_ids)
|
||||||
for router_id in router_ids:
|
for router_id in router_ids:
|
||||||
router_qry = context.session.query(l3_db.Router)
|
router_qry = context.session.query(l3_db_models.Router)
|
||||||
router = router_qry.filter_by(id=router_id).one()
|
router = router_qry.filter_by(id=router_id).one()
|
||||||
if router.gw_port:
|
if router.gw_port:
|
||||||
snat, dnat = self.plugin._get_nat_rules(context, router)
|
snat, dnat = self.plugin._get_nat_rules(context, router)
|
||||||
@ -246,7 +247,7 @@ class RouterSharedDriver(router_driver.RouterBaseDriver):
|
|||||||
else:
|
else:
|
||||||
ext_net_id = ext_net_ids[0]
|
ext_net_id = ext_net_ids[0]
|
||||||
for router_id in router_ids:
|
for router_id in router_ids:
|
||||||
router_qry = context.session.query(l3_db.Router)
|
router_qry = context.session.query(l3_db_models.Router)
|
||||||
router = router_qry.filter_by(id=router_id).one()
|
router = router_qry.filter_by(id=router_id).one()
|
||||||
addr, mask, nexthop = self.plugin._get_external_attachment_info(
|
addr, mask, nexthop = self.plugin._get_external_attachment_info(
|
||||||
context, router)
|
context, router)
|
||||||
@ -275,7 +276,7 @@ class RouterSharedDriver(router_driver.RouterBaseDriver):
|
|||||||
allow_external=True):
|
allow_external=True):
|
||||||
fake_fw_rules = []
|
fake_fw_rules = []
|
||||||
for router_id in router_ids:
|
for router_id in router_ids:
|
||||||
router_qry = context.session.query(l3_db.Router)
|
router_qry = context.session.query(l3_db_models.Router)
|
||||||
router = router_qry.filter_by(id=router_id).one()
|
router = router_qry.filter_by(id=router_id).one()
|
||||||
subnet_cidrs = self.plugin._find_router_subnets_cidrs(
|
subnet_cidrs = self.plugin._find_router_subnets_cidrs(
|
||||||
context, router['id'])
|
context, router['id'])
|
||||||
@ -344,7 +345,7 @@ class RouterSharedDriver(router_driver.RouterBaseDriver):
|
|||||||
def _get_ext_net_ids(self, context, router_ids):
|
def _get_ext_net_ids(self, context, router_ids):
|
||||||
ext_net_ids = []
|
ext_net_ids = []
|
||||||
for router_id in router_ids:
|
for router_id in router_ids:
|
||||||
router_qry = context.session.query(l3_db.Router)
|
router_qry = context.session.query(l3_db_models.Router)
|
||||||
router_db = router_qry.filter_by(id=router_id).one()
|
router_db = router_qry.filter_by(id=router_id).one()
|
||||||
ext_net_id = router_db.gw_port_id and router_db.gw_port.network_id
|
ext_net_id = router_db.gw_port_id and router_db.gw_port.network_id
|
||||||
if ext_net_id and ext_net_id not in ext_net_ids:
|
if ext_net_id and ext_net_id not in ext_net_ids:
|
||||||
@ -353,7 +354,7 @@ class RouterSharedDriver(router_driver.RouterBaseDriver):
|
|||||||
|
|
||||||
def _get_shared_routers(self, context):
|
def _get_shared_routers(self, context):
|
||||||
shared_routers = []
|
shared_routers = []
|
||||||
routers_qry = context.session.query(l3_db.Router).all()
|
routers_qry = context.session.query(l3_db_models.Router).all()
|
||||||
for r in routers_qry:
|
for r in routers_qry:
|
||||||
nsx_attr = (context.session.query(
|
nsx_attr = (context.session.query(
|
||||||
nsxv_models.NsxvRouterExtAttributes).filter_by(
|
nsxv_models.NsxvRouterExtAttributes).filter_by(
|
||||||
@ -535,7 +536,7 @@ class RouterSharedDriver(router_driver.RouterBaseDriver):
|
|||||||
"""
|
"""
|
||||||
ext_net_id = self._get_external_network_id_by_router(context,
|
ext_net_id = self._get_external_network_id_by_router(context,
|
||||||
router_id)
|
router_id)
|
||||||
routers = context.session.query(l3_db.Router).all()
|
routers = context.session.query(l3_db_models.Router).all()
|
||||||
optional_router_ids = []
|
optional_router_ids = []
|
||||||
conflict_router_ids = []
|
conflict_router_ids = []
|
||||||
|
|
||||||
|
@ -48,6 +48,7 @@ from neutron.db import external_net_db
|
|||||||
from neutron.db import extraroute_db
|
from neutron.db import extraroute_db
|
||||||
from neutron.db import l3_db
|
from neutron.db import l3_db
|
||||||
from neutron.db import l3_gwmode_db
|
from neutron.db import l3_gwmode_db
|
||||||
|
from neutron.db.models import l3 as l3_db_models
|
||||||
from neutron.db.models import securitygroup as securitygroup_model # noqa
|
from neutron.db.models import securitygroup as securitygroup_model # noqa
|
||||||
from neutron.db import models_v2
|
from neutron.db import models_v2
|
||||||
from neutron.db import portbindings_db
|
from neutron.db import portbindings_db
|
||||||
@ -175,8 +176,8 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
|||||||
subnetpool=models_v2.SubnetPool,
|
subnetpool=models_v2.SubnetPool,
|
||||||
security_group=securitygroup_model.SecurityGroup,
|
security_group=securitygroup_model.SecurityGroup,
|
||||||
security_group_rule=securitygroup_model.SecurityGroupRule,
|
security_group_rule=securitygroup_model.SecurityGroupRule,
|
||||||
router=l3_db.Router,
|
router=l3_db_models.Router,
|
||||||
floatingip=l3_db.FloatingIP)
|
floatingip=l3_db_models.FloatingIP)
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(NsxVPluginV2, self).__init__()
|
super(NsxVPluginV2, self).__init__()
|
||||||
self.init_is_complete = False
|
self.init_is_complete = False
|
||||||
@ -308,7 +309,7 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
|||||||
return container_id
|
return container_id
|
||||||
|
|
||||||
def _find_router_driver(self, context, router_id):
|
def _find_router_driver(self, context, router_id):
|
||||||
router_qry = context.session.query(l3_db.Router)
|
router_qry = context.session.query(l3_db_models.Router)
|
||||||
router_db = router_qry.filter_by(id=router_id).one()
|
router_db = router_qry.filter_by(id=router_id).one()
|
||||||
return self._get_router_driver(context, router_db)
|
return self._get_router_driver(context, router_db)
|
||||||
|
|
||||||
@ -2694,7 +2695,7 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
|||||||
return cidrs
|
return cidrs
|
||||||
|
|
||||||
def _get_nat_rules(self, context, router):
|
def _get_nat_rules(self, context, router):
|
||||||
fip_qry = context.session.query(l3_db.FloatingIP)
|
fip_qry = context.session.query(l3_db_models.FloatingIP)
|
||||||
fip_db = fip_qry.filter_by(router_id=router['id']).all()
|
fip_db = fip_qry.filter_by(router_id=router['id']).all()
|
||||||
|
|
||||||
snat = []
|
snat = []
|
||||||
@ -2809,7 +2810,7 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
|||||||
context, router_id, interface_info)
|
context, router_id, interface_info)
|
||||||
|
|
||||||
def _get_floatingips_by_router(self, context, router_id):
|
def _get_floatingips_by_router(self, context, router_id):
|
||||||
fip_qry = context.session.query(l3_db.FloatingIP)
|
fip_qry = context.session.query(l3_db_models.FloatingIP)
|
||||||
fip_db = fip_qry.filter_by(router_id=router_id).all()
|
fip_db = fip_qry.filter_by(router_id=router_id).all()
|
||||||
return [fip.floating_ip_address
|
return [fip.floating_ip_address
|
||||||
for fip in fip_db if fip.fixed_port_id]
|
for fip in fip_db if fip.fixed_port_id]
|
||||||
@ -2887,7 +2888,7 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
|||||||
def disassociate_floatingips(self, context, port_id):
|
def disassociate_floatingips(self, context, port_id):
|
||||||
router_id = None
|
router_id = None
|
||||||
try:
|
try:
|
||||||
fip_qry = context.session.query(l3_db.FloatingIP)
|
fip_qry = context.session.query(l3_db_models.FloatingIP)
|
||||||
fip_db = fip_qry.filter_by(fixed_port_id=port_id)
|
fip_db = fip_qry.filter_by(fixed_port_id=port_id)
|
||||||
for fip in fip_db:
|
for fip in fip_db:
|
||||||
if fip.router_id:
|
if fip.router_id:
|
||||||
|
@ -40,6 +40,7 @@ from neutron.db import extradhcpopt_db
|
|||||||
from neutron.db import extraroute_db
|
from neutron.db import extraroute_db
|
||||||
from neutron.db import l3_db
|
from neutron.db import l3_db
|
||||||
from neutron.db import l3_gwmode_db
|
from neutron.db import l3_gwmode_db
|
||||||
|
from neutron.db.models import l3 as l3_db_models
|
||||||
from neutron.db.models import securitygroup as securitygroup_model # noqa
|
from neutron.db.models import securitygroup as securitygroup_model # noqa
|
||||||
from neutron.db import models_v2
|
from neutron.db import models_v2
|
||||||
from neutron.db import portbindings_db
|
from neutron.db import portbindings_db
|
||||||
@ -159,8 +160,8 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
|
|||||||
subnetpool=models_v2.SubnetPool,
|
subnetpool=models_v2.SubnetPool,
|
||||||
security_group=securitygroup_model.SecurityGroup,
|
security_group=securitygroup_model.SecurityGroup,
|
||||||
security_group_rule=securitygroup_model.SecurityGroupRule,
|
security_group_rule=securitygroup_model.SecurityGroupRule,
|
||||||
router=l3_db.Router,
|
router=l3_db_models.Router,
|
||||||
floatingip=l3_db.FloatingIP)
|
floatingip=l3_db_models.FloatingIP)
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(NsxV3Plugin, self).__init__()
|
super(NsxV3Plugin, self).__init__()
|
||||||
LOG.info(_LI("Starting NsxV3Plugin"))
|
LOG.info(_LI("Starting NsxV3Plugin"))
|
||||||
@ -2837,7 +2838,7 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
|
|||||||
return new_fip
|
return new_fip
|
||||||
|
|
||||||
def disassociate_floatingips(self, context, port_id):
|
def disassociate_floatingips(self, context, port_id):
|
||||||
fip_qry = context.session.query(l3_db.FloatingIP)
|
fip_qry = context.session.query(l3_db_models.FloatingIP)
|
||||||
fip_dbs = fip_qry.filter_by(fixed_port_id=port_id)
|
fip_dbs = fip_qry.filter_by(fixed_port_id=port_id)
|
||||||
|
|
||||||
for fip_db in fip_dbs:
|
for fip_db in fip_dbs:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user