# HG changeset patch
# User Zhengang Li <lizg(a)cn.ibm.com>
# Date 1208850226 -28800
# Node ID 2357fe747faf722cbadcb8f25024e2f6f4522045
# Parent fbc408651246e797551d246fdbe995f92609a4c6
[TEST] Add cim_destroy to VirtCIM class
Signed-off-by: Zhengang Li <lizg(a)cn.ibm.com>
diff -r fbc408651246 -r 2357fe747faf suites/libvirt-cim/lib/XenKvmLib/vxml.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py Tue Apr 22 15:33:50 2008 +0800
+++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py Tue Apr 22 15:43:46 2008 +0800
@@ -42,7 +42,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 = ""
@@ -427,6 +427,20 @@ 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')
+ target = pywbem.cim_obj.CIMInstanceName(cs_cn, keybindings = {
+ 'Name':
self.domain_name,
+ 'CreationClassName':
cs_cn})
+ 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):