[PATCH] [TEST] Add new functions to pool.py for pool verificaiton through providers
by yunguol@cn.ibm.com
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1241686602 25200
# Node ID 0456e939b4326d1fa1110f4be8281fbb54af2dc9
# Parent 92caf252c2fa8c8a7a9b70548d12b03c52f3935c
[TEST] Add new functions to pool.py for pool verificaiton through providers
Tested for KVM with current sources
Signed-off-by: Guolian Yun<yunguol(a)cn.ibm.com>
diff -r 92caf252c2fa -r 0456e939b432 suites/libvirt-cim/lib/XenKvmLib/pool.py
--- a/suites/libvirt-cim/lib/XenKvmLib/pool.py Mon May 04 03:49:32 2009 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/pool.py Thu May 07 01:56:42 2009 -0700
@@ -21,15 +21,21 @@
#
import sys
-from CimTest.Globals import logger
+from CimTest.Globals import logger, CIM_NS
from CimTest.ReturnCodes import PASS, FAIL
from XenKvmLib.classes import get_typed_class
from XenKvmLib.const import get_provider_version, default_pool_name
from XenKvmLib.enumclass import EnumInstances
from VirtLib.utils import run_remote
-from XenKvmLib.xm_virt_util import virt2uri
+from XenKvmLib.xm_virt_util import virt2uri, net_list
+from XenKvmLib import rpcs_service
+import pywbem
+from CimTest.CimExt import CIMClassMOF
+cim_errno = pywbem.CIM_ERR_NOT_SUPPORTED
+cim_mname = "CreateChildResourcePool"
input_graphics_pool_rev = 757
+libvirt_cim_child_pool_rev = 837
def pool_cn_to_rasd_cn(pool_cn, virt):
if pool_cn.find('ProcessorPool') >= 0:
@@ -97,3 +103,119 @@
return volume
+def net_undefine(network, server, virt="Xen"):
+ """Function undefine a given virtual network"""
+
+ cmd = "virsh -c %s net-undefine %s" % (virt2uri(virt), network)
+ ret, out = run_remote(server, cmd)
+
+ return ret
+
+def undefine_netpool(server, virt, net_name):
+ if net_name == None:
+ return FAIL
+
+ ret = net_undefine(net_name, server, virt)
+ if ret != 0:
+ logger.error("Failed to undefine Virtual Network '%s'", net_name)
+ return FAIL
+
+ return PASS
+
+class CIM_NetPoolResourceAllocationSettingData(CIMClassMOF):
+ def __init__(self, addr, netmask, ipstart, ipend, mode):
+ if addr != None:
+ self.Address = addr
+ if netmask != None:
+ self.NetMask = netmask
+ if ipstart != None:
+ self.IPRangeStart = ipstart
+ if ipend != None:
+ self.IPRangeEnd = ipend
+ if mode != None:
+ self.ForwardMode = mode
+
+class Xen_NetPoolResourceAllocationSettingData(CIM_NetPoolResourceAllocationSettingData):
+ pass
+
+class KVM_NetPoolResourceAllocationSettingData(CIM_NetPoolResourceAllocationSettingData):
+ pass
+
+class LXC_NetPoolResourceAllocationSettingData(CIM_NetPoolResourceAllocationSettingData):
+ pass
+
+def dump_netxml(server, netname):
+ cmd = "virsh net-dumpxml %s | awk '/ip address/ {print}' | \
+ cut -d ' ' -f 4 | sed 's/address=//'" % netname
+ s, addr = run_remote(server, cmd)
+ addr = addr.strip("'")
+
+ return addr
+
+def create_netpool(server, virt, test_pool, address, mode):
+ status = PASS
+ rpcs = get_typed_class(virt, "ResourcePoolConfigurationService")
+ rpcs_conn = eval("rpcs_service." + rpcs)(server)
+ curr_cim_rev, changeset = get_provider_version(virt, server)
+ if curr_cim_rev < libvirt_cim_child_pool_rev:
+ try:
+ rpcs_conn.CreateChildResourcePool()
+ except pywbem.CIMError, (err_no, desc):
+ if err_no == cim_errno :
+ logger.info("Got expected exception for '%s'service", cim_mname)
+ logger.info("Errno is '%s' ", err_no)
+ logger.info("Error string is '%s'", desc)
+ return PASS
+ else:
+ logger.error("Unexpected rc code %s and description %s\n",
+ err_no, desc)
+ return FAIL
+ elif curr_cim_rev >= libvirt_cim_child_pool_rev:
+ nprasd = get_typed_class(virt,
+ 'NetPoolResourceAllocationSettingData')
+ n_list = net_list(server, virt)
+ for _net_name in n_list:
+ in_use_addr = dump_netxml(server, _net_name)
+ if in_use_addr == address:
+ logger.error("IP address is in use by a different network")
+ return FAIL
+
+ class_nprasd = eval(nprasd)
+ nprasd = class_nprasd(addr = address,
+ netmask = "255.255.255.0",
+ ipstart = "192.168.0.31",
+ ipend = "192.168.0.57",
+ mode = mode)
+ try:
+ rpcs_conn.CreateChildResourcePool(ElementName=test_pool,
+ Settings=[nprasd.mof()])
+ except Exception, details:
+ logger.error("Error in childpool creation")
+ logger.error(details)
+ return FAIL
+
+ return status
+
+def verify_pool(server, pooltype, poolid, address):
+ status = FAIL
+ pool_list = EnumInstances(server, pooltype)
+ if len(pool_list) < 1:
+ logger.error("Return %i instances, expected at least one instance",
+ len(pool_list))
+ return FAIL
+
+ for i in range(0, len(pool_list)):
+ ret_pool = pool_list[i].InstanceID
+ ret_pool_name = ret_pool.split("/")[1]
+ if ret_pool == poolid:
+ ret_addr = dump_netxml(server, ret_pool_name)
+ if ret_addr == address:
+ status = PASS
+ break
+ else:
+ logger.error('Return address is %s, but expect is %s',
+ ret_addr, address)
+ elif ret_pool != poolid and i == len(pool_list)-1:
+ logger.error("The created pool can not be found")
+
+ return status
15 years, 5 months
Test Run Summary (May 11 2009): KVM on Fedora release 10.90 (Rawhide) with Pegasus
by Guo Lian Yun
=================================================
Test Run Summary (May 11 2009): KVM on Fedora release 10.90 (Rawhide) with
Pegasus
=================================================
Distro: Fedora release 10.90 (Rawhide)
Kernel: 2.6.29-0.24.rc0.git13.fc11.x86_64
libvirt: 0.6.3
Hypervisor: QEMU 0.10.1
CIMOM: Pegasus 2.7.2
Libvirt-cim revision: 867
Libvirt-cim changeset: aa607e00fcf9
Cimtest revision: 675
Cimtest changeset: 92caf252c2fa
=================================================
FAIL : 6
XFAIL : 3
SKIP : 9
PASS : 133
-----------------
Total : 151
=================================================
FAIL Test Summary:
HostSystem - 03_hs_to_settdefcap.py: FAIL
RASD - 05_disk_rasd_emu_type.py: FAIL
ResourcePoolConfigurationService - 04_CreateChildResourcePool.py: FAIL
ResourcePoolConfigurationService - 07_DeleteResourcePool.py: FAIL
SettingsDefineCapabilities - 01_forward.py: FAIL
SystemDevice - 01_forward.py: FAIL
=================================================
XFAIL Test Summary:
ComputerSystem - 33_suspend_reboot.py: XFAIL
VirtualSystemManagementService - 09_procrasd_persist.py: XFAIL
VirtualSystemManagementService - 16_removeresource.py: XFAIL
=================================================
SKIP Test Summary:
ComputerSystem - 02_nosystems.py: SKIP
LogicalDisk - 02_nodevs.py: SKIP
VSSD - 02_bootldr.py: SKIP
VirtualSystemMigrationService - 01_migratable_host.py: SKIP
VirtualSystemMigrationService - 02_host_migrate_type.py: SKIP
VirtualSystemMigrationService - 05_migratable_host_errs.py: SKIP
VirtualSystemMigrationService - 06_remote_live_migration.py: SKIP
VirtualSystemMigrationService - 07_remote_offline_migration.py: SKIP
VirtualSystemMigrationService - 08_remote_restart_resume_migration.py:
SKIP
=================================================
Full report:
--------------------------------------------------------------------
AllocationCapabilities - 01_enum.py: PASS
--------------------------------------------------------------------
AllocationCapabilities - 02_alloccap_gi_errs.py: PASS
--------------------------------------------------------------------
ComputerSystem - 01_enum.py: PASS
--------------------------------------------------------------------
ComputerSystem - 02_nosystems.py: SKIP
ERROR - System has defined domains; unable to run
--------------------------------------------------------------------
ComputerSystem - 03_defineVS.py: PASS
--------------------------------------------------------------------
ComputerSystem - 04_defineStartVS.py: PASS
--------------------------------------------------------------------
ComputerSystem - 05_activate_defined_start.py: PASS
--------------------------------------------------------------------
ComputerSystem - 06_paused_active_suspend.py: PASS
--------------------------------------------------------------------
ComputerSystem - 22_define_suspend.py: PASS
--------------------------------------------------------------------
ComputerSystem - 23_pause_pause.py: PASS
--------------------------------------------------------------------
ComputerSystem - 27_define_pause_errs.py: PASS
--------------------------------------------------------------------
ComputerSystem - 32_start_reboot.py: PASS
--------------------------------------------------------------------
ComputerSystem - 33_suspend_reboot.py: XFAIL
ERROR - Got CIM error CIM_ERR_NOT_SUPPORTED: State not
supported with return code 7
ERROR - Exception: Unable Suspend dom 'test_domain'
InvokeMethod(RequestStateChange): CIM_ERR_NOT_SUPPORTED: State not
supported
Bug:<00012>
--------------------------------------------------------------------
ComputerSystem - 35_start_reset.py: PASS
--------------------------------------------------------------------
ComputerSystem - 40_RSC_start.py: PASS
--------------------------------------------------------------------
ComputerSystem - 41_cs_to_settingdefinestate.py: PASS
--------------------------------------------------------------------
ComputerSystem - 42_cs_gi_errs.py: PASS
--------------------------------------------------------------------
ComputerSystemIndication - 01_created_indication.py: PASS
--------------------------------------------------------------------
ElementAllocatedFromPool - 01_forward.py: PASS
--------------------------------------------------------------------
ElementAllocatedFromPool - 02_reverse.py: PASS
--------------------------------------------------------------------
ElementAllocatedFromPool - 03_reverse_errs.py: PASS
--------------------------------------------------------------------
ElementAllocatedFromPool - 04_forward_errs.py: PASS
--------------------------------------------------------------------
ElementCapabilities - 01_forward.py: PASS
--------------------------------------------------------------------
ElementCapabilities - 02_reverse.py: PASS
--------------------------------------------------------------------
ElementCapabilities - 03_forward_errs.py: PASS
--------------------------------------------------------------------
ElementCapabilities - 04_reverse_errs.py: PASS
--------------------------------------------------------------------
ElementCapabilities - 05_hostsystem_cap.py: PASS
--------------------------------------------------------------------
ElementConforms - 01_forward.py: PASS
--------------------------------------------------------------------
ElementConforms - 02_reverse.py: PASS
--------------------------------------------------------------------
ElementConforms - 03_ectp_fwd_errs.py: PASS
--------------------------------------------------------------------
ElementConforms - 04_ectp_rev_errs.py: PASS
--------------------------------------------------------------------
ElementSettingData - 01_forward.py: PASS
--------------------------------------------------------------------
ElementSettingData - 03_esd_assoc_with_rasd_errs.py: PASS
--------------------------------------------------------------------
EnabledLogicalElementCapabilities - 01_enum.py: PASS
--------------------------------------------------------------------
EnabledLogicalElementCapabilities - 02_elecap_gi_errs.py: PASS
--------------------------------------------------------------------
HostSystem - 01_enum.py: PASS
--------------------------------------------------------------------
HostSystem - 02_hostsystem_to_rasd.py: PASS
--------------------------------------------------------------------
HostSystem - 03_hs_to_settdefcap.py: FAIL
ERROR - 'KVM_SettingsDefineCapabilities' returned 8 RASD
objects instead of 4
CIM_ERR_INVALID_CLASS: Linux_ComputerSystem
--------------------------------------------------------------------
HostSystem - 04_hs_to_EAPF.py: PASS
--------------------------------------------------------------------
HostSystem - 05_hs_gi_errs.py: PASS
--------------------------------------------------------------------
HostSystem - 06_hs_to_vsms.py: PASS
--------------------------------------------------------------------
HostedAccessPoint - 01_forward.py: PASS
--------------------------------------------------------------------
HostedAccessPoint - 02_reverse.py: PASS
--------------------------------------------------------------------
HostedDependency - 01_forward.py: PASS
--------------------------------------------------------------------
HostedDependency - 02_reverse.py: PASS
--------------------------------------------------------------------
HostedDependency - 03_enabledstate.py: PASS
--------------------------------------------------------------------
HostedDependency - 04_reverse_errs.py: PASS
--------------------------------------------------------------------
HostedResourcePool - 01_forward.py: PASS
--------------------------------------------------------------------
HostedResourcePool - 02_reverse.py: PASS
--------------------------------------------------------------------
HostedResourcePool - 03_forward_errs.py: PASS
--------------------------------------------------------------------
HostedResourcePool - 04_reverse_errs.py: PASS
--------------------------------------------------------------------
HostedService - 01_forward.py: PASS
--------------------------------------------------------------------
HostedService - 02_reverse.py: PASS
--------------------------------------------------------------------
HostedService - 03_forward_errs.py: PASS
--------------------------------------------------------------------
HostedService - 04_reverse_errs.py: PASS
--------------------------------------------------------------------
KVMRedirectionSAP - 01_enum_KVMredSAP.py: PASS
--------------------------------------------------------------------
LogicalDisk - 01_disk.py: PASS
--------------------------------------------------------------------
LogicalDisk - 02_nodevs.py: SKIP
ERROR - System has defined domains; unable to run
--------------------------------------------------------------------
LogicalDisk - 03_ld_gi_errs.py: PASS
--------------------------------------------------------------------
Memory - 01_memory.py: PASS
--------------------------------------------------------------------
Memory - 02_defgetmem.py: PASS
--------------------------------------------------------------------
Memory - 03_mem_gi_errs.py: PASS
--------------------------------------------------------------------
NetworkPort - 01_netport.py: PASS
--------------------------------------------------------------------
NetworkPort - 02_np_gi_errors.py: PASS
--------------------------------------------------------------------
NetworkPort - 03_user_netport.py: PASS
--------------------------------------------------------------------
Processor - 01_processor.py: PASS
--------------------------------------------------------------------
Processor - 02_definesys_get_procs.py: PASS
--------------------------------------------------------------------
Processor - 03_proc_gi_errs.py: PASS
--------------------------------------------------------------------
Profile - 01_enum.py: PASS
--------------------------------------------------------------------
Profile - 02_profile_to_elec.py: PASS
--------------------------------------------------------------------
Profile - 03_rprofile_gi_errs.py: PASS
--------------------------------------------------------------------
RASD - 01_verify_rasd_fields.py: PASS
--------------------------------------------------------------------
RASD - 02_enum.py: PASS
--------------------------------------------------------------------
RASD - 03_rasd_errs.py: PASS
--------------------------------------------------------------------
RASD - 04_disk_rasd_size.py: PASS
--------------------------------------------------------------------
RASD - 05_disk_rasd_emu_type.py: FAIL
ERROR - Exception: EmulatedType Mismatch: got 0,expected 1
--------------------------------------------------------------------
RedirectionService - 01_enum_crs.py: PASS
--------------------------------------------------------------------
RedirectionService - 02_enum_crscap.py: PASS
--------------------------------------------------------------------
RedirectionService - 03_RedirectionSAP_errs.py: PASS
--------------------------------------------------------------------
ReferencedProfile - 01_verify_refprof.py: PASS
--------------------------------------------------------------------
ReferencedProfile - 02_refprofile_errs.py: PASS
--------------------------------------------------------------------
ResourceAllocationFromPool - 01_forward.py: PASS
--------------------------------------------------------------------
ResourceAllocationFromPool - 02_reverse.py: PASS
--------------------------------------------------------------------
ResourceAllocationFromPool - 03_forward_errs.py: PASS
--------------------------------------------------------------------
ResourceAllocationFromPool - 04_reverse_errs.py: PASS
--------------------------------------------------------------------
ResourceAllocationFromPool - 05_RAPF_err.py: PASS
--------------------------------------------------------------------
ResourcePool - 01_enum.py: PASS
--------------------------------------------------------------------
ResourcePool - 02_rp_gi_errors.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationCapabilities - 01_enum.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationCapabilities - 02_rpcc_gi_errs.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationService - 01_enum.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationService - 02_rcps_gi_errors.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationService - 03_CreateResourcePool.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationService - 04_CreateChildResourcePool.py: FAIL
ERROR - Unexpected rc code 4 and description
CIM_ERR_INVALID_PARAMETER
InvokeMethod(CreateChildResourcePool): CIM_ERR_INVALID_PARAMETER
--------------------------------------------------------------------
ResourcePoolConfigurationService - 05_AddResourcesToResourcePool.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationService - 06_RemoveResourcesFromResourcePool.py:
PASS
--------------------------------------------------------------------
ResourcePoolConfigurationService - 07_DeleteResourcePool.py: FAIL
ERROR - Unexpected rc code 4 and description
CIM_ERR_INVALID_PARAMETER
InvokeMethod(DeleteResourcePool): CIM_ERR_INVALID_PARAMETER
--------------------------------------------------------------------
ServiceAccessBySAP - 01_forward.py: PASS
--------------------------------------------------------------------
ServiceAccessBySAP - 02_reverse.py: PASS
--------------------------------------------------------------------
SettingsDefine - 01_forward.py: PASS
--------------------------------------------------------------------
SettingsDefine - 02_reverse.py: PASS
--------------------------------------------------------------------
SettingsDefine - 03_sds_fwd_errs.py: PASS
--------------------------------------------------------------------
SettingsDefine - 04_sds_rev_errs.py: PASS
--------------------------------------------------------------------
SettingsDefineCapabilities - 01_forward.py: FAIL
ERROR - KVM_SettingsDefineCapabilities returned 8 ResourcePool
objects instead of 4
--------------------------------------------------------------------
SettingsDefineCapabilities - 03_forward_errs.py: PASS
--------------------------------------------------------------------
SettingsDefineCapabilities - 04_forward_vsmsdata.py: PASS
--------------------------------------------------------------------
SettingsDefineCapabilities - 05_reverse_vsmcap.py: PASS
--------------------------------------------------------------------
SystemDevice - 01_forward.py: FAIL
01_forward.py:29: DeprecationWarning: the sets module is deprecated
from sets import Set
ERROR - DeviceID mismatch
ERROR - Exception Expected DeviceID: ['test_domain/0',
'test_domain/1', 'test_domain/2']
Got: [u'test_domain/0']
--------------------------------------------------------------------
SystemDevice - 02_reverse.py: PASS
--------------------------------------------------------------------
SystemDevice - 03_fwderrs.py: PASS
--------------------------------------------------------------------
VSSD - 01_enum.py: PASS
--------------------------------------------------------------------
VSSD - 02_bootldr.py: SKIP
--------------------------------------------------------------------
VSSD - 03_vssd_gi_errs.py: PASS
--------------------------------------------------------------------
VSSD - 04_vssd_to_rasd.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementCapabilities - 01_enum.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementCapabilities - 02_vsmcap_gi_errs.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 01_definesystem_name.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 02_destroysystem.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 03_definesystem_ess.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 04_definesystem_ers.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 05_destroysystem_neg.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 06_addresource.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 07_addresource_neg.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 08_modifyresource.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 09_procrasd_persist.py: XFAIL
--------------------------------------------------------------------
VirtualSystemManagementService - 10_hv_version.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 11_define_memrasdunits.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 12_referenced_config.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 13_refconfig_additional_devs.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 14_define_sys_disk.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 15_mod_system_settings.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 16_removeresource.py: XFAIL
ERROR - 0 RASD insts for domain/mouse:ps2
CIM_ERR_NOT_FOUND: No such instance (no device domain/mouse:ps2)
Bug:<00014>
--------------------------------------------------------------------
VirtualSystemManagementService - 17_removeresource_neg.py: PASS
--------------------------------------------------------------------
VirtualSystemMigrationCapabilities - 01_enum.py: PASS
--------------------------------------------------------------------
VirtualSystemMigrationCapabilities - 02_vsmc_gi_errs.py: PASS
--------------------------------------------------------------------
VirtualSystemMigrationService - 01_migratable_host.py: SKIP
--------------------------------------------------------------------
VirtualSystemMigrationService - 02_host_migrate_type.py: SKIP
--------------------------------------------------------------------
VirtualSystemMigrationService - 05_migratable_host_errs.py: SKIP
--------------------------------------------------------------------
VirtualSystemMigrationService - 06_remote_live_migration.py: SKIP
--------------------------------------------------------------------
VirtualSystemMigrationService - 07_remote_offline_migration.py: SKIP
--------------------------------------------------------------------
VirtualSystemMigrationService - 08_remote_restart_resume_migration.py:
SKIP
--------------------------------------------------------------------
VirtualSystemMigrationSettingData - 01_enum.py: PASS
--------------------------------------------------------------------
VirtualSystemMigrationSettingData - 02_vsmsd_gi_errs.py: PASS
--------------------------------------------------------------------
VirtualSystemSettingDataComponent - 01_forward.py: PASS
--------------------------------------------------------------------
VirtualSystemSettingDataComponent - 02_reverse.py: PASS
--------------------------------------------------------------------
VirtualSystemSettingDataComponent - 03_vssdc_fwd_errs.py: PASS
--------------------------------------------------------------------
VirtualSystemSettingDataComponent - 04_vssdc_rev_errs.py: PASS
--------------------------------------------------------------------
VirtualSystemSnapshotService - 01_enum.py: PASS
--------------------------------------------------------------------
VirtualSystemSnapshotService - 02_vs_sservice_gi_errs.py: PASS
--------------------------------------------------------------------
VirtualSystemSnapshotServiceCapabilities - 01_enum.py: PASS
--------------------------------------------------------------------
VirtualSystemSnapshotServiceCapabilities - 02_vs_sservicecap_gi_errs.py:
PASS
--------------------------------------------------------------------
15 years, 6 months
[PATCH] [TEST] Make RPCS/07 to delete networkpool through providers
by yunguol@cn.ibm.com
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1241688655 25200
# Node ID 18fc8178c29ac30027272af9afe5b3fd01b1380c
# Parent 92caf252c2fa8c8a7a9b70548d12b03c52f3935c
[TEST] Make RPCS/07 to delete networkpool through providers
Tested for KVM with current sources
Signed-off-by: Guolian Yun<yunguol(a)cn.ibm.com>
diff -r 92caf252c2fa -r 18fc8178c29a suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/07_DeleteResourcePool.py
--- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/07_DeleteResourcePool.py Mon May 04 03:49:32 2009 -0700
+++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/07_DeleteResourcePool.py Thu May 07 02:30:55 2009 -0700
@@ -33,10 +33,12 @@
# OUT -- Job -- CIM_ConcreteJob REF -- Returned job if started
# OUT -- Error-- String -- Encoded error instance if the operation
# failed and did not return a job.
-# REVISIT :
-# --------
-# As of now the DeleteResourcePool() simply throws an Exception.
-# We must improve this tc once the service is implemented.
+#
+# Exception details before Revision 841
+# -----
+# Error code: CIM_ERR_NOT_SUPPORTED
+#
+# After revision 841, the service is implemented
#
# -Date: 20.02.2008
@@ -46,32 +48,64 @@
from XenKvmLib import rpcs_service
from CimTest.Globals import logger
from CimTest.ReturnCodes import FAIL, PASS
-from XenKvmLib.const import do_main, platform_sup
+from XenKvmLib.const import do_main, platform_sup, get_provider_version
+from XenKvmLib.enumclass import EnumInstances
from XenKvmLib.classes import get_typed_class
+from XenKvmLib.pool import create_netpool, verify_pool
+from pywbem.cim_obj import CIMInstanceName
cim_errno = pywbem.CIM_ERR_NOT_SUPPORTED
cim_mname = "DeleteResourcePool"
+libvirt_cim_child_pool_rev = 841
+test_pool = "test_pool"
@do_main(platform_sup)
def main():
+ status = PASS
options = main.options
- rpcs_conn = eval("rpcs_service." + get_typed_class(options.virt, \
- "ResourcePoolConfigurationService"))(options.ip)
- try:
- rpcs_conn.DeleteResourcePool()
- except pywbem.CIMError, (err_no, desc):
- if err_no == cim_errno :
- logger.info("Got expected exception for '%s' service", cim_mname)
- logger.info("Errno is '%s' ", err_no)
- logger.info("Error string is '%s'", desc)
- return PASS
- else:
- logger.error("Unexpected rc code %s and description %s\n",
- err_no, desc)
+ rpcs = get_typed_class(options.virt, "ResourcePoolConfigurationService")
+ rpcs_conn = eval("rpcs_service." + rpcs)(options.ip)
+ curr_cim_rev, changeset = get_provider_version(options.virt, options.ip)
+ if curr_cim_rev < libvirt_cim_child_pool_rev:
+ try:
+ rpcs_conn.DeleteResourcePool()
+ except pywbem.CIMError, (err_no, desc):
+ if err_no == cim_errno :
+ logger.info("Got expected exception for '%s' service", cim_mname)
+ logger.info("Errno is '%s' ", err_no)
+ logger.info("Error string is '%s'", desc)
+ return PASS
+ else:
+ logger.error("Unexpected rc code %s and description %s\n",
+ err_no, desc)
+ return FAIL
+ elif curr_cim_rev >= libvirt_cim_child_pool_rev:
+ addr = "192.168.0.100"
+ status = create_netpool(options.ip, options.virt, test_pool,
+ addr, None)
+ if status != PASS:
+ logger.error("Error in networkpool creation")
return FAIL
-
- logger.error("The execution should not have reached here!!")
- return FAIL
+
+ np = get_typed_class(options.virt, "NetworkPool")
+ np_id = "NetworkPool/%s" %test_pool
+ status = verify_pool(options.ip, np, np_id, addr)
+ if status != PASS:
+ logger.error("Error in networkpool verification")
+ return FAIL
+
+ pool = CIMInstanceName(np, keybindings = {'InstanceID':np_id})
+ try:
+ rpcs_conn.DeleteResourcePool(Pool = pool)
+ netpool = EnumInstances(options.ip, np)
+ for i in range(0, len(netpool)):
+ ret_pool = netpool[i].InstanceID
+ if ret_pool == np_id:
+ raise Exception("Failed to delete %s" % test_pool)
+ except Exception, details:
+ logger.error(details)
+ status = FAIL
+
+ return status
if __name__ == "__main__":
sys.exit(main())
-
15 years, 6 months
[PATCH] [TEST] Simplify RPCS/04 for networkpool creation and validation through provider
by yunguol@cn.ibm.com
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1241687089 25200
# Node ID 5bf7603206d39d26feef19c91121b6e17e52dbe8
# Parent 92caf252c2fa8c8a7a9b70548d12b03c52f3935c
[TEST] Simplify RPCS/04 for networkpool creation and validation through provider
Tested for KVM with current sources
Signed-off-by: Guolian Yun<yunguol(a)cn.ibm.com>
diff -r 92caf252c2fa -r 5bf7603206d3 suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/04_CreateChildResourcePool.py
--- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/04_CreateChildResourcePool.py Mon May 04 03:49:32 2009 -0700
+++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/04_CreateChildResourcePool.py Thu May 07 02:04:49 2009 -0700
@@ -39,45 +39,56 @@
# OUT -- Error -- String -- Encoded error instance if the operation
# failed and did not return a job
#
-# REVISIT :
-# --------
-# As of now the CreateChildResourcePool() simply throws an Exception.
-# We must improve this tc once the service is implemented.
-#
-# -Date: 20.02.2008
-
+# Exception details before Revision 837
+# -----
+# Error code: CIM_ERR_NOT_SUPPORTED
+#
+# After revision 837, the service is implemented
+#
+# -Date: 20.02.2008
import sys
-import pywbem
-from XenKvmLib import rpcs_service
from CimTest.Globals import logger
from CimTest.ReturnCodes import FAIL, PASS
from XenKvmLib.const import do_main, platform_sup
from XenKvmLib.classes import get_typed_class
+from XenKvmLib.common_util import destroy_netpool
+from XenKvmLib.pool import undefine_netpool, create_netpool, verify_pool
-cim_errno = pywbem.CIM_ERR_NOT_SUPPORTED
-cim_mname = "CreateChildResourcePool"
+test_pool = "testpool"
+test_mode = ["None", "route eth1", "nat"]
@do_main(platform_sup)
def main():
+ status = PASS
options = main.options
- rpcs_conn = eval("rpcs_service." + get_typed_class(options.virt, \
- "ResourcePoolConfigurationService"))(options.ip)
- try:
- rpcs_conn.CreateChildResourcePool()
- except pywbem.CIMError, (err_no, desc):
- if err_no == cim_errno :
- logger.info("Got expected exception for '%s' service", cim_mname)
- logger.info("Errno is '%s' ", err_no)
- logger.info("Error string is '%s'", desc)
- return PASS
- else:
- logger.error("Unexpected rc code %s and description %s\n",
- err_no, desc)
+
+ np = get_typed_class(options.virt, 'NetworkPool')
+ np_id = "NetworkPool/%s" % test_pool
+ addr = "192.168.0.8"
+ for i in range(0, len(test_mode)):
+ status = create_netpool(options.ip, options.virt, test_pool,
+ addr, test_mode[i])
+ if status != PASS:
+ logger.error("Error in networkpool creation")
return FAIL
-
- logger.error("The execution should not have reached here!!")
- return FAIL
+
+ status = verify_pool(options.ip, np, np_id, addr)
+ if status != PASS:
+ logger.error("Error in networkpool verification")
+ return FAIL
+
+ status = destroy_netpool(options.ip, options.virt, test_pool)
+ if status != PASS:
+ logger.error("Unable to destroy networkpool %s", test_pool)
+ return FAIL
+
+ status = undefine_netpool(options.ip, options.virt, test_pool)
+ if status != PASS:
+ logger.error("Unable to undefine networkpool %s", test_pool)
+ return FAIL
+
+ return status
+
if __name__ == "__main__":
sys.exit(main())
-
15 years, 6 months
[PATCH] [TEST] #5 Update RPCS/04 to validate that the Network child pool can be created through the providers
by yunguol@cn.ibm.com
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1241671689 25200
# Node ID af273b2ad41c2a42f999155b23122c18a5c5ee8e
# Parent 92caf252c2fa8c8a7a9b70548d12b03c52f3935c
[TEST] #5 Update RPCS/04 to validate that the Network child pool can be created through the providers
Updates from 4 to 5:
1) Move common functions to pool.py
Updates from 3 to 4:
1) Move general net function to common.py
2) move the CIM_NS import stmt along with the logger
Updates from 2 to 3:
1) Use CIM_NS from const.py instead of hardcoding
2) Check if the IP is already used on the system before setting
3) Rewrite try, except... blocks
Updates from 1 to 2:
Test all types of networkpool including routed network, nat based network and isolated network
Tested for KVM with current sources
Signed-off-by: Guolian Yun<yunguol(a)cn.ibm.com>
diff -r 92caf252c2fa -r af273b2ad41c suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/04_CreateChildResourcePool.py
--- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/04_CreateChildResourcePool.py Mon May 04 03:49:32 2009 -0700
+++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/04_CreateChildResourcePool.py Wed May 06 21:48:09 2009 -0700
@@ -39,45 +39,47 @@
# OUT -- Error -- String -- Encoded error instance if the operation
# failed and did not return a job
#
-# REVISIT :
-# --------
-# As of now the CreateChildResourcePool() simply throws an Exception.
-# We must improve this tc once the service is implemented.
-#
-# -Date: 20.02.2008
-
+# Exception details before Revision 837
+# -----
+# Error code: CIM_ERR_NOT_SUPPORTED
+#
+# After revision 837, the service is implemented
+#
+# -Date: 20.02.2008
import sys
-import pywbem
-from XenKvmLib import rpcs_service
from CimTest.Globals import logger
from CimTest.ReturnCodes import FAIL, PASS
from XenKvmLib.const import do_main, platform_sup
from XenKvmLib.classes import get_typed_class
+from XenKvmLib.common_util import destroy_netpool
+from XenKvmLib.pool import undefine_netpool, create_verify_netpool
-cim_errno = pywbem.CIM_ERR_NOT_SUPPORTED
-cim_mname = "CreateChildResourcePool"
+test_pool = ["routedpool", "natpool", "isolatedpool"]
@do_main(platform_sup)
def main():
+ status = PASS
options = main.options
- rpcs_conn = eval("rpcs_service." + get_typed_class(options.virt, \
- "ResourcePoolConfigurationService"))(options.ip)
- try:
- rpcs_conn.CreateChildResourcePool()
- except pywbem.CIMError, (err_no, desc):
- if err_no == cim_errno :
- logger.info("Got expected exception for '%s' service", cim_mname)
- logger.info("Errno is '%s' ", err_no)
- logger.info("Error string is '%s'", desc)
- return PASS
- else:
- logger.error("Unexpected rc code %s and description %s\n",
- err_no, desc)
+
+ np = get_typed_class(options.virt, 'NetworkPool')
+ for i in range(0, len(test_pool)):
+ status = create_verify_netpool(options.ip, options.virt, test_pool[i])
+ if status != PASS:
+ logger.error("Error in networkpool creation and verification")
return FAIL
-
- logger.error("The execution should not have reached here!!")
- return FAIL
+
+ status = destroy_netpool(options.ip, options.virt, test_pool[i])
+ if status != PASS:
+ logger.error("Unable to destroy networkpool %s", test_pool[i])
+ status = FAIL
+
+ status = undefine_netpool(options.ip, options.virt, test_pool[i])
+ if status != PASS:
+ logger.error("Unable to undefine networkpool %s", test_pool[i])
+ status = FAIL
+
+ return status
+
if __name__ == "__main__":
sys.exit(main())
-
diff -r 92caf252c2fa -r af273b2ad41c suites/libvirt-cim/lib/XenKvmLib/pool.py
--- a/suites/libvirt-cim/lib/XenKvmLib/pool.py Mon May 04 03:49:32 2009 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/pool.py Wed May 06 21:48:09 2009 -0700
@@ -21,15 +21,21 @@
#
import sys
-from CimTest.Globals import logger
+from CimTest.Globals import logger, CIM_NS
from CimTest.ReturnCodes import PASS, FAIL
from XenKvmLib.classes import get_typed_class
from XenKvmLib.const import get_provider_version, default_pool_name
from XenKvmLib.enumclass import EnumInstances
from VirtLib.utils import run_remote
-from XenKvmLib.xm_virt_util import virt2uri
+from XenKvmLib.xm_virt_util import virt2uri, net_list
+from XenKvmLib import rpcs_service
+from pywbem.cim_obj import CIMInstance, CIMInstanceName
+import pywbem
+cim_errno = pywbem.CIM_ERR_NOT_SUPPORTED
+cim_mname = "CreateChildResourcePool"
input_graphics_pool_rev = 757
+libvirt_cim_child_pool_rev = 837
def pool_cn_to_rasd_cn(pool_cn, virt):
if pool_cn.find('ProcessorPool') >= 0:
@@ -97,3 +103,94 @@
return volume
+def net_undefine(network, server, virt="Xen"):
+ """Function undefine a given virtual network"""
+
+ cmd = "virsh -c %s net-undefine %s" % (virt2uri(virt), network)
+ ret, out = run_remote(server, cmd)
+
+ return ret
+
+def undefine_netpool(server, virt, net_name):
+ if net_name == None:
+ return FAIL
+
+ ret = net_undefine(net_name, server, virt)
+ if ret != 0:
+ logger.error("Failed to undefine Virtual Network '%s'", net_name)
+ return FAIL
+
+ return PASS
+
+def create_verify_netpool(server, virt, test_pool):
+ status = FAIL
+ rpcs = get_typed_class(virt, "ResourcePoolConfigurationService")
+ rpcs_conn = eval("rpcs_service." + rpcs)(server)
+ curr_cim_rev, changeset = get_provider_version(virt, server)
+ if curr_cim_rev < libvirt_cim_child_pool_rev:
+ try:
+ rpcs_conn.CreateChildResourcePool()
+ except pywbem.CIMError, (err_no, desc):
+ if err_no == cim_errno :
+ logger.info("Got expected exception for '%s'service", cim_mname)
+ logger.info("Errno is '%s' ", err_no)
+ logger.info("Error string is '%s'", desc)
+ return PASS
+ else:
+ logger.error("Unexpected rc code %s and description %s\n",
+ err_no, desc)
+ return FAIL
+ elif curr_cim_rev >= libvirt_cim_child_pool_rev:
+ nprasd = get_typed_class(virt,
+ 'NetPoolResourceAllocationSettingData')
+ addr = "192.168.0.9"
+ n_list = net_list(server, virt)
+ for _net_name in n_list:
+ cmd = "virsh net-dumpxml %s | awk '/ip address/ {print}' | \
+ cut -d ' ' -f 4 | sed 's/address=//'" % _net_name
+ s, in_use_addr = run_remote(server, cmd)
+ in_use_addr = in_use_addr.strip("'")
+ if in_use_addr == addr:
+ logger.error("IP address is in use by a different network")
+ return FAIL
+ np_prop = {
+ "Address" : addr,
+ "Netmask" : "255.255.255.0",
+ "IPRangeStart" : "192.168.0.31",
+ "IPRangeEnd" : "192.168.0.57",
+ }
+ np_id = 'NetworkPool/%s' % test_pool
+ iname = CIMInstanceName(nprasd,
+ namespace = CIM_NS,
+ keybindings = {'InstanceID':np_id})
+ if test_pool == "routedpool":
+ np_prop["ForwardMode"] = "route eth1"
+ elif test_pool == "natpool":
+ np_prop["ForwardMode"] = "nat"
+
+ nrasd = CIMInstance(nprasd, path = iname, properties = np_prop)
+ try:
+ rpcs_conn.CreateChildResourcePool(ElementName=test_pool,
+ Settings=[nrasd.tomof()])
+ except Exception, details:
+ logger.error("Error in childpool creation")
+ logger.error(details)
+ return FAIL
+
+ networkpool = get_typed_class(virt, 'NetworkPool')
+ pool_list = EnumInstances(server, networkpool)
+ if len(pool_list) < 1:
+ logger.error("Return %i instances, expected at least one instance",
+ len(pool_list))
+ return FAIL
+
+ for i in range(0, len(pool_list)):
+ ret_pool = pool_list[i].InstanceID
+ if ret_pool == np_id:
+ status = PASS
+ break
+ elif ret_pool != poolname and i == len(pool_list)-1:
+ logger.error("Can not find expected pool")
+ return FAIL
+
+ return status
15 years, 6 months
[PATCH] Work around for sfcb's lack of association handling
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1240873892 25200
# Node ID 1cb3975921d590d4dda4de197a4dc687e45d1840
# Parent d4a9e07d6738f76780bcb1ada5b7c0dbc57e4e0f
Work around for sfcb's lack of association handling
If a association provider has multiple classes listed, and a user queries with
the super class for the classes listed in the registration, the provider is
not called each time for each class. Instead, the provider is called once.
This logic detects whether the association classname specified for by the user
is an exact match of one of the classnames in the registration. If it is,
the provider is only called once. If the classname is a super class, then the
provider is called once for each class listed in the registration.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r d4a9e07d6738 -r 1cb3975921d5 std_association.c
--- a/std_association.c Thu Jan 22 11:33:20 2009 -0800
+++ b/std_association.c Mon Apr 27 16:11:32 2009 -0700
@@ -274,6 +274,56 @@
return s;
}
+static bool do_generic_assoc_call(struct std_assoc_info *info,
+ struct std_assoc *handler)
+{
+ int i;
+
+ if (info->assoc_class == NULL) {
+ return true;
+ } else {
+ for (i = 0; handler->assoc_class[i]; i++) {
+ if (STREQ(info->assoc_class, handler->assoc_class[i]))
+ return false;
+ }
+ }
+
+ return true;
+}
+
+static CMPIStatus handle_assoc(struct std_assoc_info *info,
+ const CMPIObjectPath *ref,
+ struct std_assoc *handler,
+ struct inst_list *list)
+{
+ CMPIStatus s = {CMPI_RC_OK, NULL};
+ int i;
+
+ if (do_generic_assoc_call(info, handler)) {
+ for (i = 0; handler->assoc_class[i]; i++) {
+ info->assoc_class = handler->assoc_class[i];
+
+ CU_DEBUG("Calling handler ...");
+ s = handler->handler(ref, info, list);
+ if (s.rc != CMPI_RC_OK) {
+ CU_DEBUG("Handler did not return CMPI_RC_OK.");
+ goto out;
+ }
+ }
+ } else {
+ CU_DEBUG("Calling handler ...");
+ s = handler->handler(ref, info, list);
+ if (s.rc != CMPI_RC_OK) {
+ CU_DEBUG("Handler did not return CMPI_RC_OK.");
+ goto out;
+ }
+ }
+ CU_DEBUG("Handler returned CMPI_RC_OK.");
+
+ out:
+ return s;
+}
+
static CMPIStatus do_assoc(struct std_assoc_ctx *ctx,
struct std_assoc_info *info,
const CMPIResult *results,
@@ -284,6 +334,7 @@
CMPIStatus s = {CMPI_RC_OK, NULL};
struct inst_list list;
struct std_assoc *handler;
+ int i;
CU_DEBUG("Getting handler ...");
handler = std_assoc_get_handler(ctx, info, ref);
@@ -295,13 +346,23 @@
inst_list_init(&list);
- CU_DEBUG("Calling handler ...");
- s = handler->handler(ref, info, &list);
- if (s.rc != CMPI_RC_OK) {
- CU_DEBUG("Handler did not return CMPI_RC_OK.");
- goto out;
+ if (do_generic_assoc_call(info, handler)) {
+ for (i = 0; handler->assoc_class[i]; i++) {
+ info->assoc_class = handler->assoc_class[i];
+
+ s = handle_assoc(info, ref, handler, &list);
+ if (s.rc != CMPI_RC_OK) {
+ CU_DEBUG("Failed to handle association");
+ goto out;
+ }
+ }
+ } else {
+ s = handle_assoc(info, ref, handler, &list);
+ if (s.rc != CMPI_RC_OK) {
+ CU_DEBUG("Failed to handle association");
+ goto out;
+ }
}
- CU_DEBUG("Handler returned CMPI_RC_OK.");
/* References and ReferenceNames */
if (ref_rslt)
@@ -320,6 +381,7 @@
CU_DEBUG("Prepare return list did not return CMPI_RC_OK.");
goto out;
}
+
CU_DEBUG("Returned %u instance(s).", list.cur);
if (names_only)
15 years, 6 months