From fcdbebe21c7ce590bb6e321506dcd722ad9f9863 Mon Sep 17 00:00:00 2001 From: Dino Simeon Madarang Date: Wed, 15 Jul 2015 09:22:07 +0100 Subject: vnfs: Enable PVP using vhost-cuse Enable PVP testing using vhost-cuse as guest access method Recent changes: * Move NEWS.md changes to NEWS.rst * Update comment to vhost-cuse * Restore config back to checkout state after make * Merge OPNFV 1092 updates * Add PVP-vhost-cuse to NEWS.md * Add comment/example to GUEST_CORE_BINDING * Move hardcoded values to conf/04_vnfs.conf * Set default VNF to QemuDpdkVhostCuse * Compile eventfd_link if VHOST_USER=n * Use MAC and PCI address from conf * Use vhost method in conf to properly set interface type JIRA: VSPERF-59 Change-Id: Ib1159e216f3e25b9971c0935969680582683916b Signed-off-by: Madarang, Dino Simeon Reviewed-by: Maryam Tahhan --- vswitches/ovs_dpdk_vhost.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'vswitches') diff --git a/vswitches/ovs_dpdk_vhost.py b/vswitches/ovs_dpdk_vhost.py index 3ff41260..ee0939a4 100644 --- a/vswitches/ovs_dpdk_vhost.py +++ b/vswitches/ovs_dpdk_vhost.py @@ -15,6 +15,7 @@ """VSPERF VSwitch implementation using DPDK and vhost ports """ +import logging from conf import settings from vswitches.vswitch import IVSwitch from src.ovs import VSwitchd, OFBridge @@ -33,11 +34,17 @@ class OvsDpdkVhost(IVSwitch): implementation. For generic information of the nature of the methods, see the interface. """ + + _logger = logging.getLogger() + def __init__(self): vswitchd_args = ['--dpdk'] vswitchd_args += settings.getValue('VSWITCHD_DPDK_ARGS') vswitchd_args += _VSWITCHD_CONST_ARGS + self._logger.info("Inserting VHOST modules into kernel...") + dpdk.insert_vhost_modules() + self._vswitchd = VSwitchd(vswitchd_args=vswitchd_args, expected_cmd= r'EAL: Master l*core \d+ is ready') @@ -58,6 +65,7 @@ class OvsDpdkVhost(IVSwitch): """ self._vswitchd.kill() dpdk.cleanup() + dpdk.remove_vhost_modules() def add_switch(self, switch_name): """See IVswitch for general description @@ -100,9 +108,16 @@ class OvsDpdkVhost(IVSwitch): """ bridge = self._bridges[switch_name] # Changed dpdkvhost to dpdkvhostuser to be able to run in Qemu 2.2 - vhost_count = self._get_port_count(bridge, 'type=dpdkvhostuser') - port_name = 'dpdkvhostuser' + str(vhost_count) - params = ['--', 'set', 'Interface', port_name, 'type=dpdkvhostuser'] + vhost_method = settings.getValue('VHOST_METHOD') + if vhost_method == "cuse": + vhost_count = self._get_port_count(bridge, 'type=dpdkvhostcuse') + port_name = 'dpdkvhostcuse' + str(vhost_count) + params = ['--', 'set', 'Interface', port_name, 'type=dpdkvhostcuse'] + else: + vhost_count = self._get_port_count(bridge, 'type=dpdkvhostuser') + port_name = 'dpdkvhostuser' + str(vhost_count) + params = ['--', 'set', 'Interface', port_name, 'type=dpdkvhostuser'] + of_port = bridge.add_port(port_name, params) return (port_name, of_port) -- cgit