From c82752506e667c6bef676ad8ff1c9dcff2d9629a Mon Sep 17 00:00:00 2001 From: Roey Chen Date: Sun, 9 Jul 2017 04:24:34 -0700 Subject: [PATCH] NSXv: Add a configured delay after enabling ECMP on edge Due to issues on the backend, the plugin must wait between subsequent requests to enable ECMP and BGP, this patch adds a new configuration option 'ecmp_wait_time', which requires an integer value to represent the time in seconds it required to wait after enabling ECMP and before enabling BGP. Change-Id: I8f5b926c149695c2ba3ca895cc8926411fd38583 --- vmware_nsx/common/config.py | 4 ++++ .../plugins/nsx_v/vshield/edge_dynamic_routing_driver.py | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/vmware_nsx/common/config.py b/vmware_nsx/common/config.py index caae9b04a1..f65f6b34bc 100644 --- a/vmware_nsx/common/config.py +++ b/vmware_nsx/common/config.py @@ -671,6 +671,10 @@ nsxv_opts = [ default=1, help=_("(Optional) Set the interval (Seconds) for BGP " "neighbour keep alive time.")), + cfg.IntOpt('ecmp_wait_time', + default=2, + help=_("(Optional) Set the wait time (Seconds) between " + "enablement of ECMP.")), ] # define the configuration of each NSX-V availability zone. diff --git a/vmware_nsx/plugins/nsx_v/vshield/edge_dynamic_routing_driver.py b/vmware_nsx/plugins/nsx_v/vshield/edge_dynamic_routing_driver.py index deb7560693..a21c138414 100644 --- a/vmware_nsx/plugins/nsx_v/vshield/edge_dynamic_routing_driver.py +++ b/vmware_nsx/plugins/nsx_v/vshield/edge_dynamic_routing_driver.py @@ -11,6 +11,9 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. +import time + +from oslo_config import cfg from oslo_log import log as logging from vmware_nsx.common import locking @@ -25,6 +28,7 @@ class EdgeDynamicRoutingDriver(object): def __init__(self): # it will be initialized at subclass self.vcns = None + self.ecmp_wait_time = cfg.CONF.nsxv.ecmp_wait_time def _prepare_bgp_config(self, bgp_config): bgp_config.setdefault('enabled', False) @@ -140,6 +144,8 @@ class EdgeDynamicRoutingDriver(object): self._update_routing_config(edge_id, router_id=prot_router_id, prefixes_to_add=prefixes) + if self.ecmp_wait_time > 0: + time.sleep(self.ecmp_wait_time) self._update_bgp_routing_config( edge_id, enabled=enabled, local_as=local_as, neighbours_to_add=bgp_neighbours, prefixes_to_add=prefixes,