diff options
author | Peter Mikus <pmikus@cisco.com> | 2019-04-13 06:15:25 +0000 |
---|---|---|
committer | Vratko Polak <vrpolak@cisco.com> | 2019-04-15 13:26:28 +0000 |
commit | 0e0cf38fcd1ff704293c9dd2c7a05f8682e11de9 (patch) | |
tree | ca7a60ab9164003f7cc1737e4bbed2ac8ce75ba6 /resources/libraries/python | |
parent | cc0c2870a18fb74a56410eca2d1870bddc945397 (diff) |
Remove obsolete QEMU installation
+Unify QEMU parameter to Contants.
Change-Id: I95adfc97dd7008c19e60ba3fa8668818b503bee8
Signed-off-by: Peter Mikus <pmikus@cisco.com>
Diffstat (limited to 'resources/libraries/python')
-rw-r--r-- | resources/libraries/python/Constants.py | 19 | ||||
-rw-r--r-- | resources/libraries/python/QemuManager.py | 2 | ||||
-rw-r--r-- | resources/libraries/python/QemuUtils.py | 46 |
3 files changed, 14 insertions, 53 deletions
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) |