Skip to content

Commit

Permalink
Merge pull request #3882 from xiagao/bz2220-driver-status
Browse files Browse the repository at this point in the history
Update driver status check method
  • Loading branch information
vivianQizhu authored Apr 29, 2024
2 parents 9dc7de3 + 129e403 commit b5a40b3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
12 changes: 9 additions & 3 deletions virttest/utils_test/qemu/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from virttest import error_context, qemu_monitor, utils_misc
from virttest.qemu_devices import qdevices
from virttest.staging import utils_memory
from virttest.utils_windows import virtio_win

LOG = logging.getLogger("avocado." + __name__)

Expand Down Expand Up @@ -204,10 +205,15 @@ def _check_driver_stat():

for drv in driver.split():
error_context.context("Check %s driver state." % drv, LOG.info)
driver_svc_map = virtio_win.DRIVER_SVC_MAP
driver_svc = driver_svc_map[drv] if drv in driver_svc_map.keys() else drv

driver_check_cmd = (
r'wmic sysdriver where PathName="C:\\Windows\\System32'
r'\\drivers\\%s.sys" get State /value'
) % drv
r"powershell -command"
r' "Get-WmiObject Win32_SystemDriver | Where-Object'
r" { $_.Name -eq '%s' }"
r' | Select-Object state,pathname"'
) % driver_svc

if not utils_misc.wait_for(_check_driver_stat, timeout, 0, 5):
test.error("%s driver is not running" % drv)
Expand Down
8 changes: 8 additions & 0 deletions virttest/utils_windows/virtio_win.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@
LOG = logging.getLogger("avocado." + __name__)


DRIVER_SVC_MAP = {
"viorng": "VirtRng",
"vioser": "VirtioSerial",
"viofs": "VirtioFsDrv",
"vioinput": "VirtioInput",
}


def arch_dirname_iso(session):
"""
Get architecture directory's name - iso media version.
Expand Down

0 comments on commit b5a40b3

Please sign in to comment.