mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
addons: vrf: fix check for max vrf dev count
Ticket: CM-10465 Reviewed By: julien, nikhil Testing Done: Tested creating more than 64 vrf devices example config: {noformat} %for v in range(1, 66): auto vrf${v} iface vrf${v} vrf-table auto %endfor {noformat} also, since vrf module already does a link up on vrf dev, remove link up of vrf dev from ifupdownmain scheduler callback
This commit is contained in:
@@ -158,6 +158,7 @@ class vrf(moduleBase):
|
||||
last_used_vrf_table = t
|
||||
self.last_used_vrf_table = last_used_vrf_table
|
||||
self._iproute2_vrf_map_initialized = True
|
||||
self.vrf_count = len(self.iproute2_vrf_map)
|
||||
|
||||
def _iproute2_vrf_map_sync_to_disk(self):
|
||||
if not self.iproute2_vrf_map_sync_to_disk:
|
||||
@@ -248,6 +249,7 @@ class vrf(moduleBase):
|
||||
self.iproute2_vrf_map_fd.write('%s %s\n'
|
||||
%(table_id, vrf_dev_name))
|
||||
self.iproute2_vrf_map_fd.flush()
|
||||
self.vrf_count += 1
|
||||
return
|
||||
|
||||
if old_vrf_name != vrf_dev_name:
|
||||
@@ -487,6 +489,10 @@ class vrf(moduleBase):
|
||||
|
||||
def _create_vrf_dev(self, ifaceobj, vrf_table):
|
||||
if not self.ipcmd.link_exists(ifaceobj.name):
|
||||
if self.vrf_count == self.vrf_max_count:
|
||||
self.log_error('%s: max vrf count %d hit...not '
|
||||
'creating vrf' %(ifaceobj.name,
|
||||
self.vrf_count))
|
||||
if vrf_table == 'auto':
|
||||
vrf_table = self._get_avail_vrf_table_id()
|
||||
if not vrf_table:
|
||||
@@ -637,10 +643,6 @@ class vrf(moduleBase):
|
||||
if vrf_table:
|
||||
self._iproute2_vrf_map_initialize()
|
||||
# This is a vrf device
|
||||
if self.vrf_count == self.vrf_max_count:
|
||||
self.log_error('%s: max vrf count %d hit...not '
|
||||
'creating vrf' %(ifaceobj.name,
|
||||
self.vrf_count))
|
||||
self._up_vrf_dev(ifaceobj, vrf_table, True, ifaceobj_getfunc)
|
||||
else:
|
||||
vrf = ifaceobj.get_attr_value_first('vrf')
|
||||
|
Reference in New Issue
Block a user