On 10/11/2013 07:09 AM, Viktor Mihajlovski wrote:
The test domains are now defined with a ConsoleRASD if the
tested libvirt-cim does support those. A few testcases had
to be adjusted to properly handle the newly encountered instances
and associations.
Signed-off-by: Viktor Mihajlovski <mihajlov(a)linux.vnet.ibm.com>
---
.../cimtest/ElementSettingData/01_forward.py | 5 ++-
.../cimtest/HostSystem/02_hostsystem_to_rasd.py | 2 ++
.../ResourceAllocationFromPool/01_forward.py | 3 ++
.../ResourceAllocationFromPool/02_reverse.py | 3 ++
.../libvirt-cim/cimtest/SystemDevice/01_forward.py | 5 +++
suites/libvirt-cim/cimtest/VSSD/04_vssd_to_rasd.py | 11 ++++--
.../02_reverse.py | 9 +++--
suites/libvirt-cim/lib/XenKvmLib/devices.py | 6 ++++
suites/libvirt-cim/lib/XenKvmLib/rasd.py | 21 ++++++++++-
suites/libvirt-cim/lib/XenKvmLib/vsms.py | 35 ++++++++++++++++++
suites/libvirt-cim/lib/XenKvmLib/vxml.py | 38 ++++++++++++++------
11 files changed, 122 insertions(+), 16 deletions(-)
diff --git a/suites/libvirt-cim/cimtest/ElementSettingData/01_forward.py
b/suites/libvirt-cim/cimtest/ElementSettingData/01_forward.py
index 8c2a556..8b57b8f 100755
--- a/suites/libvirt-cim/cimtest/ElementSettingData/01_forward.py
+++ b/suites/libvirt-cim/cimtest/ElementSettingData/01_forward.py
@@ -59,6 +59,7 @@ from XenKvmLib.const import do_main, get_provider_version
sup_types = ['Xen', 'XenFV', 'KVM', 'LXC']
input_graphics_pool_rev = 757
+console_rev = 1276
test_dom = "esd_dom"
vmac = "00:11:22:33:44:aa"
@@ -148,7 +149,9 @@ def main():
if curr_cim_rev >= input_graphics_pool_rev:
keys['InputResourceAllocationSettingData'] = input_device
keys['GraphicsResourceAllocationSettingData'] = "%s/vnc" %
test_dom
-
+ if curr_cim_rev >= console_rev:
+ keys['ConsoleResourceAllocationSettingData'] =
"%s/charconsole:0" % test_dom
+
ret = cxml.cim_define(options.ip)
if not ret:
logger.error("Failed to define the dom: %s", test_dom)
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 fe0f2cc..78433e7 100644
--- a/suites/libvirt-cim/cimtest/HostSystem/02_hostsystem_to_rasd.py
+++ b/suites/libvirt-cim/cimtest/HostSystem/02_hostsystem_to_rasd.py
@@ -182,6 +182,8 @@ def verify_RASD_values(server, sd_assoc_info, vsxml,
virt="Xen"):
status = verify_memrasd_values(assoc_info[index], rasd)
elif 'GraphicsResourceAllocationSettingData' in CCName:
status = verify_displayrasd_values(assoc_info[index], rasd)
+ elif 'ConsoleResourceAllocationSettingData' in CCName:
+ status = verify_displayrasd_values(assoc_info[index], rasd)
elif 'InputResourceAllocationSettingData' in CCName:
status = verify_inputrasd_values(assoc_info[index], rasd)
if status != PASS and virt == 'LXC':
diff --git a/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/01_forward.py
b/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/01_forward.py
index a7d9c35..ec47c44 100644
--- a/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/01_forward.py
+++ b/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/01_forward.py
@@ -75,6 +75,9 @@ def init_rasd_list(virt, ip, guest_name):
logger.error("Enum RASDs failed")
return rasd_insts, status
+ if rasds.has_key(get_typed_class(virt,
'ConsoleResourceAllocationSettingData')):
+ del rasds[get_typed_class(virt,
'ConsoleResourceAllocationSettingData')]
+
for rasd_cn, rasd_list in rasds.iteritems():
if virt == "LXC" and rasd_cn == disk_rasd_cn:
continue
diff --git a/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/02_reverse.py
b/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/02_reverse.py
index bef114d..430d33f 100644
--- a/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/02_reverse.py
+++ b/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/02_reverse.py
@@ -171,6 +171,9 @@ def main():
if status != PASS:
raise Exception("Unable to build pool instance list")
+ if rasds.has_key(get_typed_class(options.virt,
'ConsoleResourceAllocationSettingData')):
+ del rasds[get_typed_class(options.virt,
'ConsoleResourceAllocationSettingData')]
+
if len(rasds) != len(pools):
raise Exception("%d RASD insts != %d pool insts" % (len(rasds),
len(pools)))
diff --git a/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py
b/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py
index 15a4ff5..f956621 100644
--- a/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py
+++ b/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py
@@ -36,6 +36,7 @@ from CimTest.ReturnCodes import PASS, FAIL
sup_types = ['Xen', 'KVM', 'XenFV', 'LXC']
input_graphics_pool_rev = 757
+console_dev_rev = 1276
test_dom = "test_domain"
test_mac = "00:11:22:33:44:55"
@@ -120,6 +121,10 @@ def main():
graphics_cn = get_typed_class(virt, "DisplayController")
exp_pllist[graphics_cn] = ['%s/vnc' % test_dom]
+ if curr_cim_rev >= console_dev_rev:
+ console_cn = get_typed_class(virt, "ConsoleDisplayController")
+ exp_pllist[console_cn] = ['%s/charconsole:0' % test_dom]
+
try:
res_pllist = {}
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 04b0b6e..bdd91a8 100755
--- a/suites/libvirt-cim/cimtest/VSSD/04_vssd_to_rasd.py
+++ b/suites/libvirt-cim/cimtest/VSSD/04_vssd_to_rasd.py
@@ -54,7 +54,7 @@ from XenKvmLib.classes import get_typed_class
from XenKvmLib import rasd
from XenKvmLib.rasd import verify_procrasd_values, verify_netrasd_values, \
verify_diskrasd_values, verify_memrasd_values, verify_displayrasd_values, \
-rasd_init_list, verify_inputrasd_values
+rasd_init_list, verify_inputrasd_values, verify_consolerasd_values
from XenKvmLib.const import default_network_name
libvirt_bug = "00009"
@@ -173,6 +173,10 @@ def verify_rasd_values(rasd_values_info, server):
memrasd = rasd_values_list['%s' %in_list['mem']]
displayrasd = rasd_values_list['%s' %in_list['display']]
inputrasd = rasd_values_list['%s' %in_list['point']]
+ if 'console' in in_list:
+ consolerasd = rasd_values_list['%s' %in_list['console']]
+ else:
+ consolerasd = []
try:
for rasd_instance in rasd_values_info:
@@ -186,7 +190,10 @@ def verify_rasd_values(rasd_values_info, server):
elif 'MemResourceAllocationSettingData' in CCName :
status = verify_memrasd_values(rasd_instance, memrasd)
elif 'GraphicsResourceAllocationSettingData' in CCName :
- status = verify_displayrasd_values(rasd_instance, displayrasd)
+ if not 'console' in rasd_instance['InstanceID']:
+ status = verify_displayrasd_values(rasd_instance, displayrasd)
+ elif 'ConsoleResourceAllocationSettingData' in CCName :
+ status = verify_consolerasd_values(rasd_instance, consolerasd)
Hmm... 'console', 'cons_rasd', 'charconsole:0' - it's all so
confusing
at least to me!
Perhaps this is where the two consoles using serial is coming from.
elif 'InputResourceAllocationSettingData' in
CCName:
status = verify_inputrasd_values(rasd_instance, inputrasd)
if status != PASS and virt== 'LXC':
diff --git a/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py
b/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py
index 3a13b2a..24e8440 100644
--- a/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py
+++ b/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py
@@ -95,7 +95,8 @@ def assoc_values(ip, assoc_info, virt="Xen"):
"disk_rasd" : '%s/%s' %(test_dom, test_disk),
"mem_rasd" : '%s/%s' %(test_dom, "mem"),
"input_rasd": '%s/%s' %(test_dom, input_device),
- "grap_rasd" : '%s/%s' %(test_dom, "vnc")
+ "grap_rasd" : '%s/%s' %(test_dom, "vnc"),
+ "cons_rasd" : '%s/%s' %(test_dom,
"charconsole:0")
}
@@ -110,6 +111,7 @@ def assoc_values(ip, assoc_info, virt="Xen"):
mem_cn = get_typed_class(virt, 'MemResourceAllocationSettingData')
input_cn = get_typed_class(virt, 'InputResourceAllocationSettingData')
grap_cn = get_typed_class(virt,
'GraphicsResourceAllocationSettingData')
+ cons_cn = get_typed_class(virt, 'ConsoleResourceAllocationSettingData')
for inst in assoc_info:
if inst.classname == proc_cn:
@@ -132,8 +134,11 @@ def assoc_values(ip, assoc_info, virt="Xen"):
elif inst.classname == grap_cn:
status = check_rasd_values(inst['InstanceID'],
rasd_list['grap_rasd'])
+ elif inst.classname == cons_cn:
+ status = check_rasd_values(inst['InstanceID'],
+ rasd_list['cons_rasd'])
else:
- logger.error("Unexpected RASD instance type" )
+ logger.error("Unexpected RASD instance type %s",
inst.classname )
status = FAIL
if status == FAIL:
diff --git a/suites/libvirt-cim/lib/XenKvmLib/devices.py
b/suites/libvirt-cim/lib/XenKvmLib/devices.py
index 0ddccbb..275acad 100755
--- a/suites/libvirt-cim/lib/XenKvmLib/devices.py
+++ b/suites/libvirt-cim/lib/XenKvmLib/devices.py
@@ -33,6 +33,7 @@ from XenKvmLib.enumclass import EnumInstances
graphics_dev_rev = 725
input_dev_rev = 745
+console_dev_rev = 1276
def get_class(classname):
return eval(classname)
@@ -95,6 +96,8 @@ def dev_cn_to_rasd_cn(dev_cn, virt):
return get_typed_class(virt, "DiskResourceAllocationSettingData")
elif dev_cn.find('Memory') >= 0:
return get_typed_class(virt, "MemResourceAllocationSettingData")
+ elif dev_cn.find('ConsoleDisplayController') >= 0:
+ return get_typed_class(virt, "ConsoleResourceAllocationSettingData")
elif dev_cn.find('DisplayController') >= 0:
return get_typed_class(virt, "GraphicsResourceAllocationSettingData")
elif dev_cn.find('PointingDevice') >= 0:
@@ -112,6 +115,9 @@ def enum_dev(virt, ip):
if curr_cim_rev >= input_dev_rev:
dev_list.append('PointingDevice')
+ if curr_cim_rev >= console_dev_rev:
+ dev_list.append('ConsoleDisplayController')
+
So this will I think upset some test which says it expects 6 device but
got 7 (I forget which one).
dev_insts = {}
try:
diff --git a/suites/libvirt-cim/lib/XenKvmLib/rasd.py
b/suites/libvirt-cim/lib/XenKvmLib/rasd.py
index 4d4240a..3675015 100644
--- a/suites/libvirt-cim/lib/XenKvmLib/rasd.py
+++ b/suites/libvirt-cim/lib/XenKvmLib/rasd.py
@@ -50,9 +50,11 @@ memcn = 'Memory'
netcn = 'NetworkPort'
diskcn = 'LogicalDisk'
dccn = 'DisplayController'
+cccn = 'ConsoleDisplayController'
pdcn = 'PointingDevice'
libvirt_rasd_storagepool_changes = 934
+vsms_console_sup = 1276
def rasd_init_list(vsxml, virt, t_disk, t_dom, t_mac, t_mem, server):
"""
@@ -65,6 +67,7 @@ def rasd_init_list(vsxml, virt, t_disk, t_dom, t_mac, t_mem, server):
disk_cn = get_typed_class(virt, diskcn)
dc_cn = get_typed_class(virt, dccn)
pd_cn = get_typed_class(virt, pdcn)
+ cc_cn = None
in_list = { 'proc' : proc_cn,
'mem' : mem_cn,
@@ -75,6 +78,11 @@ def rasd_init_list(vsxml, virt, t_disk, t_dom, t_mac, t_mem, server):
}
try:
+ curr_cim_rev, changeset = get_provider_version(virt, server)
+ if curr_cim_rev >= vsms_console_sup:
+ cc_cn = get_typed_class(virt, cccn)
+ in_list['console'] = cc_cn
+
disk_path = vsxml.xml_get_disk_source()
if virt == 'LXC':
disk_path = '/var/lib/libvirt/images/lxc_files'
@@ -116,7 +124,11 @@ def rasd_init_list(vsxml, virt, t_disk, t_dom, t_mac, t_mem,
server):
pd_cn : {
"InstanceID" : point_device
}
- }
+ }
+ if cc_cn != None:
+ rasd_values[cc_cn] = {
+ "InstanceID" : "%s/%s" %(t_dom,
"charconsole:0")
+ }
Hmm.. no setting of the ResourceType value (nor anything else).
Furthermore it seems that rather than hardcoded numbers, then
RASD_TYPE_* constants should be used from XenKvmLib.vsms, right? That
includes the settings in the fields above. It certainly would make
things more clear...
except Exception, details:
logger.error("Exception: In fn rasd_init_list %s", details)
return FAIL, rasd_values, in_list
@@ -150,6 +162,13 @@ def verify_displayrasd_values(assoc_info, displayrasd_list):
status = FAIL
return status
+def verify_consolerasd_values(assoc_info, consolerasd_list):
+ status = PASS
+ if assoc_info['InstanceID'] != consolerasd_list['InstanceID']:
+ InstId_err(assoc_info, consolerasd_list)
+ status = FAIL
+ return status
+
def verify_inputrasd_values(assoc_info, inputrasd_list):
status = PASS
if assoc_info['InstanceID'] != inputrasd_list['InstanceID']:
diff --git a/suites/libvirt-cim/lib/XenKvmLib/vsms.py
b/suites/libvirt-cim/lib/XenKvmLib/vsms.py
index d7f33f9..955026f 100755
--- a/suites/libvirt-cim/lib/XenKvmLib/vsms.py
+++ b/suites/libvirt-cim/lib/XenKvmLib/vsms.py
@@ -28,6 +28,7 @@ from CimTest import Globals
from XenKvmLib import const
from XenKvmLib.classes import get_typed_class, get_class_type, virt_types
+RASD_TYPE_OTHER = 1
Should this be 32769? I'm assuming they roughly follow CIM_RES_TYPE*
values in libvirt-cim
RASD_TYPE_PROC = 3
RASD_TYPE_MEM = 4
RASD_TYPE_NET_ETHER = 10
@@ -259,6 +260,40 @@ class
LXC_MemResourceAllocationSettingData(CIM_MemResourceAllocationSettingData)
def get_masd_class(virt):
pass
+class CIM_ConsoleResourceAllocationSettingData(CIMClassMOF):
+ def __init__(self, name, source_type=2, target_type="virtio",
+ source_path=None, connect_URL=None, bind_URL=None):
+ self.InstanceID = '%s/charconsole:0' %name
+ self.ResourceType = RASD_TYPE_OTHER
+ self.OtherResourceType = 'console'
+
+ if source_type != None:
+ self.SourceType = source_type
source_type defaults to 2 or passed generally as 0, so None probably
doesn't work here, right?
+
+ if target_type != None:
+ self.TargetType = target_type
target_type defaults to "virtio", so is None ever possible?
+
+ if source_path != None:
+ self.SourcePath = source_path
+
+ if bind_URL != None:
+ self.BindURL = bind_URL
+
+ if connect_URL != None:
+ self.ConnectURL = connect_URL
+
+class
Xen_ConsoleResourceAllocationSettingData(CIM_ConsoleResourceAllocationSettingData):
+ pass
+
+class
KVM_ConsoleResourceAllocationSettingData(CIM_ConsoleResourceAllocationSettingData):
+ pass
+
+class
LXC_ConsoleResourceAllocationSettingData(CIM_ConsoleResourceAllocationSettingData):
+ pass
+
+@eval_cls('ConsoleResourceAllocationSettingData')
+def get_casd_class(virt):
+ pass
class CIM_GraphicsResourceAllocationSettingData(CIMClassMOF):
def __init__(self, name, res_sub_type="vnc", ip=None, ipv6_flag=None,
diff --git a/suites/libvirt-cim/lib/XenKvmLib/vxml.py
b/suites/libvirt-cim/lib/XenKvmLib/vxml.py
index 74c4f23..9489a5c 100644
--- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py
+++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py
@@ -50,9 +50,11 @@ from CimTest.ReturnCodes import SKIP, PASS, FAIL
from XenKvmLib.classes import virt_types, get_typed_class
from XenKvmLib.enumclass import GetInstance
from XenKvmLib.const import get_provider_version
+from XenKvmLib.xm_virt_util import host_cpu_model
vsms_graphics_sup = 763
vsms_inputdev_sup = 771
+vsms_console_sup = 1276
class XMLClass:
xml_string = ""
@@ -598,7 +600,8 @@ class VirtCIM:
def __init__(self, virt, dom_name, uuid, pae, acpi, apic, disk_dev,
disk_source, net_type, net_name, net_mac, vcpus, mem,
mem_allocunits, emu_type, grstype, ip,
- is_ipv6_only, port_num, kmap, irstype, btype, vnc_passwd):
+ is_ipv6_only, port_num, kmap, irstype, btype, vnc_passwd,
+ con_source_type, con_target_type):
self.virt = virt
self.domain_name = dom_name
self.err_rc = None
@@ -623,6 +626,9 @@ class VirtCIM:
ipv6_flag=is_ipv6_only,
lport=port_num, keymap=kmap,
vnc_passwd=vnc_passwd)
+ self.casd = vsms.get_casd_class(virt)(name=dom_name,
+ source_type=con_source_type,
+ target_type=con_target_type)
self.masd = vsms.get_masd_class(virt)(megabytes=mem,
mallocunits=mem_allocunits,
name=dom_name)
@@ -655,9 +661,14 @@ class VirtCIM:
res_settings.append(str(self.gasd))
if curr_cim_rev >= vsms_inputdev_sup:
- if self.iasd is not None:
+ if self.iasd is not None and \
+ not str(host_cpu_model(ip, self.virt)).startswith('s390'):
This probably should be in patch 2/2...
res_settings.append(str(self.iasd))
+ if curr_cim_rev >= vsms_console_sup:
+ if ref_conf is None and self.casd is not None:
+ res_settings.append(str(self.casd))
+
if ref_conf is None:
ref_conf = ' '
@@ -808,6 +819,8 @@ class VirtCIM:
self.dasd = rasd
elif cn.find("NetResourceAllocationSettingData") >= 0:
self.nasd = rasd
+ elif cn.find("ConsoleResourceAllocationSettingData") >=0:
+ self.casd = rasd
elif cn.find("GraphicsResourceAllocationSettingData") >= 0:
self.gasd = rasd
@@ -849,7 +862,8 @@ class XenXML(VirtXML, VirtCIM):
emu_type=None, grstype="vnc", address=None,
is_ipv6_only=None,
port_num='-1', keymap="en-us",
irstype="mouse",
- btype="xen", vnc_passwd=None):
+ btype="xen", vnc_passwd=None,
+ con_source_type=0, con_target_type="virtio"):
if not (os.path.exists(const.Xen_kernel_path) \
and os.path.exists(const.Xen_init_path)):
logger.error('ERROR: Either the kernel image '
@@ -863,7 +877,7 @@ class XenXML(VirtXML, VirtCIM):
disk_file_path, ntype, net_name, mac, vcpus, mem,
mem_allocunits, emu_type, grstype, address,
is_ipv6_only, port_num, keymap, irstype, btype,
- vnc_passwd)
+ vnc_passwd, con_source_type, con_target_type)
def _os(self, os_kernel, os_initrd):
os = self.get_node('/domain/os')
@@ -920,7 +934,8 @@ class KVMXML(VirtXML, VirtCIM):
emu_type=None, grstype="vnc", address=None,
is_ipv6_only=None,
port_num='-1', keymap="en-us",
irstype="mouse",
- btype="ps2", vnc_passwd=None):
+ btype="ps2", vnc_passwd=None,
+ con_source_type=0, con_target_type="virtio"):
if not os.path.exists(disk_file_path):
logger.error('Error: Disk image %s does not exist', disk_file_path)
sys.exit(1)
@@ -929,7 +944,7 @@ class KVMXML(VirtXML, VirtCIM):
disk_file_path, ntype, net_name, mac, vcpus, mem,
mem_allocunits, emu_type, grstype, address,
is_ipv6_only, port_num, keymap, irstype, btype,
- vnc_passwd)
+ vnc_passwd, con_source_type, con_target_type)
self._os()
self._devices(const.KVM_default_emulator, ntype,
disk_file_path, disk, mac, net_name)
@@ -983,7 +998,8 @@ class XenFVXML(VirtXML, VirtCIM):
emu_type=None, grstype="vnc",
address=None, is_ipv6_only=None, port_num='-1',
keymap="en-us",
- irstype="mouse", btype="ps2",
vnc_passwd=None):
+ irstype="mouse", btype="ps2",
vnc_passwd=None,
+ con_source_type=0, con_target_type="virtio"):
if not os.path.exists(disk_file_path):
logger.error('Error: Disk image %s does not exist', disk_file_path)
sys.exit(1)
@@ -992,7 +1008,8 @@ class XenFVXML(VirtXML, VirtCIM):
disk_file_path, ntype, net_name, mac, vcpus, mem,
mem_allocunits, emu_type, grstype, address,
is_ipv6_only, port_num,
- keymap, irstype, btype, vnc_passwd)
+ keymap, irstype, btype, vnc_passwd,
+ con_source_type, con_target_type)
self._os(const.XenFV_default_loader)
self._devices(const.XenFV_default_emulator,
ntype, mac, net_name, disk_file_path, disk)
@@ -1036,7 +1053,8 @@ class LXCXML(VirtXML, VirtCIM):
tty=const.LXC_default_tty, grstype="vnc",
address=None, is_ipv6_only=None, port_num='-1',
keymap="en-us",
- irstype="mouse", btype="usb",
vnc_passwd=None):
+ irstype="mouse", btype="usb",
vnc_passwd=None,
+ con_source_type=0, con_target_type="virtio"):
VirtXML.__init__(self, 'lxc', test_dom, set_uuid(), mem, vcpus)
# pae, acpi and apic parameters doesn't make sense here, so we
# statically set them to False (a.k.a. ignore them)
@@ -1045,7 +1063,7 @@ class LXCXML(VirtXML, VirtCIM):
ntype, net_name, mac, vcpus, mem,
const.default_mallocunits, None, grstype,
address, is_ipv6_only, port_num, keymap, irstype,
- btype, vnc_passwd)
+ btype, vnc_passwd, con_source_type, con_target_type)
self._os(const.LXC_init_path)
self._devices(const.LXC_default_emulator, mac, ntype, net_name,
const.LXC_default_tty)
self.create_lxc_file(CIM_IP, const.LXC_init_path)