diff options
author | Matus Fabian <matfabia@cisco.com> | 2016-03-08 14:01:32 +0100 |
---|---|---|
committer | Gerrit Code Review <gerrit@fd.io> | 2016-03-11 12:23:01 +0000 |
commit | 5d5db63262e5c141e5eb435c65154cee214887af (patch) | |
tree | 80ec35562acf83c379df7401fb8a6598d2eaf003 /resources/libraries/python | |
parent | 05eba892c7d2a778e78a950966fb1a6e0d68aa60 (diff) |
Add KW to build QEMU 2.2.1 on node
Change-Id: I58271aff1ef558752f00593bbad5c3317d08288d
Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'resources/libraries/python')
-rw-r--r-- | resources/libraries/python/QemuUtils.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/resources/libraries/python/QemuUtils.py b/resources/libraries/python/QemuUtils.py new file mode 100644 index 0000000000..c723878499 --- /dev/null +++ b/resources/libraries/python/QemuUtils.py @@ -0,0 +1,40 @@ +# Copyright (c) 2016 Cisco and/or its affiliates. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""QEMU utilities library.""" + +from robot.api import logger +from ssh import SSH +from constants import Constants + + +class QemuUtils(object): + """QEMU utilities.""" + + @staticmethod + def build_qemu(node): + """Build QEMU from sources. + + :param node: Node to build QEMU on. + :type node: dict + """ + ssh = SSH() + ssh.connect(node) + + (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) + if 0 != int(ret_code): + logger.debug('QEMU build failed {0}'.format(stderr)) + raise RuntimeError('QEMU build failed on {0}'.format(node['host'])) |