[PATCH v1 compass-ci 4/4] providers/libvirt: add a libvirt provider

[why] libvirt is a vm management tool, it based on a domain.xml file to run a vm, the xml each element will be parsed qemu-kvm parameter. so, we can configure xml to run vms of diff specifications Signed-off-by: Xiao Shenwei <xiaoshenwei96@163.com> --- providers/libvirt/client.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 providers/libvirt/client.rb diff --git a/providers/libvirt/client.rb b/providers/libvirt/client.rb new file mode 100644 index 0000000..d029a35 --- /dev/null +++ b/providers/libvirt/client.rb @@ -0,0 +1,23 @@ +# SPDX-License-Identifier: MulanPSL-2.0+ +# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved. +# frozen_string_literal: true + +require_relative 'lib/mylog' +require_relative 'lib/consumer' + +def main(hostname, queues) + puts "cat #{hostname}.log" + logger = Mylog.new("#{hostname}.log") + consumer = Consumer.new(hostname, queues).add_logger(logger) + response = consumer.request_job + + if response.nil? || response['job_id'].empty? + logger.warn('no job now') + puts '----------' + puts 'no job now' + puts '----------' + return + end + + consumer.close +end -- 2.23.0
participants (1)
-
Xiao Shenwei