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
This commit is contained in:
Rodolfo Alonso Hernandez 2020-04-23 09:42:44 +00:00
parent 4e5d392a8f
commit 68e5e1b8fe
3 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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()

View File

@ -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