[PATCH] [TEST] #3 Use enumclass.py to cover computersystem.py behavior and update CS testes
by yunguol@cn.ibm.com
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1220420079 25200
# Node ID 9e48d953adc1414dd4d0b3e60813cbd4fd4a9669
# Parent 90ff66d2baee23319d29727d61fa9cf5d8f64f27
[TEST] #3 Use enumclass.py to cover computersystem.py behavior and update CS testes
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r 90ff66d2baee -r 9e48d953adc1 suites/libvirt-cim/cimtest/ComputerSystem/01_enum.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/01_enum.py Fri Aug 29 13:26:12 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/01_enum.py Tue Sep 02 22:34:39 2008 -0700
@@ -24,7 +24,7 @@
import sys
from XenKvmLib.const import do_main
-from XenKvmLib import computersystem
+from XenKvmLib import enumclass
from VirtLib import live
from VirtLib import utils
from CimTest import Globals
@@ -37,8 +37,9 @@ def main():
options = main.options
status = PASS
+ keys = ['Name', 'CreationClassName']
try:
- cs = computersystem.enumerate(options.ip, options.virt)
+ cs = enumclass.enumerate(options.ip, 'ComputerSystem', keys, options.virt)
live_cs = live.domain_list(options.ip, options.virt)
for system in cs:
name = system.name
diff -r 90ff66d2baee -r 9e48d953adc1 suites/libvirt-cim/cimtest/ComputerSystem/02_nosystems.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/02_nosystems.py Fri Aug 29 13:26:12 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/02_nosystems.py Tue Sep 02 22:34:39 2008 -0700
@@ -24,7 +24,7 @@
import sys
import pywbem
-from XenKvmLib import computersystem
+from XenKvmLib import enumclass
from VirtLib import live
from VirtLib import utils
from CimTest.Globals import logger, CIM_ERROR_ENUMERATE
@@ -50,8 +50,9 @@ def main():
cn = "%s_ComputerSystem" % options.virt
+ keys = ['Name', 'CreationClassName']
try:
- cs = computersystem.enumerate(options.ip, options.virt)
+ cs = enumclass.enumerate(options.ip, 'ComputerSystem', keys, options.virt)
except Exception, details:
logger.error(CIM_ERROR_ENUMERATE, cn)
diff -r 90ff66d2baee -r 9e48d953adc1 suites/libvirt-cim/cimtest/ComputerSystem/03_defineVS.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/03_defineVS.py Fri Aug 29 13:26:12 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/03_defineVS.py Tue Sep 02 22:34:39 2008 -0700
@@ -27,7 +27,7 @@
# 26-Sep-2007
import sys
-from XenKvmLib import computersystem
+from XenKvmLib import enumclass
from XenKvmLib import vxml
from XenKvmLib.classes import get_typed_class
from VirtLib import utils
@@ -49,8 +49,9 @@ def main():
Globals.logger.error(VIRSH_ERROR_DEFINE % test_dom)
return status
+ keys = ['Name', 'CreationClassName']
try:
- cs = computersystem.enumerate(options.ip, options.virt)
+ cs = enumclass.enumerate(options.ip, 'ComputerSystem', keys, options.virt)
if len(cs) == 0:
raise Exception('No cs instance returned')
for dom in cs:
diff -r 90ff66d2baee -r 9e48d953adc1 suites/libvirt-cim/cimtest/ComputerSystem/04_defineStartVS.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/04_defineStartVS.py Fri Aug 29 13:26:12 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/04_defineStartVS.py Tue Sep 02 22:34:39 2008 -0700
@@ -32,8 +32,8 @@ import sys
import sys
from time import sleep
from XenKvmLib import vxml
-from XenKvmLib import computersystem
-from CimTest import Globals
+from XenKvmLib import enumclass
+from CimTest import Globals, CimExt
from XenKvmLib.classes import get_typed_class
from XenKvmLib.const import do_main
from CimTest.ReturnCodes import PASS, FAIL
@@ -62,8 +62,11 @@ def main():
# otherwise.
for i in range(1, (timeout + 1)):
sleep(1)
- cs = computersystem.get_cs_class(options.virt)(options.ip,
- test_dom)
+ keys = {
+ 'Name' : test_dom,
+ 'CreationClassName' : get_typed_class(options.virt, 'ComputerSystem')
+ }
+ cs = enumclass.getInstance(options.ip, 'ComputerSystem', keys, options.virt)
if cs.Name != test_dom:
Globals.logger.error("VS %s is not defined" % test_dom)
break
diff -r 90ff66d2baee -r 9e48d953adc1 suites/libvirt-cim/cimtest/ComputerSystem/05_activate_defined_start.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/05_activate_defined_start.py Fri Aug 29 13:26:12 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/05_activate_defined_start.py Tue Sep 02 22:34:39 2008 -0700
@@ -42,11 +42,12 @@
# Date : 17-10-2007
import sys
-from XenKvmLib import computersystem
+from XenKvmLib import enumclass
from XenKvmLib import vxml
from VirtLib import utils
from CimTest.Globals import logger
from XenKvmLib.const import do_main
+from XenKvmLib.classes import get_typed_class
from XenKvmLib.common_util import call_request_state_change
from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC
@@ -73,7 +74,12 @@ def main():
logger.error("ERROR: VS %s was not defined" % test_dom)
return status
- cs = computersystem.get_cs_class(options.virt)(options.ip, test_dom)
+ keys = {
+ 'Name' : test_dom,
+ 'CreationClassName' : get_typed_class(options.virt, 'ComputerSystem')
+ }
+ cs = enumclass.getInstance(options.ip, 'ComputerSystem', keys, options.virt)
+
if cs.Name == test_dom:
from_State = cs.EnabledState
else:
@@ -95,7 +101,7 @@ def main():
#Get the value of the EnabledState property and RequestedState property.
try:
- cs = computersystem.get_cs_class(options.virt)(options.ip, test_dom)
+ cs= enumclass.getInstance(options.ip, 'ComputerSystem', keys, options.virt)
if cs.Name == test_dom:
to_RequestedState = cs.RequestedState
enabledState = cs.EnabledState
diff -r 90ff66d2baee -r 9e48d953adc1 suites/libvirt-cim/cimtest/ComputerSystem/06_paused_active_suspend.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/06_paused_active_suspend.py Fri Aug 29 13:26:12 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/06_paused_active_suspend.py Tue Sep 02 22:34:39 2008 -0700
@@ -41,7 +41,6 @@
# Date :18-10-2007
import sys
-from XenKvmLib import computersystem
from XenKvmLib import vxml
from VirtLib import utils
from XenKvmLib.test_doms import destroy_and_undefine_all
diff -r 90ff66d2baee -r 9e48d953adc1 suites/libvirt-cim/cimtest/ComputerSystem/22_define_suspend.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/22_define_suspend.py Fri Aug 29 13:26:12 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/22_define_suspend.py Tue Sep 02 22:34:39 2008 -0700
@@ -29,7 +29,6 @@
# Date: 14-12-2007
import sys
-from XenKvmLib import computersystem
from VirtLib import utils
from XenKvmLib import vxml
from XenKvmLib.test_doms import destroy_and_undefine_domain
diff -r 90ff66d2baee -r 9e48d953adc1 suites/libvirt-cim/cimtest/ComputerSystem/41_cs_to_settingdefinestate.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/41_cs_to_settingdefinestate.py Fri Aug 29 13:26:12 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/41_cs_to_settingdefinestate.py Tue Sep 02 22:34:39 2008 -0700
@@ -58,7 +58,6 @@
import sys
from VirtLib import utils
-from XenKvmLib import computersystem
from XenKvmLib.vxml import get_class
from XenKvmLib.classes import get_typed_class
from XenKvmLib.test_doms import destroy_and_undefine_all
diff -r 90ff66d2baee -r 9e48d953adc1 suites/libvirt-cim/lib/XenKvmLib/enumclass.py
--- a/suites/libvirt-cim/lib/XenKvmLib/enumclass.py Fri Aug 29 13:26:12 2008 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/enumclass.py Tue Sep 02 22:34:39 2008 -0700
@@ -27,7 +27,7 @@ from pywbem.cim_obj import CIMInstanceNa
from pywbem.cim_obj import CIMInstanceName
from XenKvmLib.devices import CIM_Instance
from XenKvmLib.classes import get_typed_class
-from CimTest import Globals
+from CimTest import Globals, CimExt
class CIM_MyClass(CIM_Instance):
def __init__(self, server, keys):
@@ -42,8 +42,30 @@ class CIM_MyClass(CIM_Instance):
inst = conn.GetInstance(ref)
except pywbem.CIMError, arg:
raise arg
+
+ self.conn = conn
+ self.inst = inst
+ self.ref = ref
CIM_Instance.__init__(self, inst)
+
+ def __invoke(self, method, params):
+ try:
+ return self.conn.InvokeMethod(method,
+ self.ref,
+ **params)
+ except pywbem.CIMError, arg:
+ print 'InvokeMethod(%s): %s' % (method, arg[1])
+ raise
+
+ def __getattr__(self, attr):
+ if self.inst.has_key(attr):
+ return self.inst[attr]
+ else:
+ return CimExt._Method(self.__invoke, attr)
+
+class CIM_ComputerSystem(CIM_MyClass):
+ pass
class CIM_System(CIM_MyClass):
pass
@@ -91,6 +113,15 @@ class CIM_ProcResourceAllocationSettingD
pass
class CIM_DiskResourceAllocationSettingData(CIM_MyClass):
+ pass
+
+class Xen_ComputerSystem(CIM_ComputerSystem):
+ pass
+
+class KVM_ComputerSystem(CIM_ComputerSystem):
+ pass
+
+class LXC_ComputerSystem(CIM_ComputerSystem):
pass
class Xen_HostSystem(CIM_System):
16 years, 3 months
[PATCH] [TEST] Update CS to call enumclass.py instead of computersystem.py
by yunguol@cn.ibm.com
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1220236263 25200
# Node ID db9789b5145f4cb219d4fcdfaa242e346d8b9c4d
# Parent 946fd46b96866adaab356876f9c8bbf937f0b3d6
[TEST] Update CS to call enumclass.py instead of computersystem.py
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r 946fd46b9686 -r db9789b5145f suites/libvirt-cim/cimtest/ComputerSystem/01_enum.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/01_enum.py Thu Aug 28 14:07:25 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/01_enum.py Sun Aug 31 19:31:03 2008 -0700
@@ -24,7 +24,7 @@
import sys
from XenKvmLib.const import do_main
-from XenKvmLib import computersystem
+from XenKvmLib import enumclass
from VirtLib import live
from VirtLib import utils
from CimTest import Globals
@@ -37,8 +37,9 @@
options = main.options
status = PASS
+ keys = ['Name', 'CreationClassName']
try:
- cs = computersystem.enumerate(options.ip, options.virt)
+ cs = enumclass.enumerate(options.ip, 'ComputerSystem', keys, options.virt)
live_cs = live.domain_list(options.ip, options.virt)
for system in cs:
name = system.name
diff -r 946fd46b9686 -r db9789b5145f suites/libvirt-cim/cimtest/ComputerSystem/02_nosystems.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/02_nosystems.py Thu Aug 28 14:07:25 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/02_nosystems.py Sun Aug 31 19:31:03 2008 -0700
@@ -24,7 +24,7 @@
import sys
import pywbem
-from XenKvmLib import computersystem
+from XenKvmLib import enumclass
from VirtLib import live
from VirtLib import utils
from CimTest.Globals import logger, CIM_ERROR_ENUMERATE
@@ -49,9 +49,9 @@
return SKIP
cn = "%s_ComputerSystem" % options.virt
-
+ keys = ['Name', 'CreationClassName']
try:
- cs = computersystem.enumerate(options.ip, options.virt)
+ cs = enumclass.enumerate(options.ip, 'ComputerSystem', keys, options.virt)
except Exception, details:
logger.error(CIM_ERROR_ENUMERATE, cn)
diff -r 946fd46b9686 -r db9789b5145f suites/libvirt-cim/cimtest/ComputerSystem/03_defineVS.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/03_defineVS.py Thu Aug 28 14:07:25 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/03_defineVS.py Sun Aug 31 19:31:03 2008 -0700
@@ -27,7 +27,7 @@
# 26-Sep-2007
import sys
-from XenKvmLib import computersystem
+from XenKvmLib import enumclass
from XenKvmLib import vxml
from XenKvmLib.classes import get_typed_class
from VirtLib import utils
@@ -48,9 +48,9 @@
if not rc:
Globals.logger.error(VIRSH_ERROR_DEFINE % test_dom)
return status
-
+ keys = ['Name', 'CreationClassName']
try:
- cs = computersystem.enumerate(options.ip, options.virt)
+ cs = enumclass.enumerate(options.ip, 'ComputerSystem', keys, options.virt)
if len(cs) == 0:
raise Exception('No cs instance returned')
for dom in cs:
diff -r 946fd46b9686 -r db9789b5145f suites/libvirt-cim/cimtest/ComputerSystem/04_defineStartVS.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/04_defineStartVS.py Thu Aug 28 14:07:25 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/04_defineStartVS.py Sun Aug 31 19:31:03 2008 -0700
@@ -32,7 +32,7 @@
import sys
from time import sleep
from XenKvmLib import vxml
-from XenKvmLib import computersystem
+from XenKvmLib import enumclass
from CimTest import Globals
from XenKvmLib.classes import get_typed_class
from XenKvmLib.const import do_main
@@ -62,8 +62,8 @@
# otherwise.
for i in range(1, (timeout + 1)):
sleep(1)
- cs = computersystem.get_cs_class(options.virt)(options.ip,
- test_dom)
+ cs = get_typed_class(options.virt, 'ComputerSystem')\
+ (options.ip, test_dom
if cs.Name != test_dom:
Globals.logger.error("VS %s is not defined" % test_dom)
break
diff -r 946fd46b9686 -r db9789b5145f suites/libvirt-cim/cimtest/ComputerSystem/05_activate_defined_start.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/05_activate_defined_start.py Thu Aug 28 14:07:25 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/05_activate_defined_start.py Sun Aug 31 19:31:03 2008 -0700
@@ -42,8 +42,8 @@
# Date : 17-10-2007
import sys
-from XenKvmLib import computersystem
from XenKvmLib import vxml
+from XenKvmLib.classes import get_typed_class
from VirtLib import utils
from CimTest.Globals import logger
from XenKvmLib.const import do_main
@@ -73,7 +73,8 @@
logger.error("ERROR: VS %s was not defined" % test_dom)
return status
- cs = computersystem.get_cs_class(options.virt)(options.ip, test_dom)
+ cs = get_typed_class(options.virt, 'ComputerSystem')\
+ (options.ip, test_dom)
if cs.Name == test_dom:
from_State = cs.EnabledState
else:
@@ -95,7 +96,8 @@
#Get the value of the EnabledState property and RequestedState property.
try:
- cs = computersystem.get_cs_class(options.virt)(options.ip, test_dom)
+ cs = get_typed_class(options.virt, 'ComputerSystem')\
+ (options.ip, test_dom)
if cs.Name == test_dom:
to_RequestedState = cs.RequestedState
enabledState = cs.EnabledState
diff -r 946fd46b9686 -r db9789b5145f suites/libvirt-cim/cimtest/ComputerSystem/22_define_suspend.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/22_define_suspend.py Thu Aug 28 14:07:25 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/22_define_suspend.py Sun Aug 31 19:31:03 2008 -0700
@@ -29,7 +29,6 @@
# Date: 14-12-2007
import sys
-from XenKvmLib import computersystem
from VirtLib import utils
from XenKvmLib import vxml
from XenKvmLib.test_doms import destroy_and_undefine_domain
diff -r 946fd46b9686 -r db9789b5145f suites/libvirt-cim/cimtest/ComputerSystem/41_cs_to_settingdefinestate.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/41_cs_to_settingdefinestate.py Thu Aug 28 14:07:25 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/41_cs_to_settingdefinestate.py Sun Aug 31 19:31:03 2008 -0700
@@ -58,7 +58,6 @@
import sys
from VirtLib import utils
-from XenKvmLib import computersystem
from XenKvmLib.vxml import get_class
from XenKvmLib.classes import get_typed_class
from XenKvmLib.test_doms import destroy_and_undefine_all
16 years, 3 months
[PATCH] [TEST] #2 Use enumclass.py to cover computersystem.py behavior and update commom_util.py
by yunguol@cn.ibm.com
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1220235476 25200
# Node ID 57b15d9bb761cb09f48dc86a793f3d2f79e59e19
# Parent 946fd46b96866adaab356876f9c8bbf937f0b3d6
[TEST] #2 Use enumclass.py to cover computersystem.py behavior and update commom_util.py
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r 946fd46b9686 -r 57b15d9bb761 suites/libvirt-cim/lib/XenKvmLib/common_util.py
--- a/suites/libvirt-cim/lib/XenKvmLib/common_util.py Thu Aug 28 14:07:25 2008 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/common_util.py Sun Aug 31 19:17:56 2008 -0700
@@ -28,7 +28,6 @@
from XenKvmLib.test_xml import *
from XenKvmLib.test_doms import *
from XenKvmLib import vsms
-from XenKvmLib import computersystem
from XenKvmLib import enumclass
from pywbem.cim_obj import CIMInstanceName
from XenKvmLib.devices import CIM_Instance
@@ -54,7 +53,7 @@
def get_cs_instance(domain_name, ip, virt='Xen'):
cs = None
try:
- cs = computersystem.get_cs_class(virt)(ip, domain_name)
+ cs = get_typed_class(virt, 'ComputerSystem')(ip, domain_name)
if cs.Name != domain_name:
logger.error("VS %s is not found" % domain_name)
@@ -169,7 +168,7 @@
def poll_for_state_change(server, virt, dom, exp_state, timeout=30):
dom_cs = None
- cs = computersystem.get_cs_class(virt)
+ cs = get_typed_class(virt, 'ComputerSystem')
try:
for i in range(1, (timeout + 1)):
diff -r 946fd46b9686 -r 57b15d9bb761 suites/libvirt-cim/lib/XenKvmLib/enumclass.py
--- a/suites/libvirt-cim/lib/XenKvmLib/enumclass.py Thu Aug 28 14:07:25 2008 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/enumclass.py Sun Aug 31 19:17:56 2008 -0700
@@ -26,7 +26,7 @@
import pywbem
from pywbem.cim_obj import CIMInstanceName
from XenKvmLib.devices import CIM_Instance
-from XenKvmLib.classes import get_typed_class
+from XenKvmLib.classes import get_typed_class, virt_types
from CimTest import Globals
class CIM_MyClass(CIM_Instance):
@@ -45,7 +45,32 @@
CIM_Instance.__init__(self, inst)
+ def __invoke(self, method, params):
+ try:
+ return self.conn.InvokeMethod(method,
+ self.ref,
+ **params)
+ except pywbem.CIMError, arg:
+ print 'InvokeMethod(%s): %s' % (method, arg[1])
+ raise
+
+ def __getattr__(self, attr):
+ if self.inst.has_key(attr):
+ return self.inst[attr]
+ else:
+ return CimExt._Method(self.__invoke, attr)
+
+
class CIM_System(CIM_MyClass):
+ pass
+
+class Xen_ComputerSystem(CIM_System):
+ pass
+
+class KVM_ComputerSystem(CIM_System):
+ pass
+
+class LXC_ComputerSystem(CIM_System):
pass
class CIM_AllocationCapabilities(CIM_MyClass):
16 years, 3 months
[PATCH] Fix memory XML parsing so that max_size is set to the memory value
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1220392087 25200
# Node ID 2796fd3e2eaa202206430ad59c01dd01cd982ccd
# Parent 2db1158cea318cfee11a77724c97a0b4758ffb2c
Fix memory XML parsing so that max_size is set to the memory value...
And size is set to the value of currentMem.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 2db1158cea31 -r 2796fd3e2eaa libxkutil/device_parsing.c
--- a/libxkutil/device_parsing.c Fri Aug 29 08:16:56 2008 -0700
+++ b/libxkutil/device_parsing.c Tue Sep 02 14:48:07 2008 -0700
@@ -407,9 +407,9 @@
content = get_node_content(node);
- if (XSTREQ(node->name, "memory"))
+ if (XSTREQ(node->name, "currentMemory"))
sscanf(content, "%" PRIu64, &mdev->size);
- else if (XSTREQ(node->name, "currentMemory"))
+ else if (XSTREQ(node->name, "memory"))
sscanf(content, "%" PRIu64, &mdev->maxsize);
free(content);
16 years, 3 months