Skip to content

Commit

Permalink
Merge pull request autotest#2594 from peixiu/cpu_hotplug_workaround
Browse files Browse the repository at this point in the history
cpu_device_hotpluggable: Add a workaround for win2016 guest
  • Loading branch information
PaulYuuu authored Jan 19, 2021
2 parents 9c375f5 + c081082 commit 19a88d0
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 1 deletion.
34 changes: 34 additions & 0 deletions provider/win_wora.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
"""
windows workaround functions.
"""
import logging
import re

from virttest import error_context
from virttest import utils_misc


@error_context.context_aware
def modify_driver(params, session):
"""
Add a workaround for win2016 guest to solve the issue that
"HID Button over Interrupt Driver" does occupy hot-added cpu's driver,
cause the system cannot detected new added cpu, need modify the driver.
issue details please refer to:
https://support.huawei.com/enterprise/zh/doc/EDOC1100034211/5ba99a60.
"""
devcon_path = utils_misc.set_winutils_letter(session,
params["devcon_path"])
dev_hwid = params["dev_hwid"]
chk_cmd = '%s find %s' % (devcon_path, dev_hwid)
chk_pat = r'ACPI\\ACPI0010.*\: Generic Bus'
if not re.search(chk_pat, session.cmd(chk_cmd)):
error_context.context("Install 'HID Button over Interrupt Driver' "
"to Generic Bus", logging.info)
inst_cmd = '%s install %s %s' % (devcon_path,
params["driver_inf_file"],
dev_hwid)
if session.cmd_status(inst_cmd, timeout=60):
logging.error("'HID Button over Interrupt Driver' modify failed")
logging.info("'HID Button over Interrupt Driver' modify finished")
7 changes: 7 additions & 0 deletions qemu/tests/cfg/cpu_device_hotplug_maximum.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@
machine_type_extra_params = "kernel-irqchip=split"
intel_iommu = yes
virtio_dev_iommu_platform = on
Win2016:
# Set a workaround for win2016 guest
workaround_need = yes
devcon_dir = "win7_amd64"
devcon_path = "WIN_UTILS:\devcon\${devcon_dir}\devcon.exe"
driver_inf_file = "C:\Windows\INF\machine.inf"
dev_hwid = '"ACPI\VEN_ACPI&DEV_0010"'
variants:
- max_socket:
only Linux
Expand Down
7 changes: 7 additions & 0 deletions qemu/tests/cfg/cpu_device_hotpluggable.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
only Win2008, Win2012, Win2016, Win2019
Win2008, Win2012, s390x:
check_cpu_topology = no
Win2016:
# Set a workaround for win2016 guest
workaround_need = yes
devcon_dir = "win7_amd64"
devcon_path = "WIN_UTILS:\devcon\${devcon_dir}\devcon.exe"
driver_inf_file = "C:\Windows\INF\machine.inf"
dev_hwid = '"ACPI\VEN_ACPI&DEV_0010"'
required_qemu = [2.6.0, )
ppc64, ppc64le:
required_qemu = [2.12.0, )
Expand Down
7 changes: 7 additions & 0 deletions qemu/tests/cfg/invalid_cpu_device_hotplug.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@
qemu_sandbox = on
vcpu_devices = vcpu1
monitor_type = qmp
Win2016:
# Set a workaround for win2016 guest
workaround_need = yes
devcon_dir = "win7_amd64"
devcon_path = "WIN_UTILS:\devcon\${devcon_dir}\devcon.exe"
driver_inf_file = "C:\Windows\INF\machine.inf"
dev_hwid = '"ACPI\VEN_ACPI&DEV_0010"'
variants:
- in_use_id:
execute_test = in_use_vcpu
Expand Down
4 changes: 4 additions & 0 deletions qemu/tests/cpu_device_hotplug_maximum.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from virttest.utils_version import VersionInterval

from provider import cpu_utils
from provider import win_wora


@error_context.context_aware
Expand Down Expand Up @@ -74,6 +75,9 @@ def run(test, params, env):
smp = cpuinfo.smp
vcpus_count = vm.params.get_numeric("vcpus_count")

if params.get_boolean("workaround_need"):
win_wora.modify_driver(params, session)

error_context.context("Check the number of guest CPUs after startup",
logging.info)
if not cpu_utils.check_if_vm_vcpus_match_qemu(vm):
Expand Down
5 changes: 5 additions & 0 deletions qemu/tests/cpu_device_hotpluggable.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from virttest.virt_vm import VMDeviceCheckError

from provider import cpu_utils
from provider import win_wora


@error_context.context_aware
Expand Down Expand Up @@ -134,10 +135,14 @@ def sub_pause_resume():
else:
pluggable_vcpu_dev = vcpu_devices[::-1]

if params.get_boolean("workaround_need"):
win_wora.modify_driver(params, session)

if params.get("pause_vm_before_hotplug", "no") == "yes":
error_context.context("Pause guest before %s" % hotpluggable_test,
logging.info)
vm.pause()

error_context.context("%s all vcpu devices" % hotpluggable_test,
logging.info)
for vcpu_dev in pluggable_vcpu_dev:
Expand Down
4 changes: 4 additions & 0 deletions qemu/tests/cpu_device_hotpluggable_with_numa.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from virttest import utils_package

from provider import cpu_utils
from provider import win_wora


@error_context.context_aware
Expand Down Expand Up @@ -75,6 +76,9 @@ def get_guest_numa_cpus_info():
vm.create(params=params)
session = vm.wait_for_login(timeout=login_timeout)

if params.get_boolean("workaround_need"):
win_wora.modify_driver(params, session)

error_context.context("Check the number of guest CPUs after startup",
logging.info)
if not cpu_utils.check_if_vm_vcpus_match_qemu(vm):
Expand Down
4 changes: 4 additions & 0 deletions qemu/tests/cpu_device_hotpluggable_with_stress.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import logging

from provider import cpu_utils
from provider import win_wora

from virttest import arch
from virttest import error_context
Expand Down Expand Up @@ -50,6 +51,9 @@ def heavyload_install():
vm.verify_alive()
session = vm.wait_for_login(timeout=login_timeout)

if params.get_boolean("workaround_need"):
win_wora.modify_driver(params, session)

error_context.context("Check the number of guest CPUs after startup",
logging.info)
if not cpu_utils.check_if_vm_vcpus_match_qemu(vm):
Expand Down
7 changes: 6 additions & 1 deletion qemu/tests/invalid_cpu_device_hotplug.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from virttest.qemu_monitor import QMPCmdError

from provider import cpu_utils
from provider import win_wora


@error_context.context_aware
Expand Down Expand Up @@ -122,7 +123,10 @@ def hotplug_outofrange_vcpu():
error_desc = params["error_desc"]
vm = env.get_vm(params["main_vm"])
vm.verify_alive()
vm.wait_for_login()
session = vm.wait_for_login()

if params.get_boolean("workaround_need"):
win_wora.modify_driver(params, session)

error_context.context("Check the number of guest CPUs after startup",
logging.info)
Expand All @@ -139,3 +143,4 @@ def hotplug_outofrange_vcpu():
"invalid_vcpu": hotplug_invalid_vcpu,
"out_of_range_vcpu": hotplug_outofrange_vcpu}
invalid_hotplug_tests[params["execute_test"]]()
session.close()

0 comments on commit 19a88d0

Please sign in to comment.