The ensure_namespace method calls IpNetnsCommand.exists to
determine if the specified namespace exists or not. This is
accomplished by listing all namespaces with "ip netns list"
and then looping through the output to determine if the specified
namespace was included in the output.
Research of various Linux operating systems has indicated that
namespaces are represented as files in /var/run/netns and root
authority is "typically" not required in order to look at the
files in this subdirectory.
The existing configuration option "use_helper_for_ns_read"
will be used to determine if the root-helper should be used to
to retrieve the list of namespaces. If this configuraton option
is set to False, the native python os.listdir(/var/run/netns)
will be used.
Reviewed: https:/ /review. openstack. org/227589 /git.openstack. org/cgit/ openstack/ neutron/ commit/ ?id=81823e86328 e62850a89aef9f0 b609bfc0a6dacd
Committed: https:/
Submitter: Jenkins
Branch: master
commit 81823e86328e628 50a89aef9f0b609 bfc0a6dacd
Author: John Kasperski <email address hidden>
Date: Thu Sep 24 18:16:18 2015 -0500
Improve performance of ensure_namespace
The ensure_namespace method calls IpNetnsCommand. exists to
determine if the specified namespace exists or not. This is
accomplished by listing all namespaces with "ip netns list"
and then looping through the output to determine if the specified
namespace was included in the output.
Research of various Linux operating systems has indicated that
namespaces are represented as files in /var/run/netns and root
authority is "typically" not required in order to look at the
files in this subdirectory.
The existing configuration option "use_helper_ for_ns_ read" /var/run/ netns)
will be used to determine if the root-helper should be used to
to retrieve the list of namespaces. If this configuraton option
is set to False, the native python os.listdir(
will be used.
Related-Bug: #1311804 6e5ef1a921a5f22 963317a04e2
Closes-Bug: #1497396
Change-Id: I9da627d07d6cbb