Skip to content

Commit

Permalink
Merge pull request #5942 from rh-jugraham/journal_virt_admin_log_output
Browse files Browse the repository at this point in the history
Virt_admin_logging: create local disk and clear messages log
  • Loading branch information
chunfuwen authored Jan 13, 2025
2 parents 67aa9ed + 92eb4be commit 1200ec9
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

from virttest.libvirt_xml import vm_xml
from virttest.utils_libvirt import libvirt_disk
from virttest.utils_test import libvirt
from virttest.staging import service


Expand Down Expand Up @@ -82,6 +83,10 @@ def create_customized_disk(params):
source_dict.update({"file": source_file})
disk_src_dict = {"attrs": source_dict}

libvirt.create_local_disk("file", source_file, 1, disk_format="qcow2")

cleanup_files.append(source_file)

customized_disk = libvirt_disk.create_primitive_disk_xml(
type_name, disk_device,
device_target, device_bus,
Expand Down Expand Up @@ -131,6 +136,11 @@ def run(test, params, env):
vm_name = params.get("main_vm")
vm = env.get_vm(vm_name)

# Clear log file
log_config_path = params.get("log_file_path")
truncate_log = "truncate -s 0 %s" % log_config_path
process.run(truncate_log, ignore_status=True, shell=True, verbose=True)

# Back up xml file
if vm.is_alive():
vm.destroy(gracefully=False)
Expand Down

0 comments on commit 1200ec9

Please sign in to comment.