On Fri, Jan 15, 2021 at 11:36:12AM +0800, Ren Wen wrote:
Mount '/srv/cci/libvirt-xml' and upload config. Use port 11392 by defaut.
Signed-off-by: Ren Wen 15991987063@163.com
container/libvirt-helper/build | 5 ++++ container/libvirt-helper/start | 46 ++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100755 container/libvirt-helper/build create mode 100755 container/libvirt-helper/start
diff --git a/container/libvirt-helper/build b/container/libvirt-helper/build new file mode 100755 index 0000000..1d216ea --- /dev/null +++ b/container/libvirt-helper/build @@ -0,0 +1,5 @@ +#!/bin/sh +# SPDX-License-Identifier: MulanPSL-2.0+ +# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+docker build -t libvirt-helper . diff --git a/container/libvirt-helper/start b/container/libvirt-helper/start new file mode 100755 index 0000000..6222eaa --- /dev/null +++ b/container/libvirt-helper/start @@ -0,0 +1,46 @@ +#!/usr/bin/env ruby +# SPDX-License-Identifier: MulanPSL-2.0+ +# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved. +# frozen_string_literal: true
+require 'set' +require_relative '../defconfig.rb'
+names = Set.new %w[
- LIBVIRT_HELPER_HOST
- LIBVIRT_HELPER_PORT
+]
+defaults = relevant_defaults(names) +env = docker_env(defaults)
+DEFAULT_LKP = '/c/lkp-tests' +DEFAULT_CCI = '/c/compass-ci' +DEFAULT_CONFIG_DIR = '/etc/compass-ci/defaults' +LIBVIRT_HELPER_PORT = defaults['LIBVIRT_HELPER_PORT'] || 11392 +LIBVIRT_PATH = '/srv/cci/libvirt-xml'
Pls mount '/srv/cci', use assist-cci as the container dir.
Thanks, Xueliang
+docker_rm 'libvirt-helper'
+cmd = %w[
- docker run
- --name libvirt-helper
- --restart=always
- -d
+] + env + %W[
- -e LIBVIRT_PATH=#{LIBVIRT_PATH}
- -e LIBVIRT_HELPER_PORT=#{LIBVIRT_HELPER_PORT}
- -e LKP_SRC=#{DEFAULT_LKP}
- -e CCI_SRC=#{DEFAULT_CCI}
- -v #{ENV['LKP_SRC']}:#{DEFAULT_LKP}
- -v #{ENV['CCI_SRC']}:#{DEFAULT_CCI}
- -v #{DEFAULT_CONFIG_DIR}:#{DEFAULT_CONFIG_DIR}:ro
- -p #{LIBVIRT_HELPER_PORT}:#{LIBVIRT_HELPER_PORT}
- -v /etc/localtime:/etc/localtime:ro
- -v #{LIBVIRT_PATH}:#{LIBVIRT_PATH}
- -w #{DEFAULT_CCI}/container/libvirt-helper/
- libvirt-helper
+]
+cmd += ['sh', '-c', 'umask 002 && ruby ./libvirt_app.rb']
+system(*cmd)
2.23.0