Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Virt_admin_logging: create local disk and clear messages log #5942

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -132,6 +137,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
Loading