# HG changeset patch
# User Zhengang Li <lizg(a)cn.ibm.com>
# Date 1208917403 -28800
# Node ID 3257a3ddfc06a5a209eca97fbae3d540f58fc45a
# Parent a20a76b510101a4ea56501b02315dc5e0bcb18e5
[TEST] .2# Add cim_destroy to VirtCIM class
- updated to comply with 80 column line max length.
Signed-off-by: Zhengang Li <lizg(a)cn.ibm.com>
diff -r a20a76b51010 -r 3257a3ddfc06 suites/libvirt-cim/lib/XenKvmLib/vxml.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py Wed Apr 23 10:17:49 2008 +0800
+++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py Wed Apr 23 10:23:23 2008 +0800
@@ -43,7 +43,7 @@ from XenKvmLib import const
from XenKvmLib import const
from CimTest.Globals import logger, CIM_IP, CIM_PORT, CIM_NS, CIM_USER, CIM_PASS
from CimTest.ReturnCodes import SKIP
-from XenKvmLib.classes import virt_types
+from XenKvmLib.classes import virt_types, get_typed_class
class XMLClass:
xml_string = ""
@@ -434,6 +434,19 @@ class VirtCIM:
set_uuid(viruuid(self.domain_name, ip, self.virt))
return True
+ def cim_destroy(self, ip):
+ service = vsms.get_vsms_class(self.virt)(ip)
+ cs_cn = get_typed_class(self.virt, 'ComputerSystem')
+ keys = { 'Name' : self.domain_name, 'CreationClassName' : cs_cn}
+ target = pywbem.cim_obj.CIMInstanceName(cs_cn, keybindings = keys)
+ try:
+ ret = service.DestroySystem(AffectedSystem=target)
+ except Exception, details:
+ logger.error('Error invoking DestroySystem')
+ logger.error('Got error %s with exception %s' \
+ % (details, details.__class__.__name__))
+ return False
+ return ret[0] == 0
class XenXML(VirtXML, VirtCIM):