diff --git a/KVM/qemu/boot_repeat.cfg b/KVM/qemu/boot_repeat.cfg new file mode 100644 index 00000000..dfb75bab --- /dev/null +++ b/KVM/qemu/boot_repeat.cfg @@ -0,0 +1,121 @@ +- boot_repeat: + variants: + - one_vm_repeat: + virt_test_type = qemu + vm_accelerator = kvm + start_vm = no + image_snapshot = yes + vga = std + auto_cpu_model = "no" + cpu_model = host + variants: + - @default: + type = boot_repeat + variants: + - 10times: + iterations = 10 + variants: + - one_cpu: + smp = 1 + vcpu_maxcpus = 1 + - four_cpu: + smp = 4 + vcpu_maxcpus = 4 + - 20times: + iterations = 20 + variants: + - four_cpu: + smp = 4 + vcpu_maxcpus = 4 + variants: + - one_socket: + vcpu_sockets = 1 + - two_socket: + vcpu_sockets = 2 + no one_cpu + variants: + - vm: + - td: + machine_type_extra_params = "kernel-irqchip=split" + vm_secure_guest_type = tdx + - memory_sweep: + type = multi_vms_multi_boot + vms = "vm1" + start_mem = 1024 + mem_generator = random_32g_window + random_min = 0 + random_max = 64 + random_unit = 511 + samples_per_window = 2 + window_size = 32768 + variants: + - 1vm: + variants: + - from1G_toall: + - 1td: + machine_type_extra_params = "kernel-irqchip=split" + vm_secure_guest_type = tdx + variants: + - from1G_toall: + + - multi_vms_repeat: + virt_test_type = qemu + vm_accelerator = kvm + image_snapshot = yes + start_vm = no + vga = std + auto_cpu_model = "no" + cpu_model = host + variants: + - @default: + type = boot_repeat + smp = 4 + vcpu_maxcpus = 4 + mem = 16384 + variants: + - 20times: + iterations = 20 + variants: + - 4td: + machine_type_extra_params = "kernel-irqchip=split" + vm_secure_guest_type = tdx + vms = "vm1 vm2 vm3 vm4" + - 4vm: + vms = "vm1 vm2 vm3 vm4" + - memory_sweep: + type = multi_vms_multi_boot + start_mem = 1024 + mem_generator = random_32g_window + random_min = 0 + random_max = 64 + random_unit = 511 + samples_per_window = 2 + window_size = 32768 + divide_host_mem_limit_by_vm_count = yes + variants: + - 1td_1vm: + vms = "vm1 vm2" + machine_type_extra_params_vm2 = "kernel-irqchip=split" + vm_secure_guest_type_vm2 = tdx + variants: + - from1G_toall: + - 2td: + vms = "vm1 vm2" + machine_type_extra_params = "kernel-irqchip=split" + vm_secure_guest_type = tdx + variants: + - from1G_toall: + - 4td: + vms = "vm1 vm2 vm3 vm4" + machine_type_extra_params = "kernel-irqchip=split" + vm_secure_guest_type = tdx + variants: + - from1G_toall: + - 2vm: + vms = "vm1 vm2" + variants: + - from1G_toall: + - 4vm: + vms = "vm1 vm2 vm3 vm4" + variants: + - from1G_toall: diff --git a/KVM/qemu/multi_vms.cfg b/KVM/qemu/multi_vms.cfg index bf46a869..cd24a870 100644 --- a/KVM/qemu/multi_vms.cfg +++ b/KVM/qemu/multi_vms.cfg @@ -9,50 +9,9 @@ auto_cpu_model = "no" cpu_model = host variants: - - 1vm: - vms = "vm1" - variants: - - from1G_toall: - type = multi_vms_multi_boot - start_vm = no - start_mem = 1024 - mem_generator = random_32g_window - random_min = 0 - random_max = 64 - random_unit = 511 - samples_per_window = 2 - window_size = 32768 - - 1td: - vms = "vm1" - machine_type_extra_params = "kernel-irqchip=split" - vm_secure_guest_type = tdx - variants: - - from1G_toall: - type = multi_vms_multi_boot - start_vm = no - start_mem = 1024 - mem_generator = random_32g_window - random_min = 0 - random_max = 64 - random_unit = 511 - samples_per_window = 2 - window_size = 32768 - 1td_1vm: machine_type_extra_params_vm2 = "kernel-irqchip=split" vm_secure_guest_type_vm2 = tdx - variants: - - @default: - - from1G_toall: - type = multi_vms_multi_boot - start_vm = no - start_mem = 1024 - mem_generator = random_32g_window - random_min = 0 - random_max = 64 - random_unit = 511 - samples_per_window = 2 - window_size = 32768 - divide_host_mem_limit_by_vm_count = yes - 2td: machine_type_extra_params = "kernel-irqchip=split" vm_secure_guest_type = tdx @@ -79,34 +38,10 @@ - 1G_2G: mem_vm1 = 1024 mem_vm2 = 2048 - - from1G_toall: - type = multi_vms_multi_boot - start_vm = no - start_mem = 1024 - mem_generator = random_32g_window - random_min = 0 - random_max = 64 - random_unit = 511 - samples_per_window = 2 - window_size = 32768 - divide_host_mem_limit_by_vm_count = yes - 4td: machine_type_extra_params = "kernel-irqchip=split" vm_secure_guest_type = tdx vms = "vm1 vm2 vm3 vm4" - variants: - - @default: - - from1G_toall: - type = multi_vms_multi_boot - start_vm = no - start_mem = 1024 - mem_generator = random_32g_window - random_min = 0 - random_max = 64 - random_unit = 511 - samples_per_window = 2 - window_size = 32768 - divide_host_mem_limit_by_vm_count = yes - 2vm: variants: - 2vcpu: @@ -131,29 +66,5 @@ - 1G_2G: mem_vm1 = 1024 mem_vm2 = 2048 - - from1G_toall: - type = multi_vms_multi_boot - start_vm = no - start_mem = 1024 - mem_generator = random_32g_window - random_min = 0 - random_max = 64 - random_unit = 511 - samples_per_window = 2 - window_size = 32768 - divide_host_mem_limit_by_vm_count = yes - 4vm: vms = "vm1 vm2 vm3 vm4" - variants: - - @default: - - from1G_toall: - type = multi_vms_multi_boot - start_vm = no - start_mem = 1024 - mem_generator = random_32g_window - random_min = 0 - random_max = 64 - random_unit = 511 - samples_per_window = 2 - window_size = 32768 - divide_host_mem_limit_by_vm_count = yes diff --git a/KVM/qemu/td_boot_multimes.cfg b/KVM/qemu/td_boot_multimes.cfg deleted file mode 100644 index b2ba0868..00000000 --- a/KVM/qemu/td_boot_multimes.cfg +++ /dev/null @@ -1,30 +0,0 @@ -- td_boot_multimes: - virt_test_type = qemu - type = td_boot_multimes - vm_accelerator = kvm - machine_type_extra_params = "kernel-irqchip=split" - vm_secure_guest_type = tdx - start_vm = no - vga = std - auto_cpu_model = "no" - cpu_model = host - iterations = 10 - variants: - - one_cpu: - smp = 1 - vcpu_maxcpus = 1 - - four_cpu: - smp = 4 - vcpu_maxcpus = 4 - variants: - - one_socket: - vcpu_sockets = 1 - - two_socket: - vcpu_sockets = 2 - no one_cpu - - 4vm_20times: - vms = "vm1 vm2 vm3 vm4" - image_snapshot = yes - mem = 16384 - iterations = 20 - only four_cpu diff --git a/KVM/qemu/tests/boot_repeat.py b/KVM/qemu/tests/boot_repeat.py new file mode 100644 index 00000000..0af9c0b2 --- /dev/null +++ b/KVM/qemu/tests/boot_repeat.py @@ -0,0 +1,44 @@ +#!/usr/bin/python3 + +# SPDX-License-Identifier: GPL-2.0-only +# Copyright (c) 2026 Intel Corporation + +from provider import dmesg_router # pylint: disable=unused-import + +from virttest import error_context + + +@error_context.context_aware +def run(test, params, env): + """ + Boot all configured VMs, verify guest login, destroy them, and repeat. + + :param test: QEMU test object + :param params: Dictionary with the test parameters + :param env: Dictionary with test environment + """ + + timeout = int(params.get_numeric("login_timeout", 240)) + iterations = int(params.get_numeric("iterations")) + vm_names = params.objects("vms") + if not vm_names: + test.cancel("No VMs configured for boot_repeat") + + vms = [env.get_vm(vm_name) for vm_name in vm_names] + for iteration in range(1, iterations + 1): + started_vms = [] + error_context.context( + "Boot repeat iteration %s/%s" % (iteration, iterations), + test.log.info, + ) + try: + for vm in vms: + vm.create() + started_vms.append(vm) + for vm in started_vms: + vm.verify_alive() + session = vm.wait_for_login(timeout=timeout) + session.close() + finally: + for vm in started_vms: + vm.destroy(gracefully=False) diff --git a/KVM/qemu/tests/td_boot_multimes.py b/KVM/qemu/tests/td_boot_multimes.py deleted file mode 100644 index 1622b0df..00000000 --- a/KVM/qemu/tests/td_boot_multimes.py +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/python3 - -# SPDX-License-Identifier: GPL-2.0-only -# Copyright (c) 2024 Intel Corporation - -# Author: Xudong Hao -# -# History: Jun. 2024 - Xudong Hao - creation -from provider import dmesg_router # pylint: disable=unused-import -from virttest import error_context - - -# This decorator makes the test function aware of context strings -@error_context.context_aware -def run(test, params, env): - """ - Boot TD by multiple times: - 1) Boot up TDVM - 2) Shutdown TDVM - 3) repeat step1 and step2 multiple times - - :param test: QEMU test object - :param params: Dictionary with the test parameters - :param env: Dictionary with test environment - """ - - timeout = params.get_numeric("login_timeout", 240) - serial_login = params.get("serial_login", "no") == "yes" - iterations = params.get_numeric("iterations") - for i in range(iterations): - error_context.context("The iteration %s of booting TDVM(s)" % i, test.log.info) - vms = env.get_all_vms() - for vm in vms: - vm.create() - for vm in vms: - vm.verify_alive() - if serial_login: - session = vm.wait_for_serial_login(timeout=timeout) - else: - session = vm.wait_for_login(timeout=timeout) - session.close() - vm.destroy()