未验证 提交 7f3165b7 编写于 作者: Y Yu Yihuang 提交者: GitHub

Merge pull request #2176 from PaulYuuu/cpu_hotplug_s390

Make cpu hotplug cases work on s390
...@@ -38,7 +38,8 @@ def get_guest_cpu_ids(session, os_type): ...@@ -38,7 +38,8 @@ def get_guest_cpu_ids(session, os_type):
return set() return set()
cmd = "grep processor /proc/cpuinfo" cmd = "grep processor /proc/cpuinfo"
output = session.cmd_output(cmd) 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): def check_guest_cpu_topology(session, os_type, cpuinfo):
......
...@@ -5,9 +5,11 @@ ...@@ -5,9 +5,11 @@
qemu_sandbox = on qemu_sandbox = on
vcpu_devices = vcpu1 vcpu_devices = vcpu1
only Linux only Linux
no aarch64
no ovmf no ovmf
no RHEL.6 no RHEL.6
variants: variants:
- @only_plug: - @only_plug:
- with_unplug: - with_unplug:
no s390x
unplug_during_boot = yes unplug_during_boot = yes
# Notes: # Notes:
# For ppc64/ppc64le, please manually specify cpu_model in your environment # For ppc64/ppc64le, please manually specify cpu_model in your environment
- cpu_device_hotpluggable: install setup image_copy unattended_install.cdrom - cpu_device_hotpluggable: install setup image_copy unattended_install.cdrom
only ppc64 ppc64le x86_64 no aarch64
Windows: 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 # ovmf does not support hotpluggable vCPU yet, this line will be removed
# when it is fully supported. # when it is fully supported.
no ovmf no ovmf
...@@ -35,6 +38,8 @@ ...@@ -35,6 +38,8 @@
hotplug: hotplug:
Linux: Linux:
sub_test_after_migrate = reboot hotunplug sub_test_after_migrate = reboot hotunplug
s390x:
sub_test_after_migrate = reboot
Windows: Windows:
sub_test_after_migrate = reboot sub_test_after_migrate = reboot
hotunplug: hotunplug:
...@@ -44,6 +49,8 @@ ...@@ -44,6 +49,8 @@
pause_vm_before_hotplug = yes pause_vm_before_hotplug = yes
Linux: Linux:
sub_test_type = pause_resume sub_test_type = pause_resume
s390x:
del sub_test_type
- with_online_offline: - with_online_offline:
only hotplug only hotplug
only Linux only Linux
...@@ -59,6 +66,7 @@ ...@@ -59,6 +66,7 @@
install_path = "C:\Program Files\JAM Software\HeavyLoad" install_path = "C:\Program Files\JAM Software\HeavyLoad"
install_cmd = "start /wait %s:\HeavyLoadSetup.exe /verysilent" install_cmd = "start /wait %s:\HeavyLoadSetup.exe /verysilent"
- with_numa: - with_numa:
no s390x
only hotplug only hotplug
only multi_vcpu only multi_vcpu
type = cpu_device_hotpluggable_with_numa type = cpu_device_hotpluggable_with_numa
...@@ -77,5 +85,6 @@ ...@@ -77,5 +85,6 @@
vcpu_enable = no vcpu_enable = no
- hotunplug: - hotunplug:
only Linux only Linux
no s390x
hotpluggable_test = hotunplug hotpluggable_test = hotunplug
vcpu_enable = yes vcpu_enable = yes
- invalid_cpu_device_hotplug: - invalid_cpu_device_hotplug:
only x86_64 ppc64 ppc64le no aarch64
virt_test_type = qemu virt_test_type = qemu
type = invalid_cpu_device_hotplug type = invalid_cpu_device_hotplug
required_qemu = [2.6.0, ) required_qemu = [2.6.0, )
...@@ -16,8 +16,11 @@ ...@@ -16,8 +16,11 @@
error_desc = "core {0} already populated" error_desc = "core {0} already populated"
x86_64: x86_64:
Windows: 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" 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: - invalid_id:
execute_test = invalid_vcpu execute_test = invalid_vcpu
ppc64, ppc64le: ppc64, ppc64le:
...@@ -33,6 +36,9 @@ ...@@ -33,6 +36,9 @@
ppc64, ppc64le: ppc64, ppc64le:
error_desc = "invalid core id {0}" error_desc = "invalid core id {0}"
invalid_ids = 1 -1 -2 invalid_ids = 1 -1 -2
s390x:
error_desc = "Parameter 'core-id' expects uint32_t"
invalid_ids = -1
- nr_threads: - nr_threads:
invalid_property = nr-threads invalid_property = nr-threads
only ppc64 ppc64le only ppc64 ppc64le
...@@ -44,3 +50,5 @@ ...@@ -44,3 +50,5 @@
error_desc = "core id {0} out of range" error_desc = "core id {0} out of range"
x86_64: x86_64:
error_desc = "Invalid CPU {1}: {0} must be in range 0:{2}" 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}"
...@@ -113,6 +113,7 @@ def run(test, params, env): ...@@ -113,6 +113,7 @@ def run(test, params, env):
hotpluggable_test = params["hotpluggable_test"] hotpluggable_test = params["hotpluggable_test"]
verify_wait_timeout = params.get_numeric("verify_wait_timeout", 60) verify_wait_timeout = params.get_numeric("verify_wait_timeout", 60)
sub_test_type = params.get("sub_test_type") 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 = env.get_vm(params["main_vm"])
vm.verify_alive() vm.verify_alive()
...@@ -159,9 +160,9 @@ def run(test, params, env): ...@@ -159,9 +160,9 @@ def run(test, params, env):
if vm.is_alive(): if vm.is_alive():
session = vm.wait_for_login(timeout=login_timeout) session = vm.wait_for_login(timeout=login_timeout)
check_guest_cpu_count(expected_vcpus) check_guest_cpu_count(expected_vcpus)
if (expected_vcpus == maxcpus and if expected_vcpus == maxcpus and check_cpu_topology:
not cpu_utils.check_guest_cpu_topology(session, os_type, if not cpu_utils.check_guest_cpu_topology(session, os_type,
vm.cpuinfo)): vm.cpuinfo):
session.close() session.close()
test.fail("CPU topology of guest is inconsistent with " test.fail("CPU topology of guest is inconsistent with "
"expectations.") "expectations.")
...@@ -5,6 +5,7 @@ import logging ...@@ -5,6 +5,7 @@ import logging
from provider import cpu_utils from provider import cpu_utils
from virttest import arch
from virttest import error_context from virttest import error_context
from virttest import utils_misc from virttest import utils_misc
from virttest import utils_package from virttest import utils_package
...@@ -39,6 +40,7 @@ def run(test, params, env): ...@@ -39,6 +40,7 @@ def run(test, params, env):
session.cmd(install_cmd) session.cmd(install_cmd)
os_type = params["os_type"] os_type = params["os_type"]
vm_arch_name = params.get('vm_arch_name', arch.ARCH)
login_timeout = params.get_numeric("login_timeout", 360) login_timeout = params.get_numeric("login_timeout", 360)
stress_duration = params.get_numeric("stress_duration", 180) stress_duration = params.get_numeric("stress_duration", 180)
verify_wait_timeout = params.get_numeric("verify_wait_timeout", 60) verify_wait_timeout = params.get_numeric("verify_wait_timeout", 60)
...@@ -88,14 +90,16 @@ def run(test, params, env): ...@@ -88,14 +90,16 @@ def run(test, params, env):
"%.2f%%" % (cpu_id, cpu_usage_rate)) "%.2f%%" % (cpu_id, cpu_usage_rate))
logging.info("Usage rate of vCPU(%s) is: %.2f%%", cpu_id, logging.info("Usage rate of vCPU(%s) is: %.2f%%", cpu_id,
cpu_usage_rate) cpu_usage_rate)
for vcpu_dev in vcpu_devices: if not vm_arch_name.startswith("s390"):
error_context.context("Hotunplug vcpu device: %s" % vcpu_dev, for vcpu_dev in vcpu_devices:
logging.info) error_context.context("Hotunplug vcpu device: %s" % vcpu_dev,
vm.hotunplug_vcpu_device(vcpu_dev) logging.info)
# Drift the running stress task to other vCPUs vm.hotunplug_vcpu_device(vcpu_dev)
time.sleep(random.randint(5, 10)) # Drift the running stress task to other vCPUs
if vm.get_cpu_count() != smp: time.sleep(random.randint(5, 10))
test.fail("Actual number of guest CPUs is not equal to expected") if vm.get_cpu_count() != smp:
test.fail("Actual number of guest CPUs is not equal to "
"expected")
stress_tool.unload_stress() stress_tool.unload_stress()
stress_tool.clean() stress_tool.clean()
else: else:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册