Merge "Fix re-creation of the pool directory"
This commit is contained in:
commit
4e1ff7bba2
@ -146,7 +146,7 @@ class HaproxyNSDriver(agent_device_driver.AgentDeviceDriver):
|
||||
namespace = get_ns_name(pool_id)
|
||||
root_ns = ip_lib.IPWrapper(self.root_helper)
|
||||
|
||||
socket_path = self._get_state_file_path(pool_id, 'sock')
|
||||
socket_path = self._get_state_file_path(pool_id, 'sock', False)
|
||||
if root_ns.netns.exists(namespace) and os.path.exists(socket_path):
|
||||
try:
|
||||
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||
@ -157,7 +157,7 @@ class HaproxyNSDriver(agent_device_driver.AgentDeviceDriver):
|
||||
return False
|
||||
|
||||
def get_stats(self, pool_id):
|
||||
socket_path = self._get_state_file_path(pool_id, 'sock')
|
||||
socket_path = self._get_state_file_path(pool_id, 'sock', False)
|
||||
TYPE_BACKEND_REQUEST = 2
|
||||
TYPE_SERVER_REQUEST = 4
|
||||
if os.path.exists(socket_path):
|
||||
|
@ -163,7 +163,7 @@ class TestHaproxyNSDriver(base.BaseTestCase):
|
||||
mock.patch('socket.socket'),
|
||||
mock.patch('os.path.exists'),
|
||||
) as (gsp, ip_wrap, socket, path_exists):
|
||||
gsp.side_effect = lambda x, y: '/pool/' + y
|
||||
gsp.side_effect = lambda x, y, z: '/pool/' + y
|
||||
|
||||
ip_wrap.return_value.netns.exists.return_value = True
|
||||
path_exists.return_value = True
|
||||
@ -210,7 +210,7 @@ class TestHaproxyNSDriver(base.BaseTestCase):
|
||||
mock.patch('socket.socket'),
|
||||
mock.patch('os.path.exists'),
|
||||
) as (gsp, socket, path_exists):
|
||||
gsp.side_effect = lambda x, y: '/pool/' + y
|
||||
gsp.side_effect = lambda x, y, z: '/pool/' + y
|
||||
path_exists.return_value = True
|
||||
socket.return_value = socket
|
||||
socket.recv.return_value = raw_stats
|
||||
|
Loading…
x
Reference in New Issue
Block a user