Skip to content

Instantly share code, notes, and snippets.

@gerhardqux
Created October 3, 2017 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gerhardqux/c36bdebd825d00ff10e7b30d7df8401f to your computer and use it in GitHub Desktop.
Save gerhardqux/c36bdebd825d00ff10e7b30d7df8401f to your computer and use it in GitHub Desktop.
Back off a little when the load on the networker is high.
diff --git a/neutron/agent/l3/agent.py b/neutron/agent/l3/agent.py
index 20d885fe8..603998dad 100644
--- a/neutron/agent/l3/agent.py
+++ b/neutron/agent/l3/agent.py
@@ -13,6 +13,7 @@
# under the License.
#
+import os
import eventlet
import netaddr
from neutron_lib import constants as lib_const
@@ -483,6 +484,10 @@ class L3NATAgent(ha.AgentMixin,
def _process_router_update(self):
for rp, update in self._queue.each_update_to_next_router():
+ if os.getloadavg()[0] > 30:
+ LOG.warn('Loadavg is higher than 30, sleep 30 seconds.')
+ eventlet.sleep(30)
+
LOG.debug("Starting router update for %s, action %s, priority %s",
update.id, update.action, update.priority)
if update.action == queue.PD_UPDATE:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment