Merge "use ovo for L3HARouterAgentPortBinding in l3_hamode."

This commit is contained in:
Zuul 2018-10-19 23:10:21 +00:00 committed by Gerrit Code Review
commit 84d8949da3
2 changed files with 6 additions and 6 deletions

View File

@ -51,7 +51,6 @@ from neutron.conf.db import l3_hamode_db
from neutron.db import _utils as db_utils
from neutron.db.availability_zone import router as router_az_db
from neutron.db import l3_dvr_db
from neutron.db.models import l3ha as l3ha_model
from neutron.objects import base
from neutron.objects import l3_hamode
from neutron.objects import router as l3_obj
@ -258,9 +257,9 @@ class L3_HA_NAT_db_mixin(l3_dvr_db.L3_NAT_with_dvr_db_mixin,
port_id=port_id,
router_id=router_id,
port_type=constants.DEVICE_OWNER_ROUTER_HA_INTF).create()
portbinding = l3ha_model.L3HARouterAgentPortBinding(
portbinding = l3_hamode.L3HARouterAgentPortBinding(context,
port_id=port_id, router_id=router_id)
context.session.add(portbinding)
portbinding.create()
return portbinding
except db_exc.DBReferenceError as e:
@ -298,7 +297,9 @@ class L3_HA_NAT_db_mixin(l3_dvr_db.L3_NAT_with_dvr_db_mixin,
port, binding = db_utils.safe_creation(context, creation,
deletion, content,
transaction=False)
return binding
# _create_ha_port_binding returns the binding object now and
# to populate agent relation db_obj is used.
return binding.db_obj
def _delete_ha_interfaces(self, context, router_id):
admin_ctx = context.elevated()

View File

@ -44,7 +44,6 @@ from neutron.db import agents_db
from neutron.db import common_db_mixin
from neutron.db import l3_agentschedulers_db
from neutron.db import l3_hamode_db
from neutron.db.models import l3ha as l3ha_model
from neutron.objects import l3_hamode
from neutron.scheduler import l3_agent_scheduler
from neutron.services.revisions import revision_plugin
@ -605,7 +604,7 @@ class L3HATestCase(L3HATestFramework):
network = self.plugin.get_ha_network(self.admin_ctx,
router['tenant_id'])
with mock.patch.object(l3ha_model, 'L3HARouterAgentPortBinding',
with mock.patch.object(l3_hamode, 'L3HARouterAgentPortBinding',
side_effect=ValueError):
self.assertRaises(ValueError, self.plugin.add_ha_port,
self.admin_ctx, router['id'], network.network_id,