提交 c8368bb9 编写于 作者: X Xu Han 提交者: GitHub

Merge pull request #1103 from hereischen/rfe

usb_device_check: add check max_devices_under_one_hub and mouse/tablet/kbd cases
......@@ -85,3 +85,18 @@
- input_devices_under_two_tier_hub:
no usb-ehci
usb_topology = '{"usb-hub":2,"usb-mouse":1,"usb-kbd":1,"usb-tablet":1}'
- max_devices_under_one_hub:
no usb-ehci
usb_topology = '{"usb-hub":1,"usb-mouse":8}'
- usb_mouse:
Host_RHEL.m6:
no usb-ehci
usb_topology = '{"usb-mouse":1}'
- usb_mouse_and_tablet:
Host_RHEL.m6:
no usb-ehci
usb_topology = '{"usb-mouse":1,"usb-tablet":1}'
- usb_kbd:
Host_RHEL.m6:
no usb-ehci
usb_topology = '{"usb-kbd":1}'
import json
try:
import simplejson as json
except ImportError:
import json
from collections import OrderedDict, Counter
from collections import OrderedDict
from virttest import utils_misc
......@@ -106,8 +109,9 @@ def verify_usb_device_in_guest(params, session, devs):
if dev[1] not in output:
return False
# match number of devices
counter = Counter(dev[1] for dev in devs)
for k, v in counter.items():
dev_list = [dev[1] for dev in devs]
dev_nums = dict((i, dev_list.count(i)) for i in dev_list)
for k, v in dev_nums.items():
if output.count(k) != v:
return False
return True
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册