# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1232714174 28800
# Node ID a2ecb7430c50fcf6df6019625ee1a8b8ae24dfd9
# Parent ef20310648bc1d22c4c6aa23bcc092a01a49e340
[TEST] #2 Adding new tc to verify KVMRedirectionSAP.
Updates from patch 1 to 2:
--------------------------
Added GRASD support in the call to DefineSytem().
Modified necessary places for GRASD.
Tested with KVM/Xen/LXC on current sources and KVM with F9 rpm.
This tc will fail with LXC, Xen with current sources.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r ef20310648bc -r a2ecb7430c50 suites/libvirt-cim/lib/XenKvmLib/const.py
--- a/suites/libvirt-cim/lib/XenKvmLib/const.py Thu Jan 22 01:15:12 2009 -0800
+++ b/suites/libvirt-cim/lib/XenKvmLib/const.py Fri Jan 23 04:36:14 2009 -0800
@@ -46,6 +46,15 @@
# Default TimeoutPeriod param for CS.RequestedStateChange()
TIME = "00000000000000.000000:000"
+
+#KVMRedirectionSAP protocol values
+KVMRedSAP_proto = { 'raw' : 2, 'rdp' : 3, 'vnc' : 4 }
+
+# CIM values for KVMRedirectionSAP.EnabledState
+CIM_SAP_ACTIVE_STATE = 2
+CIM_SAP_INACTIVE_STATE = 3
+CIM_SAP_AVAILABLE_STATE = 6
+
# vxml.NetXML
default_bridge_name = 'testbridge'
diff -r ef20310648bc -r a2ecb7430c50 suites/libvirt-cim/lib/XenKvmLib/vsms.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vsms.py Thu Jan 22 01:15:12 2009 -0800
+++ b/suites/libvirt-cim/lib/XenKvmLib/vsms.py Fri Jan 23 04:36:14 2009 -0800
@@ -33,6 +33,7 @@
RASD_TYPE_NET_ETHER = 10
RASD_TYPE_NET_OTHER = 11
RASD_TYPE_DISK = 17
+RASD_TYPE_GRAPHICS = 24
VSSD_RECOVERY_NONE = 2
VSSD_RECOVERY_RESTART = 3
@@ -232,6 +233,36 @@
def get_masd_class(virt):
pass
+
+class CIM_GraphicsResourceAllocationSettingData(CIMClassMOF):
+ def __init__(self, name, res_sub_type="vnc", ip="127.0.0.1",
+ lport='-1', keymap="en-us"):
+ self.InstanceID = '%s/graphics' %name
+ self.ResourceType = RASD_TYPE_GRAPHICS
+
+ if res_sub_type != None:
+ self.ResourceSubType = res_sub_type
+
+ if ip != None and lport != None:
+ self.Address = '%s:%s' % (ip, lport)
+
+ if keymap != None:
+ self.KeyMap = keymap
+
+
+class
Xen_GraphicsResourceAllocationSettingData(CIM_GraphicsResourceAllocationSettingData):
+ pass
+
+class
KVM_GraphicsResourceAllocationSettingData(CIM_GraphicsResourceAllocationSettingData):
+ pass
+
+class
LXC_GraphicsResourceAllocationSettingData(CIM_GraphicsResourceAllocationSettingData):
+ pass
+
+@eval_cls('GraphicsResourceAllocationSettingData')
+def get_gasd_class(virt):
+ pass
+
def default_vssd_rasd_str(dom_name='test_domain',
disk_dev='xvda',
disk_source=const.Xen_disk_path,
@@ -272,9 +303,12 @@
mallocunits=malloc_units,
name=dom_name)
+ class_gasd = get_gasd_class(virt)
+ g = class_gasd(name=dom_name)
+
# LXC only takes disk and memory device for now.
if virt == 'LXC':
- return vssd, [d.mof(), m.mof()]
+ return vssd, [d.mof(), m.mof()], g.mof()
class_nasd = get_nasd_class(virt)
if net_mac != const.Xen_default_mac:
@@ -293,5 +327,5 @@
p = class_pasd(vcpu=proc_vcpu,
name=dom_name)
- return vssd, [d.mof(), n.mof(), p.mof(), m.mof()]
+ return vssd, [d.mof(), n.mof(), p.mof(), m.mof(), g.mof()]
diff -r ef20310648bc -r a2ecb7430c50 suites/libvirt-cim/lib/XenKvmLib/vxml.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py Thu Jan 22 01:15:12 2009 -0800
+++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py Fri Jan 23 04:36:14 2009 -0800
@@ -413,7 +413,6 @@
'/domain/devices/interface/source/@network')
return networkStr
-
def dumpxml(self, ip):
cmd = 'virsh -c %s dumpxml %s' % (self.vuri, self.dname)
s, o = utils.run_remote(ip, cmd)
@@ -467,7 +466,8 @@
class VirtCIM:
def __init__(self, virt, dom_name, disk_dev, disk_source,
net_type, net_name, net_mac, vcpus, mem,
- mem_allocunits, emu_type):
+ mem_allocunits, emu_type, grstype, ip,
+ port_num, kmap):
self.virt = virt
self.domain_name = dom_name
self.err_rc = None
@@ -488,7 +488,9 @@
self.masd = vsms.get_masd_class(virt)(megabytes=mem,
mallocunits=mem_allocunits,
name=dom_name)
-
+ self.gasd = vsms.get_gasd_class(virt)(name=dom_name,
+ res_sub_type=grstype, ip=ip,
+ lport=port_num, keymap=kmap)
def cim_define(self, ip, ref_conf=None):
service = vsms.get_vsms_class(self.virt)(ip)
@@ -506,6 +508,8 @@
pass
else:
res_settings.append(str(self.nasd))
+ if self.gasd is not None:
+ res_settings.append(str(self.gasd))
if ref_conf is None:
ref_conf = ' '
@@ -657,6 +661,8 @@
self.dasd = rasd
elif cn.find("NetResourceAllocationSettingData") >= 0:
self.nasd = rasd
+ elif cn.find("GraphicsResourceAllocationSettingData") >= 0:
+ self.gasd = rasd
def verify_error_msg(self, exp_rc, exp_desc):
try:
@@ -688,7 +694,8 @@
disk=const.Xen_default_disk_dev,
ntype=const.default_net_type,
net_name=const.default_network_name,
- emu_type=None):
+ emu_type=None, grstype="vnc",
address="127.0.0.1",
+ port_num='-1', keymap="en-us"):
if not (os.path.exists(const.Xen_kernel_path) \
and os.path.exists(const.Xen_init_path)):
logger.error('ERROR: Either the kernel image '
@@ -700,7 +707,7 @@
VirtCIM.__init__(self, 'Xen', test_dom, disk, disk_file_path,
ntype, net_name, mac, vcpus, mem, mem_allocunits,
- emu_type)
+ emu_type, grstype, address, port_num, keymap)
def _os(self, os_kernel, os_initrd):
os = self.get_node('/domain/os')
@@ -750,14 +757,16 @@
disk=const.KVM_default_disk_dev,
ntype=const.default_net_type,
net_name=const.default_network_name,
- emu_type=None):
+ emu_type=None, grstype="vnc",
address="127.0.0.1",
+ port_num='-1', keymap="en-us"):
if not os.path.exists(disk_file_path):
logger.error('Error: Disk image does not exist')
sys.exit(1)
VirtXML.__init__(self, 'kvm', test_dom, set_uuid(), mem, vcpus)
VirtCIM.__init__(self, 'KVM', test_dom, disk, disk_file_path,
ntype, net_name, mac, vcpus, mem,
- mem_allocunits, emu_type)
+ mem_allocunits, emu_type, grstype, address,
+ port_num, keymap)
self._os()
self._devices(const.KVM_default_emulator, ntype,
disk_file_path, disk, mac, net_name)
@@ -802,14 +811,15 @@
disk=const.XenFV_default_disk_dev,
ntype=const.default_net_type,
net_name=const.default_network_name,
- emu_type=None):
+ emu_type=None, grstype="vnc",
+ address="127.0.0.1", port_num='-1',
keymap="en-us"):
if not os.path.exists(disk_file_path):
logger.error('Error: Disk image does not exist')
sys.exit(1)
VirtXML.__init__(self, 'xenfv', test_dom, set_uuid(), mem, vcpus)
VirtCIM.__init__(self, 'XenFV', test_dom, disk, disk_file_path,
ntype, net_name, mac, vcpus, mem, mem_allocunits,
- emu_type)
+ emu_type, grstype, address, port_num, keymap)
self._features()
self._os(const.XenFV_default_loader)
self._devices(const.XenFV_default_emulator,
@@ -856,11 +866,13 @@
mac=const.LXC_default_mac,
ntype=const.default_net_type,
net_name=const.default_network_name,
- tty=const.LXC_default_tty):
+ tty=const.LXC_default_tty, grstype="vnc",
+ address="127.0.0.1", port_num='-1',
keymap="en-us"):
VirtXML.__init__(self, 'lxc', test_dom, set_uuid(), mem, vcpus)
VirtCIM.__init__(self, 'LXC', test_dom, const.LXC_default_mp,
const.LXC_default_source, ntype, net_name, mac, vcpus,
- mem, const.default_mallocunits, None)
+ mem, const.default_mallocunits, None, grstype,
+ address, port_num, keymap)
self._os(const.LXC_init_path)
self._devices(mac, ntype, net_name, const.LXC_default_tty)
self.create_lxc_file(CIM_IP, const.LXC_init_path)