Modify the various tests to add support for a keyboard input device which
was added to libvirt 1.2.2 for KVM
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
.../cimtest/HostSystem/02_hostsystem_to_rasd.py | 12 ++++++++++--
.../libvirt-cim/cimtest/SystemDevice/01_forward.py | 10 +++++++++-
suites/libvirt-cim/cimtest/VSSD/04_vssd_to_rasd.py | 19 ++++++++++++++++++-
.../VirtualSystemSettingDataComponent/02_reverse.py | 20 ++++++++++++++------
4 files changed, 51 insertions(+), 10 deletions(-)
diff --git a/suites/libvirt-cim/cimtest/HostSystem/02_hostsystem_to_rasd.py
b/suites/libvirt-cim/cimtest/HostSystem/02_hostsystem_to_rasd.py
index 828dd9f..3355f5d 100644
--- a/suites/libvirt-cim/cimtest/HostSystem/02_hostsystem_to_rasd.py
+++ b/suites/libvirt-cim/cimtest/HostSystem/02_hostsystem_to_rasd.py
@@ -170,9 +170,10 @@ def verify_RASD_values(server, sd_assoc_info, vsxml,
virt="Xen"):
status = FAIL
break
index = (len(assoc_info) - 1)
- assoc_val = assoc_info[index]
rasd = rasd_values[cn]
+ assoc_val = assoc_info[index]
CCName = assoc_val.classname
+ InstanceID = assoc_val['InstanceID']
if 'ProcResourceAllocationSettingData' in CCName:
status = verify_procrasd_values(assoc_info[index], rasd)
elif 'NetResourceAllocationSettingData' in CCName:
@@ -185,7 +186,14 @@ def verify_RASD_values(server, sd_assoc_info, vsxml,
virt="Xen"):
status = verify_displayrasd_values(assoc_info[index], rasd)
elif 'ControllerResourceAllocationSettingData' in CCName:
status = verify_controllerrasd_values(assoc_info[index], rasd)
- elif 'InputResourceAllocationSettingData' in CCName:
+ elif 'InputResourceAllocationSettingData' in CCName and \
+ virt == 'KVM' and 'keyboard' in InstanceID :
+ # Force the issue - dictionary is keyed this way if
+ # there is a keyboard device supported
+ rasd = rasd_values['KVM_Keyboard']
+ status = verify_inputrasd_values(assoc_info[index], rasd)
+ elif 'InputResourceAllocationSettingData' in CCName and \
+ 'keyboard' not in InstanceID:
status = verify_inputrasd_values(assoc_info[index], rasd)
if status != PASS and virt == 'LXC':
return XFAIL_RC(libvirt_bug)
diff --git a/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py
b/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py
index d363895..f81aff1 100644
--- a/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py
+++ b/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py
@@ -32,6 +32,7 @@ from XenKvmLib import vxml
from XenKvmLib.classes import get_typed_class
from CimTest.Globals import logger
from XenKvmLib.const import do_main, get_provider_version
+from XenKvmLib.xm_virt_util import virsh_version, virsh_version_cmp
from CimTest.ReturnCodes import PASS, FAIL
sup_types = ['Xen', 'KVM', 'XenFV', 'LXC']
@@ -101,8 +102,15 @@ def main():
point_device = "%s/%s" %(test_dom, "mouse:xen")
else:
point_device = "%s/%s" %(test_dom, "mouse:ps2")
+ keybd_device = "%s/%s" %(test_dom, "keyboard:ps2")
+ libvirt_version = virsh_version(server, virt)
- exp_pllist[input_cn] = [point_device]
+ # libvirt 1.2.2 adds a keyboard as an input option for KVM domains
+ # so we need to handle that
+ if virt == 'KVM' and virsh_version_cmp(libvirt_version, "1.2.2")
>= 0:
+ exp_pllist[input_cn] = [point_device, keybd_device]
+ else:
+ exp_pllist[input_cn] = [point_device]
disk_cn = get_typed_class(virt, "LogicalDisk")
exp_pllist[disk_cn] = [ '%s/%s' % (test_dom, test_disk)]
diff --git a/suites/libvirt-cim/cimtest/VSSD/04_vssd_to_rasd.py
b/suites/libvirt-cim/cimtest/VSSD/04_vssd_to_rasd.py
index bac0876..86cd6a9 100755
--- a/suites/libvirt-cim/cimtest/VSSD/04_vssd_to_rasd.py
+++ b/suites/libvirt-cim/cimtest/VSSD/04_vssd_to_rasd.py
@@ -51,6 +51,7 @@ from XenKvmLib.test_doms import destroy_and_undefine_all
from XenKvmLib import assoc
from XenKvmLib.vxml import get_class
from XenKvmLib.classes import get_typed_class
+from XenKvmLib.xm_virt_util import virsh_version, virsh_version_cmp
from XenKvmLib import rasd
from XenKvmLib.rasd import verify_procrasd_values, verify_netrasd_values, \
verify_diskrasd_values, verify_memrasd_values, verify_displayrasd_values, \
@@ -175,9 +176,19 @@ def verify_rasd_values(rasd_values_info, server):
controllerrasd = rasd_values_list['%s' %in_list['controller']]
inputrasd = rasd_values_list['%s' %in_list['point']]
+ # libvirt 1.2.2 adds a keyboard as an input option for KVM domains
+ # so we need to handle that
+ has_keybd = False
+ if virt == 'KVM':
+ libvirt_version = virsh_version(server, virt)
+ if virsh_version_cmp(libvirt_version, "1.2.2") >= 0:
+ keybdrasd = rasd_values_list['%s' %in_list['keyboard']]
+ has_keybd = True
+
try:
for rasd_instance in rasd_values_info:
CCName = rasd_instance.classname
+ InstanceID = rasd_instance['InstanceID']
if 'ProcResourceAllocationSettingData' in CCName:
status = verify_procrasd_values(rasd_instance, procrasd)
elif 'NetResourceAllocationSettingData' in CCName :
@@ -191,7 +202,13 @@ def verify_rasd_values(rasd_values_info, server):
elif 'ControllerResourceAllocationSettingData' in CCName :
status = verify_controllerrasd_values(rasd_instance,
controllerrasd)
- elif 'InputResourceAllocationSettingData' in CCName:
+ elif 'InputResourceAllocationSettingData' in CCName and \
+ virt == 'KVM' and 'keyboard' in InstanceID :
+ # Force the issue - dictionary is keyed this way if
+ # there is a keyboard device supported
+ status = verify_displayrasd_values(rasd_instance, keybdrasd)
+ elif 'InputResourceAllocationSettingData' in CCName and \
+ 'keyboard' not in InstanceID:
status = verify_inputrasd_values(rasd_instance, inputrasd)
if status != PASS and virt== 'LXC':
return XFAIL_RC(libvirt_bug)
diff --git a/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py
b/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py
index 2f0bdd4..a7e6c17 100644
--- a/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py
+++ b/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py
@@ -51,6 +51,7 @@ from XenKvmLib import assoc
from XenKvmLib.test_doms import destroy_and_undefine_all
from XenKvmLib import vxml
from XenKvmLib.classes import get_typed_class
+from XenKvmLib.xm_virt_util import virsh_version, virsh_version_cmp
from CimTest.Globals import logger, CIM_ERROR_ASSOCIATORS
from XenKvmLib.const import do_main, get_provider_version
from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC
@@ -78,6 +79,7 @@ def assoc_values(ip, assoc_info, virt="Xen"):
input_device = "mouse:xen"
else:
input_device = "mouse:ps2"
+ keybd_device = "keyboard:ps2"
rasd_list = {
"proc_rasd" : '%s/%s' %(test_dom, "proc"),
@@ -86,14 +88,21 @@ def assoc_values(ip, assoc_info, virt="Xen"):
"mem_rasd" : '%s/%s' %(test_dom, "mem"),
"input_rasd": '%s/%s' %(test_dom, input_device),
"grap_rasd" : '%s/%s' %(test_dom, "vnc")
-
}
curr_cim_rev, changeset = get_provider_version(virt, ip)
- if curr_cim_rev >= controller_rev and virt == 'KVM':
- # Add controllers too ... will need a cim/cimtest version check
- rasd_list.update({"pci_rasd":"%s/controller:pci:0" %
test_dom})
- rasd_list.update({"usb_rasd":"%s/controller:usb:0" %
test_dom})
+ if virt == 'KVM':
+ # libvirt 1.2.2 adds a keyboard as an input option for KVM domains
+ # so we need to handle that
+ libvirt_version = virsh_version(ip, virt)
+ if virsh_version_cmp(libvirt_version, "1.2.2") >= 0:
+ rasd_list.update({"keybd_rasd":
+ '%s/%s' %(test_dom, keybd_device)})
+
+ if curr_cim_rev >= controller_rev:
+ # Add controllers too ... will need a cim/cimtest version check
+ rasd_list.update({"pci_rasd":"%s/controller:pci:0" %
test_dom})
+ rasd_list.update({"usb_rasd":"%s/controller:usb:0" %
test_dom})
expect_rasds = len(rasd_list)
@@ -111,7 +120,6 @@ def assoc_values(ip, assoc_info, virt="Xen"):
grap_cn = get_typed_class(virt, 'GraphicsResourceAllocationSettingData')
ctl_cn = get_typed_class(virt,
'ControllerResourceAllocationSettingData')
- # REVISIT - VERSION CHECK?
rasd_cns = [proc_cn, net_cn, disk_cn, mem_cn, input_cn, grap_cn]
if curr_cim_rev >= controller_rev and virt == 'KVM':
rasd_cns.append(ctl_cn)
--
1.8.5.3