# HG changeset patch
# User Deepti B. Kalakeri<deeptik(a)linux.vnet.ibm.com>
# Date 1225568161 25200
# Node ID e92fbb2fe87e11509a5d506f4529368f97ee59cd
# Parent d1614c101c281b57bd2bc98dfb6625f790748e54
[TEST] Fixing 01_forward.py tc of SystemDevice.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r d1614c101c28 -r e92fbb2fe87e
suites/libvirt-cim/cimtest/SystemDevice/01_forward.py
--- a/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py Wed Oct 29 20:11:47 2008
-0700
+++ b/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py Sat Nov 01 12:36:01 2008
-0700
@@ -28,7 +28,6 @@
from VirtLib import utils
from XenKvmLib import assoc
from XenKvmLib import vxml
-from XenKvmLib import devices
from XenKvmLib.classes import get_typed_class
from CimTest.Globals import logger
from XenKvmLib.const import do_main
@@ -54,7 +53,8 @@
if options.virt == 'LXC':
cxml = virt_xml(test_dom)
else:
- cxml = virt_xml(test_dom, vcpus = test_cpu, mac = test_mac, disk = test_disk)
+ cxml = virt_xml(test_dom, vcpus = test_cpu, mac = test_mac,
+ disk = test_disk)
ret = cxml.create(options.ip)
if not ret:
logger.error('Unable to create domain %s' % test_dom)
@@ -67,39 +67,36 @@
Name=test_dom, CreationClassName=cs_classname)
if devs == None:
logger.error("System association failed")
- return FAIL
- elif len(devs) == 0:
- logger.error("No devices returned")
+ cxml.destroy(options.ip)
+ cxml.undefine(options.ip)
return FAIL
+ if len(devs) == 0:
+ logger.error("No devices returned")
+ cxml.destroy(options.ip)
+ cxml.undefine(options.ip)
+ return FAIL
+
+ net_cn = get_typed_class(options.virt, "NetworkPort")
+ mem_cn = get_typed_class(options.virt, "Memory")
+ disk_cn = get_typed_class(options.virt, "LogicalDisk")
+ proc_cn = get_typed_class(options.virt, "Processor")
cn_devid = {
- get_typed_class(options.virt, "NetworkPort") : '%s/%s' %
(test_dom, test_mac),
- get_typed_class(options.virt, "Memory") : '%s/mem' %
test_dom,
- get_typed_class(options.virt, "LogicalDisk") : '%s/%s' %
(test_dom, test_disk),
- get_typed_class(options.virt, "Processor") : '%s/%s' %
(test_dom, test_cpu-1)
- }
+ net_cn : '%s/%s' % (test_dom, test_mac),
+ mem_cn : '%s/mem' % test_dom,
+ disk_cn : '%s/%s' % (test_dom, test_disk),
+ proc_cn : '%s/%s' % (test_dom, test_cpu-1)
+ }
- key_list = {'DeviceID' : '',
- 'CreationClassName' : '',
- 'SystemName' : test_dom,
- 'SystemCreationClassname' : cs_classname
- }
-
- for dev_cn in cn_devid.keys():
- for dev in devs:
- key_list['CreationClassName'] = dev['CreationClassname']
- key_list['DeviceID'] = dev['DeviceID']
- device = devices.device_of(options.ip, key_list)
- if device.CreationClassName != dev_cn:
- continue
- devid = device.DeviceID
-
- _devid = cn_devid[dev_cn]
- if devid != _devid:
- logger.error("DeviceID `%s` != `%s'" % (devid, _devid))
- status = FAIL
- else:
- logger.info("Examined %s" % _devid)
+ for dev in devs:
+ dev_cn = dev['CreationClassname']
+ devid = dev['DeviceID']
+ _devid = cn_devid[dev_cn]
+ if devid != _devid:
+ logger.error("DeviceID `%s` != `%s'" % (devid, _devid))
+ status = FAIL
+ else:
+ logger.info("Examined %s" % _devid)
cxml.destroy(options.ip)
cxml.undefine(options.ip)