aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python
diff options
context:
space:
mode:
authorpmikus <pmikus@cisco.com>2017-03-29 16:51:34 +0200
committerPeter Mikus <pmikus@cisco.com>2017-04-09 14:47:25 +0000
commit2e115ad11cca45b11c0f1949fd8c42fec899bb68 (patch)
treedc5e73e56944f5639d28de6e2cbedfce491af992 /resources/libraries/python
parentffd596f616dc9a65e113b25ba72b00ce6dd42a7b (diff)
CSIT-441 vhost - Parametrized qemu install
Update the current QEMU installation script with option to override QEMU installation and to apply additional patches. Additional patches are applied from qemu_patches directory and subdir for specific QEMU version by run-parts. This means that all patches for particular version are applied. All keywords for build QEMU are updated. Change-Id: I0c874a96ac828dff657ee33eb87d88a8854128ad Signed-off-by: pmikus <pmikus@cisco.com>
Diffstat (limited to 'resources/libraries/python')
-rw-r--r--resources/libraries/python/QemuUtils.py22
-rw-r--r--resources/libraries/python/constants.py6
2 files changed, 23 insertions, 5 deletions
diff --git a/resources/libraries/python/QemuUtils.py b/resources/libraries/python/QemuUtils.py
index f926d63caf..244ece2258 100644
--- a/resources/libraries/python/QemuUtils.py
+++ b/resources/libraries/python/QemuUtils.py
@@ -628,19 +628,31 @@ class QemuUtils(object):
'error: {1}'.format(self._node['host'], json.dumps(err)))
@staticmethod
- def build_qemu(node):
+ 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.
"""
ssh = SSH()
ssh.connect(node)
+ directory = ' --directory={0}'.format(Constants.QEMU_INSTALL_DIR)
+ version = ' --version={0}'.format(Constants.QEMU_INSTALL_VERSION)
+ force = ' --force' if force_install else ''
+ patch = ' --patch' if apply_patch else ''
+
(ret_code, stdout, stderr) = \
- ssh.exec_command('sudo -Sn bash {0}/{1}/qemu_build.sh'.format(
- Constants.REMOTE_FW_DIR, Constants.RESOURCES_LIB_SH), 1000)
- logger.trace(stdout)
+ ssh.exec_command(
+ "sudo -E sh -c '{0}/{1}/qemu_build.sh{2}{3}{4}{5}'"\
+ .format(Constants.REMOTE_FW_DIR, Constants.RESOURCES_LIB_SH,
+ version, directory, force, patch), 1000)
+
if int(ret_code) != 0:
- logger.debug('QEMU build failed {0}'.format(stderr))
+ logger.debug('QEMU build failed {0}'.format(stdout + stderr))
raise RuntimeError('QEMU build failed on {0}'.format(node['host']))
diff --git a/resources/libraries/python/constants.py b/resources/libraries/python/constants.py
index 4c3a8ff451..051a21cf02 100644
--- a/resources/libraries/python/constants.py
+++ b/resources/libraries/python/constants.py
@@ -29,6 +29,12 @@ class Constants(object):
# OpenVPP VAT binary name
VAT_BIN_NAME = 'vpp_api_test'
+ # QEMU version to install
+ QEMU_INSTALL_VERSION = 'qemu-2.5.0'
+
+ # QEMU install directory
+ QEMU_INSTALL_DIR = '/opt/qemu-2.5.0'
+
# Honeycomb directory location at topology nodes:
REMOTE_HC_DIR = '/opt/honeycomb'