From 53d19a9c0844ad9e6426e38382302dde0ebf454b Mon Sep 17 00:00:00 2001 From: Ivar Lazzaro Date: Tue, 17 Apr 2018 14:36:31 -0700 Subject: [PATCH] [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 --- .../ml2plus/drivers/apic_aim/mechanism_driver.py | 14 ++++++++------ .../tests/unit/plugins/ml2plus/test_apic_aim.py | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/gbpservice/neutron/plugins/ml2plus/drivers/apic_aim/mechanism_driver.py b/gbpservice/neutron/plugins/ml2plus/drivers/apic_aim/mechanism_driver.py index 59fcfa7a1..4f847e45a 100644 --- a/gbpservice/neutron/plugins/ml2plus/drivers/apic_aim/mechanism_driver.py +++ b/gbpservice/neutron/plugins/ml2plus/drivers/apic_aim/mechanism_driver.py @@ -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 diff --git a/gbpservice/neutron/tests/unit/plugins/ml2plus/test_apic_aim.py b/gbpservice/neutron/tests/unit/plugins/ml2plus/test_apic_aim.py index f69edd25e..7eefde584 100644 --- a/gbpservice/neutron/tests/unit/plugins/ml2plus/test_apic_aim.py +++ b/gbpservice/neutron/tests/unit/plugins/ml2plus/test_apic_aim.py @@ -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)