Browse Source

Autogenerate path for vhostuserclient socket

Before this patch path to a vhostuserclient socket was hardcodeed in a
kuryr-kubernetes config file. So every new created port was using the
same path. That leaded to a socket-file conflict when more than one
container was intended to use a DPDK-enabled port.

This patch automatically concatenates portname to a socket directory
path, so every port gets a unique vhost-server-path like
"/var/run/vhostuser/vhua5a8d6c0-41"

Change-Id: I9112365585466a126e2653f25aea71ff473c86b8
Signed-off-by: Andrey Zaikin <a.zaikin@partner.samsung.com>
changes/64/711464/17
Andrey Zaikin 2 years ago
parent
commit
172b2562bb
  1. 7
      kuryr_kubernetes/os_vif_util.py
  2. 2
      kuryr_kubernetes/tests/unit/test_os_vif_util.py

7
kuryr_kubernetes/os_vif_util.py

@ -14,6 +14,8 @@
# under the License.
import os
from kuryr.lib._i18n import _
from kuryr.lib.binding.drivers import utils as kl_utils
from kuryr.lib import constants as kl_const
@ -272,6 +274,7 @@ def neutron_to_osvif_vif_ovs(vif_plugin, os_port, subnets):
if not vhostuser_mount_point:
raise oslo_cfg.RequiredOptError('vhostuser_mount_point',
'neutron_defaults')
vif_name = _get_vhu_vif_name(os_port.id)
vif = osv_vif.VIFVHostUser(
id=os_port.id,
address=os_port.mac_address,
@ -281,9 +284,9 @@ def neutron_to_osvif_vif_ovs(vif_plugin, os_port, subnets):
active=_is_port_active(os_port),
port_profile=profile,
plugin='ovs',
path=vhostuser_mount_point,
path=os.path.join(vhostuser_mount_point, vif_name),
mode=vhostuser_mode,
vif_name=_get_vhu_vif_name(os_port.id),
vif_name=vif_name,
bridge_name=network.bridge)
elif details.get('ovs_hybrid_plug'):
vif = osv_vif.VIFBridge(

2
kuryr_kubernetes/tests/unit/test_os_vif_util.py

@ -321,7 +321,7 @@ class TestOSVIFUtils(test_base.TestCase):
port_profile = mock.sentinel.port_profile
network = mock.sentinel.network
port_active = mock.sentinel.port_active
vif_name = mock.sentinel.vif_name
vif_name = "vhu01234567-89"
vif = mock.sentinel.vif
m_mk_profile.return_value = port_profile

Loading…
Cancel
Save