From 68e5e1b8fe87b0b4938236f8f8570d92ae044e20 Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Hernandez Date: Thu, 23 Apr 2020 09:42:44 +0000 Subject: [PATCH] Specify C shared library in Pyroute2 namespace context Since [1], it's possible to specify the shared library to be used when creating a Pyroute2 namespace context. As commented in [2], "privsep" library makes use of eventlet to implement multitasking. If the method executed returns the GIL, nothing guarantees that the "eventlet" executor will return it again to this task. This could lead to timeouts during the execution of those methods. From https://docs.python.org/3.6/library/ctypes.html#ctypes.PyDLL: "Instances of this class behave like CDLL instances, except that the Python GIL is not released during the function call, and after the function execution the Python error flag is checked." [1]https://github.com/svinota/pyroute2/issues/702 [2]https://review.opendev.org/#/c/717017/ Change-Id: I6c9f9adba8b4433cc96704bb69dd4e0d4b154ebd Related-Bug: #1870352 --- lower-constraints.txt | 2 +- neutron/privileged/agent/linux/ip_lib.py | 2 +- requirements.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lower-constraints.txt b/lower-constraints.txt index 5b6d6d9da52..84b22499782 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -98,7 +98,7 @@ PyMySQL==0.7.6 pyOpenSSL==17.1.0 pyparsing==2.1.0 pyperclip==1.5.27 -pyroute2==0.5.7 +pyroute2==0.5.13 python-dateutil==2.5.3 python-designateclient==2.7.0 python-editor==1.0.3 diff --git a/neutron/privileged/agent/linux/ip_lib.py b/neutron/privileged/agent/linux/ip_lib.py index 5e62385d9e6..a9fcaa20204 100644 --- a/neutron/privileged/agent/linux/ip_lib.py +++ b/neutron/privileged/agent/linux/ip_lib.py @@ -190,7 +190,7 @@ def get_iproute(namespace): # `NetNS` -- RTNL API to another network namespace if namespace: # do not try and create the namespace - return pyroute2.NetNS(namespace, flags=0) + return pyroute2.NetNS(namespace, flags=0, libc=priv_linux.get_cdll()) else: return pyroute2.IPRoute() diff --git a/requirements.txt b/requirements.txt index 2a3f4e9e596..d086c38bcaa 100644 --- a/requirements.txt +++ b/requirements.txt @@ -48,7 +48,7 @@ os-ken >= 0.3.0 # Apache-2.0 ovs>=2.8.0 # Apache-2.0 ovsdbapp>=1.0.0 # Apache-2.0 psutil>=3.2.2 # BSD -pyroute2>=0.5.7;sys_platform!='win32' # Apache-2.0 (+ dual licensed GPL2) +pyroute2>=0.5.13;sys_platform!='win32' # Apache-2.0 (+ dual licensed GPL2) pyOpenSSL>=17.1.0 # Apache-2.0 python-novaclient>=9.1.0 # Apache-2.0