[AIM] Make topological calls synchronous

We need a mechanism to know whether the server was able to update
the host link table. Since such operations are usually quick unless
a host interface has moved somewhere, using blocking calls
will give the agent a way to know whether a link update should be
retried.

Change-Id: I33b655d6f87210bfc49cbcb1f23e32b8f6f2be74
This commit is contained in:
Ivar Lazzaro 2018-04-17 14:36:31 -07:00
parent 426e954bd0
commit 53d19a9c08
No known key found for this signature in database
GPG Key ID: ACEEC8CB558DC3CF
2 changed files with 9 additions and 7 deletions

View File

@ -175,7 +175,7 @@ class ApicMechanismDriver(api_plus.MechanismDriver,
db.DbMixin):
class TopologyRpcEndpoint(object):
target = oslo_messaging.Target(version='2.0')
target = oslo_messaging.Target(version='3.0')
def __init__(self, mechanism_driver):
self.md = mechanism_driver
@ -183,12 +183,16 @@ class ApicMechanismDriver(api_plus.MechanismDriver,
@db_api.retry_if_session_inactive()
def update_link(self, context, *args, **kwargs):
context._session = db_api.get_writer_session()
self.md.update_link(context, *args, **kwargs)
return self.md.update_link(context, *args, **kwargs)
@db_api.retry_if_session_inactive()
def delete_link(self, context, *args, **kwargs):
context._session = db_api.get_writer_session()
self.md.delete_link(context, *args, **kwargs)
# Don't take any action on link deletion in order to tolerate
# situations like fabric upgrade or flapping links. Old links
# are removed once a specific host is attached somewhere else.
# To completely decommission the host, aimctl can be used to
# cleanup the hostlink table
return
def __init__(self):
LOG.info("APIC AIM MD __init__")
@ -2076,8 +2080,6 @@ class ApicMechanismDriver(api_plus.MechanismDriver,
pod_id, port_description)]))
with db_api.context_manager.writer.using(context):
if not switch:
self.delete_link(context, host, interface, mac, switch, module,
port)
return
session = context.session

View File

@ -7065,7 +7065,7 @@ class TestPortVlanNetwork(ApicAimTestCase):
check_epg_static_paths(expected_hlink10.path)
# remove first link
self.driver.update_link(nctx, 'h10', 'eth0', 'A:A', 0, 0, 0, 0, '')
self.driver.delete_link(nctx, 'h10', 'eth0', 'A:A', 0, 0, 0)
self.assertIsNone(self.aim_mgr.get(aim_ctx, expected_hlink10))
if is_svi:
check_svi_paths(None)