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
|
last_used_vrf_table = t
|
||||||
self.last_used_vrf_table = last_used_vrf_table
|
self.last_used_vrf_table = last_used_vrf_table
|
||||||
self._iproute2_vrf_map_initialized = True
|
self._iproute2_vrf_map_initialized = True
|
||||||
|
self.vrf_count = len(self.iproute2_vrf_map)
|
||||||
|
|
||||||
def _iproute2_vrf_map_sync_to_disk(self):
|
def _iproute2_vrf_map_sync_to_disk(self):
|
||||||
if not self.iproute2_vrf_map_sync_to_disk:
|
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'
|
self.iproute2_vrf_map_fd.write('%s %s\n'
|
||||||
%(table_id, vrf_dev_name))
|
%(table_id, vrf_dev_name))
|
||||||
self.iproute2_vrf_map_fd.flush()
|
self.iproute2_vrf_map_fd.flush()
|
||||||
|
self.vrf_count += 1
|
||||||
return
|
return
|
||||||
|
|
||||||
if old_vrf_name != vrf_dev_name:
|
if old_vrf_name != vrf_dev_name:
|
||||||
@@ -487,6 +489,10 @@ class vrf(moduleBase):
|
|||||||
|
|
||||||
def _create_vrf_dev(self, ifaceobj, vrf_table):
|
def _create_vrf_dev(self, ifaceobj, vrf_table):
|
||||||
if not self.ipcmd.link_exists(ifaceobj.name):
|
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':
|
if vrf_table == 'auto':
|
||||||
vrf_table = self._get_avail_vrf_table_id()
|
vrf_table = self._get_avail_vrf_table_id()
|
||||||
if not vrf_table:
|
if not vrf_table:
|
||||||
@@ -637,10 +643,6 @@ class vrf(moduleBase):
|
|||||||
if vrf_table:
|
if vrf_table:
|
||||||
self._iproute2_vrf_map_initialize()
|
self._iproute2_vrf_map_initialize()
|
||||||
# This is a vrf device
|
# 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)
|
self._up_vrf_dev(ifaceobj, vrf_table, True, ifaceobj_getfunc)
|
||||||
else:
|
else:
|
||||||
vrf = ifaceobj.get_attr_value_first('vrf')
|
vrf = ifaceobj.get_attr_value_first('vrf')
|
||||||
|
@@ -112,6 +112,8 @@ class ifupdownMain(ifupdownBase):
|
|||||||
# there is no real interface behind it
|
# there is no real interface behind it
|
||||||
if ifaceobj.type == ifaceType.BRIDGE_VLAN:
|
if ifaceobj.type == ifaceType.BRIDGE_VLAN:
|
||||||
return
|
return
|
||||||
|
if ifaceobj.link_kind & ifaceLinkKind.VRF:
|
||||||
|
return
|
||||||
if (ifaceobj.addr_method and
|
if (ifaceobj.addr_method and
|
||||||
ifaceobj.addr_method == 'manual'):
|
ifaceobj.addr_method == 'manual'):
|
||||||
return
|
return
|
||||||
|
Reference in New Issue
Block a user