RouterPort OVO integration

This patch integrates the RouterPort OVO
in the rest of the neutron code base.

Partially-Implements: blueprint adopt-oslo-versioned-objects-for-db
Change-Id: I833fb9ed3524249f601b73dd282a0176d352da5a
This commit is contained in:
Lujin
2017-07-14 11:26:15 +09:00
committed by Ihar Hrachyshka
parent 71d9aab87e
commit 2ca6b5bce6
7 changed files with 98 additions and 74 deletions

View File

@@ -44,11 +44,10 @@ from neutron.db.availability_zone import router as router_az_db
from neutron.db import l3_dvr_db
from neutron.db.l3_dvr_db import is_distributed_router
from neutron.db.models import agent as agent_model
from neutron.db.models import l3 as l3_models
from neutron.db.models import l3ha as l3ha_model
from neutron.extensions import l3
from neutron.extensions import l3_ext_ha_mode as l3_ha
from neutron.objects import router as l3_objs
from neutron.objects import router as l3_obj
from neutron.plugins.common import utils as p_utils
@@ -268,10 +267,11 @@ class L3_HA_NAT_db_mixin(l3_dvr_db.L3_NAT_with_dvr_db_mixin,
def _create_ha_port_binding(self, context, router_id, port_id):
try:
with context.session.begin():
routerportbinding = l3_models.RouterPort(
port_id=port_id, router_id=router_id,
port_type=constants.DEVICE_OWNER_ROUTER_HA_INTF)
context.session.add(routerportbinding)
l3_obj.RouterPort(
context,
port_id=port_id,
router_id=router_id,
port_type=constants.DEVICE_OWNER_ROUTER_HA_INTF).create()
portbinding = l3ha_model.L3HARouterAgentPortBinding(
port_id=port_id, router_id=router_id)
context.session.add(portbinding)
@@ -722,7 +722,7 @@ def is_ha_router_port(context, device_owner, router_id):
if device_owner == constants.DEVICE_OWNER_HA_REPLICATED_INT:
return True
elif device_owner == constants.DEVICE_OWNER_ROUTER_SNAT:
return l3_objs.RouterExtraAttributes.objects_exist(
return l3_obj.RouterExtraAttributes.objects_exist(
context, router_id=router_id, ha=True)
else:
return False