diff --git a/provider/cpu_utils.py b/provider/cpu_utils.py index 8edc25886ae43145c9e01b87012f60beed1cd8fe..b0bb3c54e0c07d799a5835593b9f0cf8a8dcc3f3 100644 --- a/provider/cpu_utils.py +++ b/provider/cpu_utils.py @@ -38,7 +38,8 @@ def get_guest_cpu_ids(session, os_type): return set() cmd = "grep processor /proc/cpuinfo" output = session.cmd_output(cmd) - return set(map(int, re.findall(r"(\d+)$", output, re.M))) + return set(map(int, re.findall(r"processor\s+(?::\s)?(\d+)", + output, re.M))) def check_guest_cpu_topology(session, os_type, cpuinfo): diff --git a/qemu/tests/cfg/cpu_device_hotplug_during_boot.cfg b/qemu/tests/cfg/cpu_device_hotplug_during_boot.cfg index 0a1a7c818e97a63e494dc3f603a05d4057c7f6ad..b0010dead046fd4c4783bf9d9fad565b03a8cc97 100644 --- a/qemu/tests/cfg/cpu_device_hotplug_during_boot.cfg +++ b/qemu/tests/cfg/cpu_device_hotplug_during_boot.cfg @@ -5,9 +5,11 @@ qemu_sandbox = on vcpu_devices = vcpu1 only Linux + no aarch64 no ovmf no RHEL.6 variants: - @only_plug: - with_unplug: + no s390x unplug_during_boot = yes diff --git a/qemu/tests/cfg/cpu_device_hotpluggable.cfg b/qemu/tests/cfg/cpu_device_hotpluggable.cfg index f38ae6c36102d37e7164766501337e3afc6049c0..552844755b0dad9c29662fdafc89404b44f042cf 100644 --- a/qemu/tests/cfg/cpu_device_hotpluggable.cfg +++ b/qemu/tests/cfg/cpu_device_hotpluggable.cfg @@ -1,9 +1,12 @@ # Notes: # For ppc64/ppc64le, please manually specify cpu_model in your environment - cpu_device_hotpluggable: install setup image_copy unattended_install.cdrom - only ppc64 ppc64le x86_64 + no aarch64 Windows: - no WinXP, WinVista, Win7, Win8, Win10, Win2000, Win2003 + # TBD: Please update the list when new supported Win OS comes out + only Win2008, Win2012, Win2016, Win2019 + Win2008, Win2012, s390x: + check_cpu_topology = no # ovmf does not support hotpluggable vCPU yet, this line will be removed # when it is fully supported. no ovmf @@ -35,6 +38,8 @@ hotplug: Linux: sub_test_after_migrate = reboot hotunplug + s390x: + sub_test_after_migrate = reboot Windows: sub_test_after_migrate = reboot hotunplug: @@ -44,6 +49,8 @@ pause_vm_before_hotplug = yes Linux: sub_test_type = pause_resume + s390x: + del sub_test_type - with_online_offline: only hotplug only Linux @@ -59,6 +66,7 @@ install_path = "C:\Program Files\JAM Software\HeavyLoad" install_cmd = "start /wait %s:\HeavyLoadSetup.exe /verysilent" - with_numa: + no s390x only hotplug only multi_vcpu type = cpu_device_hotpluggable_with_numa @@ -77,5 +85,6 @@ vcpu_enable = no - hotunplug: only Linux + no s390x hotpluggable_test = hotunplug vcpu_enable = yes diff --git a/qemu/tests/cfg/invalid_cpu_device_hotplug.cfg b/qemu/tests/cfg/invalid_cpu_device_hotplug.cfg index 2c28223738577980946a3fae04916ed3e50e80ff..1aeafabc9190b6c4af7a39b86969d998e4bbca57 100644 --- a/qemu/tests/cfg/invalid_cpu_device_hotplug.cfg +++ b/qemu/tests/cfg/invalid_cpu_device_hotplug.cfg @@ -1,5 +1,5 @@ - invalid_cpu_device_hotplug: - only x86_64 ppc64 ppc64le + no aarch64 virt_test_type = qemu type = invalid_cpu_device_hotplug required_qemu = [2.6.0, ) @@ -16,8 +16,11 @@ error_desc = "core {0} already populated" x86_64: Windows: - no WinXP, WinVista, Win7, Win8, Win10, Win2000, Win2003 + # TBD: Please update the list when new supported Win OS comes out + only Win2008, Win2012, Win2016, Win2019 error_desc = "CPU\[{0}\] with APIC ID \d+ exists" + s390x: + error_desc = "Unable to add CPU with core-id: {0}, it already exists" - invalid_id: execute_test = invalid_vcpu ppc64, ppc64le: @@ -33,6 +36,9 @@ ppc64, ppc64le: error_desc = "invalid core id {0}" invalid_ids = 1 -1 -2 + s390x: + error_desc = "Parameter 'core-id' expects uint32_t" + invalid_ids = -1 - nr_threads: invalid_property = nr-threads only ppc64 ppc64le @@ -44,3 +50,5 @@ error_desc = "core id {0} out of range" x86_64: error_desc = "Invalid CPU {1}: {0} must be in range 0:{2}" + s390x: + error_desc = "Unable to add CPU with core-id: {0}, maximum core-id: {2}" diff --git a/qemu/tests/cpu_device_hotpluggable.py b/qemu/tests/cpu_device_hotpluggable.py index 02fadefe975e56966564a3d265b5fe446b42381a..777f27f4a777c4aaccb1185cf338995645638922 100644 --- a/qemu/tests/cpu_device_hotpluggable.py +++ b/qemu/tests/cpu_device_hotpluggable.py @@ -113,6 +113,7 @@ def run(test, params, env): hotpluggable_test = params["hotpluggable_test"] verify_wait_timeout = params.get_numeric("verify_wait_timeout", 60) sub_test_type = params.get("sub_test_type") + check_cpu_topology = params.get_boolean("check_cpu_topology", True) vm = env.get_vm(params["main_vm"]) vm.verify_alive() @@ -159,9 +160,9 @@ def run(test, params, env): if vm.is_alive(): session = vm.wait_for_login(timeout=login_timeout) check_guest_cpu_count(expected_vcpus) - if (expected_vcpus == maxcpus and - not cpu_utils.check_guest_cpu_topology(session, os_type, - vm.cpuinfo)): - session.close() - test.fail("CPU topology of guest is inconsistent with " - "expectations.") + if expected_vcpus == maxcpus and check_cpu_topology: + if not cpu_utils.check_guest_cpu_topology(session, os_type, + vm.cpuinfo): + session.close() + test.fail("CPU topology of guest is inconsistent with " + "expectations.") diff --git a/qemu/tests/cpu_device_hotpluggable_with_stress.py b/qemu/tests/cpu_device_hotpluggable_with_stress.py index 03b0bcc8ec342c9b69173ad64baf2d0214906de0..22421ad4c8d733fbd4b0ced699123b2b3b472b8c 100644 --- a/qemu/tests/cpu_device_hotpluggable_with_stress.py +++ b/qemu/tests/cpu_device_hotpluggable_with_stress.py @@ -5,6 +5,7 @@ import logging from provider import cpu_utils +from virttest import arch from virttest import error_context from virttest import utils_misc from virttest import utils_package @@ -39,6 +40,7 @@ def run(test, params, env): session.cmd(install_cmd) os_type = params["os_type"] + vm_arch_name = params.get('vm_arch_name', arch.ARCH) login_timeout = params.get_numeric("login_timeout", 360) stress_duration = params.get_numeric("stress_duration", 180) verify_wait_timeout = params.get_numeric("verify_wait_timeout", 60) @@ -88,14 +90,16 @@ def run(test, params, env): "%.2f%%" % (cpu_id, cpu_usage_rate)) logging.info("Usage rate of vCPU(%s) is: %.2f%%", cpu_id, cpu_usage_rate) - for vcpu_dev in vcpu_devices: - error_context.context("Hotunplug vcpu device: %s" % vcpu_dev, - logging.info) - vm.hotunplug_vcpu_device(vcpu_dev) - # Drift the running stress task to other vCPUs - time.sleep(random.randint(5, 10)) - if vm.get_cpu_count() != smp: - test.fail("Actual number of guest CPUs is not equal to expected") + if not vm_arch_name.startswith("s390"): + for vcpu_dev in vcpu_devices: + error_context.context("Hotunplug vcpu device: %s" % vcpu_dev, + logging.info) + vm.hotunplug_vcpu_device(vcpu_dev) + # Drift the running stress task to other vCPUs + time.sleep(random.randint(5, 10)) + if vm.get_cpu_count() != smp: + test.fail("Actual number of guest CPUs is not equal to " + "expected") stress_tool.unload_stress() stress_tool.clean() else: