Fix memory leak in the haproxy provider driver
The haproxy provider driver uses a dict for caching load balancer resources (including children resources). That alone already increases memory consumption. A neutron-server restart solves this. But the real issue is that the driver leaves some data behind when a LB is deleted without freeing it up (unless neutron-server is restart) hence the memory leak. Story: 2003802 Task: 26534 Change-Id: I7c79271998d839c6afbeb6d92f888f6acd67704e
This commit is contained in:
parent
28ede08e8c
commit
111d0b2852
|
@ -178,6 +178,9 @@ class HaproxyNSDriver(agent_device_driver.AgentDeviceDriver):
|
|||
ns = ip_lib.IPWrapper(namespace=namespace)
|
||||
ns.garbage_collect_namespace()
|
||||
|
||||
if loadbalancer_id in self.deployed_loadbalancers:
|
||||
del self.deployed_loadbalancers[loadbalancer_id]
|
||||
|
||||
def remove_orphans(self, known_loadbalancer_ids):
|
||||
if not os.path.exists(self.state_path):
|
||||
return
|
||||
|
|
|
@ -108,6 +108,7 @@ class TestHaproxyNSDriver(base.BaseTestCase):
|
|||
namespace=ns)
|
||||
mock_shutil.assert_called_once_with('/path/' + self.lb.id)
|
||||
mock_ns.garbage_collect_namespace.assert_called_once_with()
|
||||
self.assertDictEqual(self.driver.deployed_loadbalancers, {})
|
||||
|
||||
@mock.patch('os.makedirs')
|
||||
@mock.patch('os.path.dirname')
|
||||
|
|
Loading…
Reference in New Issue