From 0e0cf38fcd1ff704293c9dd2c7a05f8682e11de9 Mon Sep 17 00:00:00 2001 From: Peter Mikus Date: Sat, 13 Apr 2019 06:15:25 +0000 Subject: Remove obsolete QEMU installation +Unify QEMU parameter to Contants. Change-Id: I95adfc97dd7008c19e60ba3fa8668818b503bee8 Signed-off-by: Peter Mikus --- .../bash/qemu_patches/qemu-2.5.0/01-qsz1024 | 16 --- resources/libraries/python/Constants.py | 19 ++- resources/libraries/python/QemuManager.py | 2 +- resources/libraries/python/QemuUtils.py | 46 +------ .../performance/performance_configuration.robot | 141 --------------------- 5 files changed, 14 insertions(+), 210 deletions(-) delete mode 100755 resources/libraries/bash/qemu_patches/qemu-2.5.0/01-qsz1024 (limited to 'resources') diff --git a/resources/libraries/bash/qemu_patches/qemu-2.5.0/01-qsz1024 b/resources/libraries/bash/qemu_patches/qemu-2.5.0/01-qsz1024 deleted file mode 100755 index 6f5831dc8d..0000000000 --- a/resources/libraries/bash/qemu_patches/qemu-2.5.0/01-qsz1024 +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -patch hw/net/virtio-net.c <<"_EOF" -1333c1333 -< n->vqs[index].rx_vq = virtio_add_queue(vdev, 256, virtio_net_handle_rx); ---- -> n->vqs[index].rx_vq = virtio_add_queue(vdev, 1024, virtio_net_handle_rx); -1336c1336 -< virtio_add_queue(vdev, 256, virtio_net_handle_tx_timer); ---- -> virtio_add_queue(vdev, 1024, virtio_net_handle_tx_timer); -1342c1342 -< virtio_add_queue(vdev, 256, virtio_net_handle_tx_bh); ---- -> virtio_add_queue(vdev, 1024, virtio_net_handle_tx_bh); -_EOF diff --git a/resources/libraries/python/Constants.py b/resources/libraries/python/Constants.py index 8a22a4288d..71673aff86 100644 --- a/resources/libraries/python/Constants.py +++ b/resources/libraries/python/Constants.py @@ -40,20 +40,17 @@ class Constants(object): # VPP service unit name VPP_UNIT = 'vpp' - # QEMU version to install - QEMU_INSTALL_VERSION = 'qemu-2.11.2' + # QEMU binary path + QEMU_BIN_PATH = '/usr/bin' - # QEMU install directory - QEMU_INSTALL_DIR = '/opt/qemu-2.11.2' + # QEMU VM kernel image path + QEMU_VM_KERNEL = '/opt/boot/vmlinuz' - # QEMU performance test VM kernel image path - QEMU_PERF_VM_KERNEL = '/opt/boot/vmlinuz' + # QEMU VM nested image path + QEMU_VM_IMAGE = '/var/lib/vm/vhost-nested.img' - # QEMU performance test VM nested image path - QEMU_PERF_VM_IMAGE = '/var/lib/vm/csit-nested-1.7.img' - - # QEMU performance test VM DPDK path - QEMU_PERF_VM_DPDK = '/opt/dpdk-19.02' + # QEMU VM DPDK path + QEMU_VM_DPDK = '/opt/dpdk-19.02' # TRex install version TREX_INSTALL_VERSION = '2.35' diff --git a/resources/libraries/python/QemuManager.py b/resources/libraries/python/QemuManager.py index 55c282bc24..0ea6164cb7 100644 --- a/resources/libraries/python/QemuManager.py +++ b/resources/libraries/python/QemuManager.py @@ -100,7 +100,7 @@ class QemuManager(object): cpu_count_int = kwargs['cpu_count_int'] vnf_count_int = kwargs['cpu_count_int'] if kwargs['auto_scale'] else 1 - img = Constants.QEMU_PERF_VM_KERNEL + img = Constants.QEMU_VM_KERNEL for nf_chain in range(1, nf_chains + 1): for nf_node in range(1, nf_nodes + 1): diff --git a/resources/libraries/python/QemuUtils.py b/resources/libraries/python/QemuUtils.py index 193390c46d..55da28a289 100644 --- a/resources/libraries/python/QemuUtils.py +++ b/resources/libraries/python/QemuUtils.py @@ -83,7 +83,7 @@ class QemuUtils(object): ROBOT_LIBRARY_SCOPE = 'TEST CASE' def __init__(self, node, qemu_id=1, smp=1, mem=512, vnf=None, - img='/var/lib/vm/vhost-nested.img', bin_path='/usr/bin'): + img=Constants.QEMU_VM_IMAGE): """Initialize QemuUtil class. :param node: Node to run QEMU on. @@ -92,14 +92,12 @@ class QemuUtils(object): :param mem: Amount of memory. :param vnf: Network function workload. :param img: QEMU disk image or kernel image path. - :param bin_path: QEMU binary path. :type node: dict :type qemu_id: int :type smp: int :type mem: int :type vnf: str :type img: str - :type bin_path: str """ self._vhost_id = 0 self._node = node @@ -119,7 +117,6 @@ class QemuUtils(object): # Input Options. self._opt = dict() self._opt['qemu_id'] = qemu_id - self._opt['bin_path'] = bin_path self._opt['mem'] = int(mem) self._opt['smp'] = int(smp) self._opt['img'] = img @@ -272,7 +269,7 @@ class QemuUtils(object): :type kwargs: dict """ testpmd_path = ('{path}/{arch}-native-linuxapp-gcc/app'. - format(path=Constants.QEMU_PERF_VM_DPDK, + format(path=Constants.QEMU_VM_DPDK, arch=Topology.get_node_arch(self._node))) testpmd_cmd = DpdkUtil.get_testpmd_cmdline( eal_corelist='0-{smp}'.format(smp=self._opt.get('smp') - 1), @@ -297,7 +294,7 @@ class QemuUtils(object): :type kwargs: dict """ testpmd_path = ('{path}/{arch}-native-linuxapp-gcc/app'. - format(path=Constants.QEMU_PERF_VM_DPDK, + format(path=Constants.QEMU_VM_DPDK, arch=Topology.get_node_arch(self._node))) testpmd_cmd = DpdkUtil.get_testpmd_cmdline( eal_corelist='0-{smp}'.format(smp=self._opt.get('smp') - 1), @@ -638,7 +635,7 @@ class QemuUtils(object): :rtype: dict """ command = ('{bin_path}/qemu-system-{arch} {params}'. - format(bin_path=self._opt.get('bin_path'), + format(bin_path=Constants.QEMU_BIN_PATH, arch=Topology.get_node_arch(self._node), params=self._params)) message = ('QEMU: Start failed on {host}!'. @@ -683,7 +680,7 @@ class QemuUtils(object): :rtype: str or bool """ command = ('{bin_path}/qemu-system-{arch} --version'. - format(bin_path=self._opt.get('bin_path'), + format(bin_path=Constants.QEMU_BIN_PATH, arch=Topology.get_node_arch(self._node))) try: stdout, _ = exec_cmd_no_error(self._node, command, sudo=True) @@ -693,36 +690,3 @@ class QemuUtils(object): except RuntimeError: self.qemu_kill_all() raise - - @staticmethod - def build_qemu(node, force_install=False, apply_patch=False): - """Build QEMU from sources. - - :param node: Node to build QEMU on. - :param force_install: If True, then remove previous build. - :param apply_patch: If True, then apply patches from qemu_patches dir. - :type node: dict - :type force_install: bool - :type apply_patch: bool - :raises RuntimeError: If building QEMU failed. - """ - directory = (' --directory={install_dir}{patch}'. - format(install_dir=Constants.QEMU_INSTALL_DIR, - patch='-patch' if apply_patch else '-base')) - version = (' --version={install_version}'. - format(install_version=Constants.QEMU_INSTALL_VERSION)) - force = ' --force' if force_install else '' - patch = ' --patch' if apply_patch else '' - target_list = (' --target-list={arch}-softmmu'. - format(arch=Topology.get_node_arch(node))) - - command = ("sudo -E sh -c " - "'{fw_dir}/{lib_sh}/qemu_build.sh{version}{directory}" - "{force}{patch}{target_list}'". - format(fw_dir=Constants.REMOTE_FW_DIR, - lib_sh=Constants.RESOURCES_LIB_SH, - version=version, directory=directory, force=force, - patch=patch, target_list=target_list)) - message = ('QEMU: Build failed on {host}!'.format(host=node['host'])) - exec_cmd_no_error(node, command, sudo=False, message=message, - timeout=1000) diff --git a/resources/libraries/robot/performance/performance_configuration.robot b/resources/libraries/robot/performance/performance_configuration.robot index edb3a9191e..d9f5e3ab59 100644 --- a/resources/libraries/robot/performance/performance_configuration.robot +++ b/resources/libraries/robot/performance/performance_configuration.robot @@ -2343,17 +2343,12 @@ | | ... | ${qemu_id}=${1} | ${jumbo}=${False} | ${perf_qemu_qsz}=${1024} | | ... | ${use_tuned_cfs}=${False} | ${auto_scale}=${True} | | ... -| | ${apply_patch}= | Set Variable | ${False} -| | ${perf_qemu_path}= | Set Variable If | ${apply_patch} -| | ... | ${perf_qemu_path}-patch/bin -| | ... | ${perf_qemu_path}-base/bin | | ${nf_cpus_count}= | Get Length | ${nf_cpus} | | ${rxq}= | Run Keyword If | ${auto_scale} == ${True} | | ... | Set Variable | ${rxq_count_int} | | ... | ELSE | Set Variable | ${1} | | Import Library | resources.libraries.python.QemuUtils | ${nodes['${dut}']} | | ... | qemu_id=${qemu_id} | smp=${nf_cpus_count} | mem=${2048} -| | ... | img=${perf_vm_image} | bin_path=${perf_qemu_path} | | ... | WITH NAME | ${vm_name} | | Run Keyword | ${vm_name}.Qemu Add Vhost User If | ${sock1} | | ... | jumbo_frames=${jumbo} | queues=${rxq_count_int} @@ -2361,8 +2356,6 @@ | | Run Keyword | ${vm_name}.Qemu Add Vhost User If | ${sock2} | | ... | jumbo_frames=${jumbo} | queues=${rxq_count_int} | | ... | queue_size=${perf_qemu_qsz} -| | Run Keyword If | ${qemu_build} | ${vm_name}.Build QEMU | ${nodes['${dut}']} -| | ... | apply_patch=${apply_patch} | | ${vm}= | Run Keyword | ${vm_name}.Qemu Start | | Run Keyword | ${vm_name}.Qemu Set Affinity | @{nf_cpus} | | Run Keyword If | ${use_tuned_cfs} | ${vm_name}.Qemu Set Scheduler Policy @@ -2482,17 +2475,12 @@ | | ... | ${jumbo}=${False} | ${perf_qemu_qsz}=${1024} | | ... | ${use_tuned_cfs}=${False} | ${auto_scale}=${True} | | ... -| | ${apply_patch}= | Set Variable | ${False} -| | ${perf_qemu_path}= | Set Variable If | ${apply_patch} -| | ... | ${perf_qemu_path}-patch/bin -| | ... | ${perf_qemu_path}-base/bin | | ${nf_cpus_count}= | Get Length | ${nf_cpus} | | ${rxq}= | Run Keyword If | ${auto_scale} == ${True} | | ... | Set Variable | ${rxq_count_int} | | ... | ELSE | Set Variable | ${1} | | Import Library | resources.libraries.python.QemuUtils | ${nodes['${dut}']} | | ... | qemu_id=${qemu_id} | smp=${nf_cpus_count} | mem=${2048} -| | ... | img=${perf_vm_image} | bin_path=${perf_qemu_path} | | ... | WITH NAME | ${vm_name} | | Run keyword | ${vm_name}.Qemu Add Vhost User If | ${sock1} | | ... | jumbo_frames=${jumbo} | queues=${rxq_count_int} @@ -2500,8 +2488,6 @@ | | Run keyword | ${vm_name}.Qemu Add Vhost User If | ${sock2} | | ... | jumbo_frames=${jumbo} | queues=${rxq_count_int} | | ... | queue_size=${perf_qemu_qsz} -| | Run Keyword If | ${qemu_build} | ${vm_name}.Build QEMU | ${nodes['${dut}']} -| | ... | apply_patch=${False} | | ${vm}= | Run keyword | ${vm_name}.Qemu Start | | Run keyword | ${vm_name}.Qemu Set Affinity | @{nf_cpus} | | Run keyword If | ${use_tuned_cfs} | ${vm_name}.Qemu Set Scheduler Policy @@ -2587,133 +2573,6 @@ | | All VPP Interfaces Ready Wait | ${nodes} | timeout=${90} | | VPP round robin RX placement on all DUTs | ${nodes} | prefix=Virtual -| Configure chain of NFs with dpdk-testpmd-mac connected via vhost-user on node -| | [Documentation] -| | ... | Start 1 chain of 1..N QEMU guests (VNFs) with two vhost-user\ -| | ... | interfaces and interconnecting DPDK testpmd with fwd mode set to mac\ -| | ... | rewrite on VPP node. -| | ... -| | ... | *Arguments:* -| | ... | - dut - DUT node to start guest VM on. Type: dictionary -| | ... | - nf_chains - Number of chains of NFs. Type: integer -| | ... | - nf_chain - NF chain ID. Type: integer -| | ... | - nf_nodes - Number of guest VMs. Type: integer -| | ... | - jumbo - Jumbo frames are used (True) or are not used (False) -| | ... | in the test. Type: boolean -| | ... | - perf_qemu_qsz - Virtio Queue Size. Type: integer -| | ... | - use_tuned_cfs - Set True if CFS RR should be used for Qemu SMP. -| | ... | Type: boolean -| | ... | - auto_scale - Whether to use same amount of RXQs for vhost interface -| | ... | in VM as vswitch, otherwise use single RXQ. Type: boolean -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Configure chain of NFs with dpdk-testpmd-mac connected via \ -| | ... | vhost-user on node \| DUT1 \| 1 \| 1 \| 1 \| False \| 1024 \| -| | ... -| | [Arguments] | ${dut} | ${nf_chains}=${1} | ${nf_chain}=${1} -| | ... | ${nf_nodes}=${1} | ${jumbo}=${False} | ${perf_qemu_qsz}=${1024} -| | ... | ${use_tuned_cfs}=${False} | ${auto_scale}=${False} -| | ... -| | ${tg_if1_mac}= | Get Interface MAC | ${tg} | ${tg_if1} -| | ${tg_if2_mac}= | Get Interface MAC | ${tg} | ${tg_if2} -| | :FOR | ${nf_node} | IN RANGE | 1 | ${nf_nodes} + ${1} -| | | ${nf_cpus}= | Create network function CPU list | ${dut} -| | | ... | chains=${nf_chains} | nodeness=${nf_nodes} | chain_id=${nf_chain} -| | | ... | node_id=${nf_node} | auto_scale=${False} -| | | ${qemu_id}= | Evaluate | (${nf_chain} - ${1}) * ${nf_nodes} + ${nf_node} -| | | ${sock1}= | Set Variable | /var/run/vpp/sock-${qemu_id}-1 -| | | ${sock2}= | Set Variable | /var/run/vpp/sock-${qemu_id}-2 -| | | ${nf_name}= | Set Variable | ${dut}_VM${qemu_id} -| | | ${prev_qemu_id}= | Evaluate | ${qemu_id} - ${1} -| | | ${next_qemu_id}= | Evaluate | ${qemu_id} + ${1} -| | | ${prev_qemu_id_hex}= | Convert To Hex | ${prev_qemu_id} | length=2 -| | | ... | lowercase=yes -| | | ${next_qemu_id_hex}= | Convert To Hex | ${next_qemu_id} | length=2 -| | | ... | lowercase=yes -| | | ${vif1_mac}= | Set Variable If | ${nf_node} == ${1} -| | | ... | ${tg_if1_mac} -| | | ... | 52:54:00:00:${prev_qemu_id_hex}:02 -| | | ${vif2_mac}= | Set Variable If | ${nf_node} == ${nf_nodes} -| | | ... | ${tg_if2_mac} -| | | ... | 52:54:00:00:${next_qemu_id_hex}:01 -| | | ${vm}= -| | | ... | Configure guest VM with dpdk-testpmd-mac connected via vhost-user -| | | ... | ${dut} | ${sock1} | ${sock2} | ${nf_name} | ${vif1_mac} -| | | ... | ${vif2_mac} | ${nf_cpus} | qemu_id=${qemu_id} | jumbo=${jumbo} -| | | ... | perf_qemu_qsz=${perf_qemu_qsz} | use_tuned_cfs=${use_tuned_cfs} -| | | ... | auto_scale=${auto_scale} -| | | Set To Dictionary | ${${dut}_vm_refs} | ${nf_name} | ${vm} - -| Configure chain of NFs with dpdk-testpmd-mac connected via vhost-user -| | [Documentation] -| | ... | Start 1 chain of 1..N QEMU guests (VNFs) with two vhost-user\ -| | ... | interfaces and interconnecting DPDK testpmd with fwd mode set to mac\ -| | ... | rewrite on all defined VPP nodes. -| | ... -| | ... | *Arguments:* -| | ... | - nf_chains - Number of chains of NFs. Type: integer -| | ... | - nf_chain - NF chain ID. Type: integer -| | ... | - nf_nodes - Number of NFs nodes per chain. Type: integer -| | ... | - jumbo - Jumbo frames are used (True) or are not used (False) -| | ... | in the test. Type: boolean -| | ... | - perf_qemu_qsz - Virtio Queue Size. Type: integer -| | ... | - use_tuned_cfs - Set True if CFS RR should be used for Qemu SMP. -| | ... | Type: boolean -| | ... | - auto_scale - Whether to use same amount of RXQs for vhost interface -| | ... | in VM as vswitch, otherwise use single RXQ. Type: boolean -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Configure chain of NFs with dpdk-testpmd-mac connected via\ -| | ... | vhost-user \| 1 \| 1 \| 1 \| False \| 1024 \| -| | ... -| | [Arguments] | ${nf_chains}=${1} | ${nf_chain}=${1} | ${nf_nodes}=${1} -| | ... | ${jumbo}=${False} | ${perf_qemu_qsz}=${1024} -| | ... | ${use_tuned_cfs}=${False} | ${auto_scale}=${False} -| | ... -| | ${duts}= | Get Matches | ${nodes} | DUT* -| | :FOR | ${dut} | IN | @{duts} -| | | Configure chain of NFs with dpdk-testpmd-mac connected via vhost-user on node -| | | ... | ${dut} | nf_chains=${nf_chains} | nf_chain=${nf_chain} -| | | ... | nf_nodes=${nf_nodes} | jumbo=${jumbo} -| | | ... | perf_qemu_qsz=${perf_qemu_qsz} | use_tuned_cfs=${False} -| | | ... | auto_scale=${auto_scale} - -| Configure chains of NFs with dpdk-testpmd-mac connected via vhost-user -| | [Documentation] -| | ... | Start 1..N chains of 1..N QEMU guests (VNFs) with two vhost-user\ -| | ... | interfaces and interconnecting DPDK testpmd with fwd mode set to mac\ -| | ... | rewrite on all defined VPP nodes. -| | ... -| | ... | *Arguments:* -| | ... | - nf_chains - Number of chains of NFs. Type: integer -| | ... | - nf_nodes - Number of NFs nodes per chain. Type: integer -| | ... | - jumbo - Jumbo frames are used (True) or are not used (False) -| | ... | in the test. Type: boolean -| | ... | - perf_qemu_qsz - Virtio Queue Size. Type: integer -| | ... | - use_tuned_cfs - Set True if CFS RR should be used for Qemu SMP. -| | ... | Type: boolean -| | ... | - auto_scale - Whether to use same amount of RXQs for memif interface -| | ... | in containers as vswitch, otherwise use single RXQ. Type: boolean -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Configure chains of VMs with dpdk-testpmd-mac connected via \ -| | ... | vhost-user \| 1 \| 1 \| False \| 1024 \| -| | ... -| | [Arguments] | ${nf_chains}=${1} | ${nf_nodes}=${1} | ${jumbo}=${False} -| | ... | ${perf_qemu_qsz}=${1024} | ${use_tuned_cfs}=${False} -| | ... | ${auto_scale}=${False} -| | ... -| | :FOR | ${nf_chain} | IN RANGE | 1 | ${nf_chains}+1 -| | | Configure chain of NFs with dpdk-testpmd-mac connected via vhost-user -| | | ... | nf_chains=${nf_chains} | nf_chain=${nf_chain} | nf_nodes=${nf_nodes} -| | | ... | jumbo=${jumbo} | perf_qemu_qsz=${perf_qemu_qsz} -| | | ... | use_tuned_cfs=${False} | auto_scale=${auto_scale} -| | All VPP Interfaces Ready Wait | ${nodes} -| | VPP round robin RX placement on all DUTs | ${nodes} | prefix=Virtual - | Initialize LISP IPv4 forwarding in 3-node circular topology | | [Documentation] | Custom setup of IPv4 addresses on all DUT nodes and TG \ | | ... | Don`t set route. -- cgit 1.2.3-korg