On Tue, Jan 26, 2021 at 05:51:12PM +0800, Liu Shaofei wrote:
On Tue, Jan 26, 2021 at 04:07:17PM +0800, Xiao Shenwei wrote:
request api: http://$SCHED_HOST:$SCHED_PORT/boot.libvirt/mac/$mac
Signed-off-by: Xiao Shenwei xiaoshenwei96@163.com
providers/libvirt/run.rb | 67 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100755 providers/libvirt/run.rb
diff --git a/providers/libvirt/run.rb b/providers/libvirt/run.rb new file mode 100755 index 0000000..0ff0d4f --- /dev/null +++ b/providers/libvirt/run.rb @@ -0,0 +1,67 @@ +#!/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 'json' +require 'digest/md5' +require_relative "#{ENV['CCI_SRC']}/lib/log" +require_relative "#{ENV['CCI_SRC']}/lib/sched_client" +require_relative "#{ENV['CCI_SRC']}/providers/lib/context"
+def create_logger(hostname)
- filename = "#{hostname}.log"
- File.delete(filename) if FileTest.exist?(filename)
- Log.new filename
+end
+def compute_mac(string)
- /(..)(..)(..)(..)(..)/ =~ Digest::MD5.hexdigest(string)
- "0a:#{$1}:#{$2}:#{$3}:#{$4}:#{$5}"
+end
+def nojob?(response)
how about nojob => exist_job ?
job_exist?
- flag = false
- if response['job_id'].empty?
- puts '----------'
- puts 'No job now'
- puts '----------'
- flag = true
- end
- return flag
+end
+def request(context, sched_client, logger)
how about request => request_job ?
ok
- # use ruby-libvirt api start a vm
- # clean env
perhaps you should define some interfaces here, these inetfaces can be realize later.
ok
Thanks, Shenwei
Thanks, Liushaofei
- sched_client.delete_mac2host(mac)
- sched_client.delete_host2queues(hostname)
+end
2.23.0