Skip to content

Commit

Permalink
Add qemuhck.txt file with host and VM's information
Browse files Browse the repository at this point in the history
Signed-off-by: Vitalii Chulak <[email protected]>
  • Loading branch information
Jedoku authored and kostyanf14 committed Jun 11, 2024
1 parent 985c8ce commit 5165af2
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/setupmanagers/qemuhck/qemu_machine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def initialize(scope, logger, machine, run_name, run_opts)
@run_opts = run_opts
@keep_alive = run_opts[:keep_alive]
@delete_snapshot = run_opts[:create_snapshot]
@machine.dump_config
@logger.info(@machine.dump_config)
@qemu_thread = Thread.new { run_vm }
scope << self
end
Expand Down Expand Up @@ -582,7 +582,7 @@ def dump_config
# S3 enabled..................${ENABLE_S3}
# S4 enabled..................${ENABLE_S4}
# Snapshot mode.............. ${SNAPSHOT}
@logger.info(full_replacement_map.replace(config.join("\n")))
full_replacement_map.replace(config.join("\n"))
end

def create_run_script(file_name, file_content)
Expand Down Expand Up @@ -661,7 +661,7 @@ def merge_commands_array(arr)
end

def dump_commands
dump_config
@logger.info(dump_config)

file_name = "#{@workspace_path}/#{@run_name}_manual.sh"
content = <<~BASH
Expand Down
36 changes: 36 additions & 0 deletions lib/setupmanagers/qemuhck/qemuhck.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class QemuHCK

attr_reader :kit, :project

QEMUHCK_INFO_LOG_FILE = 'qemuhck.txt'
OPT_NAMES = %w[viommu_state s3_state s4_state enlightenments_state vhost_state machine_type fw_type cpu
pluggable_memory_gb].freeze

Expand All @@ -24,6 +25,7 @@ def initialize(project)
@clients_vm = {}
initialize_studio_vm
initialize_clients_vm
create_qemuhck_log_file
end

def initialize_project(project)
Expand Down Expand Up @@ -110,6 +112,40 @@ def initialize_clients_vm
end
end

def create_qemuhck_log_file
qemuhck_log = "#{@workspace_path}/#{QEMUHCK_INFO_LOG_FILE}"
File.write(qemuhck_log, collect_environment_info)
@project.result_uploader.upload_file(qemuhck_log, QEMUHCK_INFO_LOG_FILE)
end

def collect_environment_info
logs = String.new
append_host_info(logs)
append_vms_info(logs)
logs.freeze
end

def append_host_info(logs)
logs << <<~HOST_INFO
QEMU version: #{`qemu-system-x86_64 --version`.lines.first.strip}
System information: #{`uname -a`.strip}
HOST_INFO
end

def append_vms_info(logs)
logs << <<~STUDIO_INFO
Studio Properties:
#{@studio_vm.dump_config}
STUDIO_INFO
@platform['clients'].each_with_index do |(_k, v), i|
logs << <<~CLIENT_INFO
Client #{i + 1} Properties:
#{@clients_vm[v['name']].dump_config}
CLIENT_INFO
end
end

def check_studio_image_exist
@studio_vm.check_image_exist
end
Expand Down

0 comments on commit 5165af2

Please sign in to comment.