Add container_id to connect method of BaseBindingDriver

container_id is necessary for VHostUserDriver, binding driver
writes its configuration to file which contains part of container id,
to be able to distinguish conf files inside containers (for case when
vhostuser socket dir mounted to several pods).

Partially-Implements: support-vhost-user-port-type-on-bm-installation
Change-Id: I328585dc6d596371d8511a3cb5ccef907d955c76
Signed-off-by: Alexey Perevalov <a.perevalov@samsung.com>
This commit is contained in:
Alexey Perevalov
2018-08-28 03:39:06 -04:00
parent 3086c34c0f
commit 0478a47502
6 changed files with 31 additions and 23 deletions

View File

@@ -45,7 +45,8 @@ class TestK8sCNIRegistryPlugin(base.TestCase):
m_lock.assert_called_with('default/foo', external=True)
m_connect.assert_called_with(mock.ANY, mock.ANY, 'eth0', 123,
report_health=mock.ANY,
is_default_gateway=mock.ANY)
is_default_gateway=mock.ANY,
container_id='cont_id')
self.assertEqual('cont_id',
self.plugin.registry['default/foo']['containerid'])
@@ -55,7 +56,8 @@ class TestK8sCNIRegistryPlugin(base.TestCase):
m_disconnect.assert_called_with(mock.ANY, mock.ANY, 'eth0', 123,
report_health=mock.ANY,
is_default_gateway=mock.ANY)
is_default_gateway=mock.ANY,
container_id='cont_id')
@mock.patch('kuryr_kubernetes.cni.binding.base.disconnect')
def test_del_wrong_container_id(self, m_disconnect):
@@ -88,7 +90,8 @@ class TestK8sCNIRegistryPlugin(base.TestCase):
'containerid': 'cont_id'})
m_connect.assert_called_with(mock.ANY, mock.ANY, 'eth0', 123,
report_health=mock.ANY,
is_default_gateway=mock.ANY)
is_default_gateway=mock.ANY,
container_id='cont_id')
@mock.patch('time.sleep', mock.Mock())
def test_add_not_present(self):