Fix privileged create_netns function

In the patch [1] create_netns function from the Neutron's
privileged ip_lib module was changed in the way that it was
implemented in the same way like original pyroute2's create_netns
function.
Unfortunately during backporing that patch to stable/ussuri and
stable/train branches, we probably made mistake and instead of
calling pyroute2's private function _netns() we still called
public function netns() (which we tried to "reimplement" really).

So this patch updates it and changes to use private _netns() function
from pyroute2, in the same way like it is done in the branches newer
than stable/ussuri.

[1] https://review.opendev.org/c/openstack/neutron/+/778735

Related-Bug: #1917487
Change-Id: Id25ca8a67b52393a1c24c9d659189adc9c16a011
(cherry picked from commit abe24c2705)
This commit is contained in:
Slawek Kaplonski 2022-01-10 11:56:58 +01:00
parent 5d6faee55f
commit dc18fb1888

View File

@ -570,7 +570,7 @@ def create_netns(name, **kwargs):
pid = os.fork()
if pid == 0:
try:
netns.create(name, libc=_get_cdll())
netns._create(name, libc=_get_cdll())
except OSError as e:
if e.errno != errno.EEXIST:
os._exit(1)