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:
Vu Cong Tuan 2018-03-28 09:31:50 +07:00 committed by Slawek Kaplonski
parent b6a984003d
commit 28f7ab01a6
2 changed files with 1 additions and 10 deletions

View File

@ -17,7 +17,6 @@ import os
import re
import time
from debtcollector import removals
import eventlet
import netaddr
from neutron_lib import constants
@ -264,14 +263,6 @@ class IPWrapper(SubProcessBase):
privileged.create_interface(name, self.namespace, "vxlan", **kwargs)
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):
def __init__(self, name, namespace=None):

View File

@ -79,7 +79,7 @@ class NetnsCleanupTest(base.BaseSudoTestCase):
netns_cleanup.cleanup_network_namespaces(self.conf)
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()
self.assertEqual(procs_after, 0)
self.assertNotIn(l3_namespace, namespaces_now)