1
0
mirror of https://github.com/CumulusNetworks/ifupdown2.git synced 2024-05-06 15:54:50 +00:00

break down the bridge port batch add in ifupdown2

Ticket:  CM-6496
Reviewed By: CCR-3196
Testing Done:

The "ip batch command to add a bridge port and flush the dev" command with 1k netdevices was taking 1.4G of memory. With 2k netdevices batch, this command was causing a OOM condition. To avoid this, commit the batch after 250 ports. Ideally we have to look at the internal batch implementation to see if there is an underlying issue.
This commit is contained in:
Satish Ashok
2015-07-30 15:01:24 -07:00
parent 4dcac660c2
commit 34cdd4a39c

View File

@@ -311,6 +311,7 @@ class bridge(moduleBase):
self.ipcmd.batch_commit() self.ipcmd.batch_commit()
return return
err = 0 err = 0
ports = 0
for bridgeport in Set(bridgeports).difference(Set(runningbridgeports)): for bridgeport in Set(bridgeports).difference(Set(runningbridgeports)):
try: try:
if not self.DRYRUN and not self.ipcmd.link_exists(bridgeport): if not self.DRYRUN and not self.ipcmd.link_exists(bridgeport):
@@ -326,6 +327,11 @@ class bridge(moduleBase):
continue continue
self.ipcmd.link_set(bridgeport, 'master', ifaceobj.name) self.ipcmd.link_set(bridgeport, 'master', ifaceobj.name)
self.ipcmd.addr_flush(bridgeport) self.ipcmd.addr_flush(bridgeport)
ports += 1
if ports == 250:
ports = 0
self.ipcmd.batch_commit()
self.ipcmd.batch_start()
except Exception, e: except Exception, e:
self.logger.error(str(e)) self.logger.error(str(e))
pass pass