Removing deprecated function 'IPWrapper.get_namespaces()'
'IPWrapper.get_namespaces()' is deprecated in version 'Queens' and was marked to be removed 'Rocky'. This patch removes it and switches to use 'neutron.agent.linux.ip_lib.list_network_namespaces' instead. Change-Id: I090cc5841aca5b638d08d65645162811950d6437 Depends-On: Id629481fd722004a7b7d827bf6209785f85f4c64
This commit is contained in:
parent
b6a984003d
commit
28f7ab01a6
|
@ -17,7 +17,6 @@ import os
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from debtcollector import removals
|
|
||||||
import eventlet
|
import eventlet
|
||||||
import netaddr
|
import netaddr
|
||||||
from neutron_lib import constants
|
from neutron_lib import constants
|
||||||
|
@ -264,14 +263,6 @@ class IPWrapper(SubProcessBase):
|
||||||
privileged.create_interface(name, self.namespace, "vxlan", **kwargs)
|
privileged.create_interface(name, self.namespace, "vxlan", **kwargs)
|
||||||
return (IPDevice(name, namespace=self.namespace))
|
return (IPDevice(name, namespace=self.namespace))
|
||||||
|
|
||||||
@removals.remove(version='Queens', removal_version='Rocky',
|
|
||||||
message="This will be removed in the future. Please use "
|
|
||||||
"'neutron.agent.linux.ip_lib."
|
|
||||||
"list_network_namespaces' instead.")
|
|
||||||
@classmethod
|
|
||||||
def get_namespaces(cls):
|
|
||||||
return list_network_namespaces()
|
|
||||||
|
|
||||||
|
|
||||||
class IPDevice(SubProcessBase):
|
class IPDevice(SubProcessBase):
|
||||||
def __init__(self, name, namespace=None):
|
def __init__(self, name, namespace=None):
|
||||||
|
|
|
@ -79,7 +79,7 @@ class NetnsCleanupTest(base.BaseSudoTestCase):
|
||||||
netns_cleanup.cleanup_network_namespaces(self.conf)
|
netns_cleanup.cleanup_network_namespaces(self.conf)
|
||||||
|
|
||||||
self.get_namespaces_p.stop()
|
self.get_namespaces_p.stop()
|
||||||
namespaces_now = ip_lib.IPWrapper.get_namespaces()
|
namespaces_now = ip_lib.list_network_namespaces()
|
||||||
procs_after = self._get_num_spawned_procs()
|
procs_after = self._get_num_spawned_procs()
|
||||||
self.assertEqual(procs_after, 0)
|
self.assertEqual(procs_after, 0)
|
||||||
self.assertNotIn(l3_namespace, namespaces_now)
|
self.assertNotIn(l3_namespace, namespaces_now)
|
||||||
|
|
Loading…
Reference in New Issue