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
This commit is contained in:
Roey Chen 2017-07-09 04:24:34 -07:00
parent 32e3f9b704
commit c82752506e
2 changed files with 10 additions and 0 deletions

View File

@ -671,6 +671,10 @@ nsxv_opts = [
default=1, default=1,
help=_("(Optional) Set the interval (Seconds) for BGP " help=_("(Optional) Set the interval (Seconds) for BGP "
"neighbour keep alive time.")), "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. # define the configuration of each NSX-V availability zone.

View File

@ -11,6 +11,9 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import time
from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
from vmware_nsx.common import locking from vmware_nsx.common import locking
@ -25,6 +28,7 @@ class EdgeDynamicRoutingDriver(object):
def __init__(self): def __init__(self):
# it will be initialized at subclass # it will be initialized at subclass
self.vcns = None self.vcns = None
self.ecmp_wait_time = cfg.CONF.nsxv.ecmp_wait_time
def _prepare_bgp_config(self, bgp_config): def _prepare_bgp_config(self, bgp_config):
bgp_config.setdefault('enabled', False) bgp_config.setdefault('enabled', False)
@ -140,6 +144,8 @@ class EdgeDynamicRoutingDriver(object):
self._update_routing_config(edge_id, self._update_routing_config(edge_id,
router_id=prot_router_id, router_id=prot_router_id,
prefixes_to_add=prefixes) prefixes_to_add=prefixes)
if self.ecmp_wait_time > 0:
time.sleep(self.ecmp_wait_time)
self._update_bgp_routing_config( self._update_bgp_routing_config(
edge_id, enabled=enabled, local_as=local_as, edge_id, enabled=enabled, local_as=local_as,
neighbours_to_add=bgp_neighbours, prefixes_to_add=prefixes, neighbours_to_add=bgp_neighbours, prefixes_to_add=prefixes,