X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2FQemuUtils.py;h=17b5eabdc472d6b6d699b868068a7270193563a6;hb=20cc67d5f23a7f4e05b08012bf3d3a63be4bcf63;hp=0895f954093601f15331c05221c36ad3ad2b7a93;hpb=f88a3d9178dfbd73d0479f9aa2f5224e0c89ca1f;p=csit.git diff --git a/resources/libraries/python/QemuUtils.py b/resources/libraries/python/QemuUtils.py index 0895f95409..17b5eabdc4 100644 --- a/resources/libraries/python/QemuUtils.py +++ b/resources/libraries/python/QemuUtils.py @@ -13,9 +13,6 @@ """QEMU utilities library.""" -# Disable due to pylint bug -# pylint: disable=no-name-in-module,import-error -from distutils.version import StrictVersion import json from re import match from string import Template @@ -159,13 +156,7 @@ class QemuUtils(object): self._params.add_with_value( 'net', 'user,hostfwd=tcp::{info[port]}-:22'.format( info=self._vm_info)) - # TODO: Remove try except after fully migrated to Bionic or - # qemu_set_node is removed. - try: - locking = ',file.locking=off'\ - if self.qemu_version(version='2.10') else '' - except AttributeError: - locking = '' + locking = ',file.locking=off' self._params.add_with_value( 'drive', 'file={img},format=raw,cache=none,if=virtio{locking}'. format(img=self._opt.get('img'), locking=locking)) @@ -196,7 +187,7 @@ class QemuUtils(object): self._params.add_with_value( 'append', '"ro rootfstype=9p rootflags=trans=virtio ' 'root=virtioroot console={console} tsc=reliable ' - 'hugepages=256 init={init}"'.format( + 'hugepages=256 init={init} fastboot"'.format( console=console, init=self._temp.get('ini'))) def create_kernelvm_config_vpp(self, **kwargs): @@ -262,9 +253,8 @@ class QemuUtils(object): pmd_num_mbufs=16384, pmd_rxq=kwargs['queues'], pmd_txq=kwargs['queues'], - pmd_tx_offloads=False, + pmd_tx_offloads='0x0', pmd_disable_hw_vlan=False, - pmd_max_pkt_len=9200 if kwargs['jumbo_frames'] else None, pmd_nb_cores=str(self._opt.get('smp') - 1)) self._opt['vnf_bin'] = ('{testpmd_path}/{testpmd_cmd}'. @@ -287,9 +277,8 @@ class QemuUtils(object): pmd_eth_peer_1='1,{mac}'.format(mac=kwargs['vif2_mac']), pmd_rxq=kwargs['queues'], pmd_txq=kwargs['queues'], - pmd_tx_offloads=False, + pmd_tx_offloads='0x0', pmd_disable_hw_vlan=False, - pmd_max_pkt_len=9200 if kwargs['jumbo_frames'] else None, pmd_nb_cores=str(self._opt.get('smp') - 1)) self._opt['vnf_bin'] = ('{testpmd_path}/{testpmd_cmd}'. @@ -648,22 +637,18 @@ class QemuUtils(object): exec_cmd(self._node, 'cat {value}'.format(value=value), sudo=True) exec_cmd(self._node, 'rm -f {value}'.format(value=value), sudo=True) - def qemu_version(self, version=None): - """Return Qemu version or compare if version is higher than parameter. + def qemu_version(self): + """Return Qemu version. - :param version: Version to compare. - :type version: str - :returns: Qemu version or Boolean if version is higher than parameter. - :rtype: str or bool + :returns: Qemu version. + :rtype: str """ command = ('{bin_path}/qemu-system-{arch} --version'.format( bin_path=Constants.QEMU_BIN_PATH, arch=self._arch)) try: stdout, _ = exec_cmd_no_error(self._node, command, sudo=True) - ver = match(r'QEMU emulator version ([\d.]*)', stdout).group(1) - return StrictVersion(ver) > StrictVersion(version) \ - if version else ver + return match(r'QEMU emulator version ([\d.]*)', stdout).group(1) except RuntimeError: self.qemu_kill_all() raise