[PATCH 0/9] cimtest changes

Here's my set of cimtest changes. Quite a few of the changes deal with the illegal MAC address that starts with 99-* - this is a multicast MAC which is not allowed. There are changes to handle systemd/nfs, a couple dealing with fedora vs. rhel default network device name, and a couple of fixes that I just dug into to resolve on my f18 box. I get the following results: ================================================= FAIL : 4 XFAIL : 3 SKIP : 11 PASS : 174 ----------------- Total : 192 ================================================= FAIL Test Summary: ComputerSystemIndication - 01_created_indication.py: FAIL RASDIndications - 01_guest_states_rasd_ind.py: FAIL RASDIndications - 02_guest_add_mod_rem_rasd_ind.py: FAIL VirtualSystemManagementService - 22_addmulti_brg_interface.py: FAIL ================================================= XFAIL Test Summary: SwitchService - 01_enum.py: XFAIL VirtualSystemManagementService - 28_definesystem_with_vsi_profile.py: XFAIL VirtualSystemManagementService - 30_dynamic_disk_mod.py: XFAIL ================================================= SKIP Test Summary: ComputerSystem - 02_nosystems.py: SKIP ComputerSystemMigrationJobIndication - 01_csmig_ind_for_offline_mig.py: SKIP LogicalDisk - 02_nodevs.py: SKIP Profile - 04_verify_libvirt_cim_slp_profiles.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 VSSD - 02_bootldr.py: SKIP John Ferlan (9): Need to check "slp=true", not just "slp" since "slp=false" is possible Change the MAC from "99:" to "88:" Create a temporary directory for disk pool tests Use symbols as named in libvirt-cim for easier reference Fix nfs-server lookup code Fix os_status passing to reporter functions Resolve issues found in test. On Fedora systems default to using 'em1' instead of 'eth1' 19 - resolve issues found in test .../Profile/04_verify_libvirt_cim_slp_profiles.py | 2 +- .../08_CreateDiskResourcePool.py | 26 ++++++-- .../09_DeleteDiskPool.py | 19 ++++-- .../15_DiskPoolAutostart.py | 11 +++- .../libvirt-cim/cimtest/VSSD/06_duplicate_uuid.py | 2 +- .../06_addresource.py | 2 +- .../08_modifyresource.py | 4 +- .../13_refconfig_additional_devs.py | 4 +- .../15_mod_system_settings.py | 11 ++-- .../18_define_sys_bridge.py | 2 +- .../19_definenetwork_ers.py | 17 +++-- .../22_addmulti_brg_interface.py | 2 +- .../27_definesystem_macvtap_dev.py | 19 +++++- .../28_definesystem_with_vsi_profile.py | 15 +++++ suites/libvirt-cim/lib/XenKvmLib/common_util.py | 77 +++++++++++++++++----- suites/libvirt-cim/lib/XenKvmLib/const.py | 6 +- suites/libvirt-cim/lib/XenKvmLib/test_xml.py | 2 +- suites/libvirt-cim/main.py | 15 +++++ 18 files changed, 183 insertions(+), 53 deletions(-) -- 1.8.1.4

--- .../libvirt-cim/cimtest/Profile/04_verify_libvirt_cim_slp_profiles.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/suites/libvirt-cim/cimtest/Profile/04_verify_libvirt_cim_slp_profiles.py b/suites/libvirt-cim/cimtest/Profile/04_verify_libvirt_cim_slp_profiles.py index f6cf5b1..f08d157 100644 --- a/suites/libvirt-cim/cimtest/Profile/04_verify_libvirt_cim_slp_profiles.py +++ b/suites/libvirt-cim/cimtest/Profile/04_verify_libvirt_cim_slp_profiles.py @@ -64,7 +64,7 @@ def get_slp_info(server): logger.info("Test not supported for sfcb yet ... hence skipping") return SKIP - cmd = "cimconfig -l -p | grep slp" + cmd = "cimconfig -l -p | grep slp=true" rc, out = run_remote(server, cmd) if rc != 0: logger.error("SLP is not enabled for the cimserver on '%s'", server) -- 1.8.1.4

Using a MAC starting with "99:" is not legal. That ends up being a Multicast Address since the low order bit of the first byte of the address (in hex) is one. That is "99" is 0x10011001" in hex, where the least significant bit is a "1" (one) indicating a multicast. --- suites/libvirt-cim/cimtest/VSSD/06_duplicate_uuid.py | 2 +- .../cimtest/VirtualSystemManagementService/06_addresource.py | 2 +- .../cimtest/VirtualSystemManagementService/08_modifyresource.py | 4 ++-- .../VirtualSystemManagementService/13_refconfig_additional_devs.py | 4 ++-- .../cimtest/VirtualSystemManagementService/18_define_sys_bridge.py | 2 +- .../VirtualSystemManagementService/22_addmulti_brg_interface.py | 2 +- suites/libvirt-cim/lib/XenKvmLib/const.py | 6 +++--- suites/libvirt-cim/lib/XenKvmLib/test_xml.py | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/suites/libvirt-cim/cimtest/VSSD/06_duplicate_uuid.py b/suites/libvirt-cim/cimtest/VSSD/06_duplicate_uuid.py index c5d8a22..be82335 100644 --- a/suites/libvirt-cim/cimtest/VSSD/06_duplicate_uuid.py +++ b/suites/libvirt-cim/cimtest/VSSD/06_duplicate_uuid.py @@ -40,7 +40,7 @@ from XenKvmLib.const import get_provider_version sup_types = ['Xen', 'KVM', 'XenFV', 'LXC'] default_dom = 'uuid_domain' test_dom = 'test_domain' -nmac = '99:aa:bb:cc:ee:ff' +nmac = '88:aa:bb:cc:ee:ff' duplicate_uuid_support = 915 def get_vssd(ip, virt, dom): diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/06_addresource.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/06_addresource.py index fdcb84a..ac18c69 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/06_addresource.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/06_addresource.py @@ -38,7 +38,7 @@ from XenKvmLib.common_util import create_netpool_conf, destroy_netpool sup_types = ['Xen', 'KVM', 'XenFV'] default_dom = 'rstest_domain' -nmac = '99:aa:bb:cc:ee:ff' +nmac = '88:aa:bb:cc:ee:ff' ntype = 'network' npool_name = default_network_name + str(random.randint(1, 100)) diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/08_modifyresource.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/08_modifyresource.py index df58d1f..a7c3871 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/08_modifyresource.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/08_modifyresource.py @@ -43,9 +43,9 @@ cpu = 2 ncpu = 1 nmem = 131072 new_int = randint(10, 99) -new_mac1 = "11:%s:22:%s:33:%s" % (new_int, new_int, new_int) +new_mac1 = "88:%s:22:%s:33:%s" % (new_int, new_int, new_int) new_int += 1 -new_mac2 = "11:%s:22:%s:33:%s" % (new_int, new_int, new_int) +new_mac2 = "88:%s:22:%s:33:%s" % (new_int, new_int, new_int) def cleanup_env(ip, cxml): cxml.destroy(ip) diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/13_refconfig_additional_devs.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/13_refconfig_additional_devs.py index 6274527..a47db8f 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/13_refconfig_additional_devs.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/13_refconfig_additional_devs.py @@ -38,8 +38,8 @@ from XenKvmLib.vxml import get_class sup_types = ['Xen', 'XenFV', 'KVM'] test_dom = 'rstest_domain' test_dom2 = 'rstest_domain2' -mac1 = '99:aa:bb:cc:ee:ff' -mac2 = '99:aa:bb:cc:ee:aa' +mac1 = '88:aa:bb:cc:ee:ff' +mac2 = '88:aa:bb:cc:ee:aa' REQUESTED_STATE = 2 TIME = "00000000000000.000000:000" diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/18_define_sys_bridge.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/18_define_sys_bridge.py index e02de29..66b3e45 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/18_define_sys_bridge.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/18_define_sys_bridge.py @@ -32,7 +32,7 @@ from XenKvmLib.common_util import create_netpool_conf, destroy_netpool sup_types = ['Xen', 'KVM', 'XenFV'] default_dom = 'brgtest_domain' -nmac = '99:aa:bb:cc:ee:ff' +nmac = '88:aa:bb:cc:ee:ff' npool_name = default_network_name + str(random.randint(1, 100)) brg_name = "br" + str(random.randint(1, 100)) diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/22_addmulti_brg_interface.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/22_addmulti_brg_interface.py index 9abb21b..36d1873 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/22_addmulti_brg_interface.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/22_addmulti_brg_interface.py @@ -36,7 +36,7 @@ sup_types = ['Xen', 'KVM', 'XenFV'] test_dom = "my_domain1" default_net = "my_network0" test_net = "my_network1" -test_mac = '99:aa:bb:cc:ee:ff' +test_mac = '88:aa:bb:cc:ee:ff' default_mac = "00:11:33:33:44:55" ntype = 'bridge' default_brg = 'mybr0' diff --git a/suites/libvirt-cim/lib/XenKvmLib/const.py b/suites/libvirt-cim/lib/XenKvmLib/const.py index 6dea644..6701d36 100755 --- a/suites/libvirt-cim/lib/XenKvmLib/const.py +++ b/suites/libvirt-cim/lib/XenKvmLib/const.py @@ -80,7 +80,7 @@ Xen_init_path = os.path.join(_image_dir, 'default-xen-initrd') Xen_disk_path = os.path.join(_image_dir, 'default-xen-dimage') Xen_secondary_disk_path = os.path.join(_image_dir, 'default-xen-dimage.2ND') Xen_default_disk_dev = 'xvda' -Xen_default_mac = '11:22:33:aa:bb:cc' +Xen_default_mac = '88:22:33:aa:bb:cc' # vxml.KVMXML KVM_default_emulator = '/usr/bin/qemu-system-x86_64' @@ -88,7 +88,7 @@ KVM_disk_path = os.path.join(_image_dir, 'default-kvm-dimage') KVM_secondary_disk_path = os.path.join(_image_dir, 'default-kvm-dimage.2ND') KVM_default_disk_dev = 'hda' KVM_default_cdrom_dev = 'hdc' -KVM_default_mac = '11:22:33:aa:bb:cc' +KVM_default_mac = '88:22:33:aa:bb:cc' # vxml.XenFVXML s, o = platform.architecture() @@ -109,7 +109,7 @@ LXC_default_emulator = '/usr/libexec/libvirt_lxc' LXC_default_tty = '/dev/ptmx' LXC_default_mp = '/tmp' LXC_default_source = '/var/lib/libvirt/images/lxc_files' -LXC_default_mac = '11:22:33:aa:bb:cc' +LXC_default_mac = '88:22:33:aa:bb:cc' LXC_netns_support = False parser = OptionParser() diff --git a/suites/libvirt-cim/lib/XenKvmLib/test_xml.py b/suites/libvirt-cim/lib/XenKvmLib/test_xml.py index b32ae4c..914dbb0 100755 --- a/suites/libvirt-cim/lib/XenKvmLib/test_xml.py +++ b/suites/libvirt-cim/lib/XenKvmLib/test_xml.py @@ -42,7 +42,7 @@ kernel_path = os.path.join(image_dir, 'default-xen-kernel') init_path = os.path.join(image_dir, 'default-xen-initrd') disk_path = os.path.join(image_dir, 'default-xen-dimage') -default_mac = '11:22:33:aa:bb:cc' +default_mac = '88:22:33:aa:bb:cc' def testxml(test_dom="domU1", mem = 128, vcpus = 1, mac = default_mac, disk_file_path = disk_path, disk = "xvda"): -- 1.8.1.4

We cannot have two storage pools referencing the same path. Since the cimtest-diskpool is already created at /var/lib/libvirt/images, we'll use that (e.g. _image_dir symbol) to create a subdirectory for the test. We'll also delete that directory when we're done. --- .../08_CreateDiskResourcePool.py | 26 +++++++++++++++++----- .../09_DeleteDiskPool.py | 19 +++++++++++----- .../15_DiskPoolAutostart.py | 11 ++++++++- 3 files changed, 43 insertions(+), 13 deletions(-) diff --git a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/08_CreateDiskResourcePool.py b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/08_CreateDiskResourcePool.py index c82b5b0..636f59c 100644 --- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/08_CreateDiskResourcePool.py +++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/08_CreateDiskResourcePool.py @@ -48,6 +48,7 @@ # -Date: 26.05.2009 import sys +import os from CimTest.Globals import logger from XenKvmLib.xm_virt_util import virsh_version from CimTest.ReturnCodes import FAIL, PASS, SKIP @@ -55,8 +56,9 @@ from XenKvmLib.const import do_main, platform_sup from XenKvmLib.classes import get_typed_class from XenKvmLib.common_util import destroy_diskpool, nfs_netfs_setup, \ netfs_cleanup -from XenKvmLib.pool import create_pool, verify_pool, undefine_diskpool -from XenKvmLib.const import get_provider_version +from XenKvmLib.pool import create_pool, verify_pool, undefine_diskpool, \ + DIR_POOL, NETFS_POOL +from XenKvmLib.const import get_provider_version, _image_dir libvirt_disk_pool_support=837 libvirt_netfs_pool_support=869 @@ -94,19 +96,20 @@ def main(): curr_cim_rev, changeset = get_provider_version(virt, server) if curr_cim_rev >= libvirt_disk_pool_support: - dp_types["DISK_POOL_DIR"] = 1 + dp_types["DISK_POOL_DIR"] = DIR_POOL if curr_cim_rev >= libvirt_netfs_pool_support: - dp_types["DISK_POOL_NETFS"] = 3 + dp_types["DISK_POOL_NETFS"] = NETFS_POOL if len(dp_types) == 0 : - logger.info("No disk pool types in list , hence skipping the test...") + logger.info("No disk pool types in list, hence skipping the test...") return SKIP status = FAIL pool_attr = None # For now the test case support only the creation of # dir type disk pool, netfs later change to fs and disk pooltypes etc - for key, value in dp_types.iteritems(): + for key, value in dp_types.iteritems(): + del_path = False try: logger.info("Verifying '%s'.....", key) test_pool = key @@ -115,6 +118,15 @@ def main(): if status != PASS: return FAIL + # Cannot have two pools that use the same location/path, so + # since cimtest-diskpool already exists + if key == 'DISK_POOL_DIR': + path = os.path.join(_image_dir, 'temppool') + if not os.path.exists(path): + os.mkdir(path) + del_path = True + pool_attr["Path"] = path + status = create_pool(server, virt, test_pool, pool_attr, mode_type=value, pool_type= "DiskPool") @@ -152,6 +164,8 @@ def main(): if key == 'DISK_POOL_NETFS': netfs_cleanup(server, pool_attr) + if del_path: + os.rmdir(path) return status if __name__ == "__main__": diff --git a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/09_DeleteDiskPool.py b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/09_DeleteDiskPool.py index 31e3f22..8bd15e2 100644 --- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/09_DeleteDiskPool.py +++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/09_DeleteDiskPool.py @@ -44,6 +44,7 @@ # -Date: 26.05.2009 import sys +import os import pywbem from XenKvmLib import rpcs_service from CimTest.Globals import logger @@ -88,13 +89,17 @@ def main(): elif curr_cim_rev >= libvirt_cim_child_pool_rev: + del_path = False try: - pool_attr = { "Path" : _image_dir } + path = os.path.join(_image_dir, 'deltest') + if not os.path.exists(path): + os.mkdir(path) + del_path = True + pool_attr = { "Path" : path } status = create_pool(server, virt, test_pool, pool_attr, pool_type="DiskPool", mode_type=TYPE) if status != PASS: - logger.error("Failed to create diskpool '%s'", test_pool) - return status + raise Exception("Failed to create diskpool '%s'" % test_pool) status = verify_pool(server, virt, test_pool, pool_attr, pool_type="DiskPool") @@ -112,8 +117,8 @@ def main(): break if pool_settings == None: - logger.error("Failed to get poolsettings for '%s'", test_pool) - return FAIL + raise Exception("Failed to get poolsettings for '%s'" \ + % test_pool) rpcs_conn.DeleteResourcePool(Pool = pool_settings) pool = EnumInstances(server, dp) @@ -127,8 +132,10 @@ def main(): logger.error("Exception details: %s", details) destroy_diskpool(server, virt, test_pool) undefine_diskpool(server, virt, test_pool) - return FAIL + status = FAIL + if del_path: + os.rmdir(path) return status if __name__ == "__main__": diff --git a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/15_DiskPoolAutostart.py b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/15_DiskPoolAutostart.py index b6b758c..b7e72a8 100644 --- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/15_DiskPoolAutostart.py +++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/15_DiskPoolAutostart.py @@ -23,6 +23,7 @@ # -Date: 04.14.2011 import sys +import os from pywbem import cim_types from CimTest.Globals import logger from XenKvmLib.xm_virt_util import virsh_version @@ -77,12 +78,17 @@ def main(): pool_attr = None key = 'DISK_POOL_DIR' value = 1 + del_path = False try: logger.info("Verifying '%s'.....", key) test_pool = key - pool_attr = { "Path" : "/var/lib/libvirt/images", + pool_attr = { "Path" : "/var/lib/libvirt/images/autotest", "Autostart" : cim_types.Uint16(1) } + if not os.path.exists(pool_attr["Path"]): + os.mkdir(pool_attr["Path"]) + del_path = True + status = create_pool(server, virt, test_pool, pool_attr, mode_type=value, pool_type= "DiskPool") @@ -112,6 +118,9 @@ def main(): status = FAIL logger.error("Exception details: %s", details) + if del_path: + os.rmdir(pool_attr["Path"]) + return status if __name__ == "__main__": -- 1.8.1.4

--- .../VirtualSystemManagementService/15_mod_system_settings.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/15_mod_system_settings.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/15_mod_system_settings.py index e576fca..0be3ae0 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/15_mod_system_settings.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/15_mod_system_settings.py @@ -37,7 +37,10 @@ from XenKvmLib.xm_virt_util import domain_list, active_domain_list, \ sup_types = ['Xen', 'KVM', 'XenFV', 'LXC'] default_dom = 'rstest_domain' cpu = 2 -RECOVERY_VAL = 3 +# AutomaticRecoveryAction +NONE_VAL = 2 +RESTART_VAL = 3 + DEFINED_STATE = 3 bug = "00008" f9_bug = "00010" @@ -113,7 +116,7 @@ def main(): raise Expcetion("Failed to get the VSSD instance for %s" % \ default_dom) - val = pywbem.cim_types.Uint16(RECOVERY_VAL) + val = pywbem.cim_types.Uint16(RESTART_VAL) inst['AutomaticRecoveryAction'] = val vssd = inst_to_mof(inst) @@ -135,9 +138,9 @@ def main(): raise Exception("Failed to get the VSSD instance for %s" % \ default_dom) - if inst.AutomaticRecoveryAction != RECOVERY_VAL: + if inst.AutomaticRecoveryAction != RESTART_VAL: logger.error("Exp AutomaticRecoveryAction=%d, got %d", - RECOVERY_VAL, inst.AutomaticRecoveryAction) + RESTART_VAL, inst.AutomaticRecoveryAction) raise Exception("%s not updated properly" % default_dom) status = PASS -- 1.8.1.4

The 'get_nfs_bin()', 'nfs_config()', and 'nfs_netfs_setup()' API's needed adjustment to handle using systemd rather than looking for /etc/init.d/nfs --- suites/libvirt-cim/lib/XenKvmLib/common_util.py | 77 ++++++++++++++++++++----- 1 file changed, 61 insertions(+), 16 deletions(-) diff --git a/suites/libvirt-cim/lib/XenKvmLib/common_util.py b/suites/libvirt-cim/lib/XenKvmLib/common_util.py index f145811..43e5e2c 100644 --- a/suites/libvirt-cim/lib/XenKvmLib/common_util.py +++ b/suites/libvirt-cim/lib/XenKvmLib/common_util.py @@ -493,27 +493,65 @@ def parse_instance_id(instid): def get_nfs_bin(server): cmd = 'cat /etc/issue | grep -v ^$ | egrep "Red Hat|Fedora"' rc, out = utils.run_remote(server, cmd) + is_systemd = 0 if rc != 0: #SLES nfs_server_bin = "/etc/init.d/nfsserver" else: + # Default, but allow it to be changed nfs_server_bin = "/etc/init.d/nfs" - return nfs_server_bin - -def nfs_config(server, nfs_server_bin): - cmd = "ps aux | grep -v -e nfsiod -e grep | grep nfsd" + # Check for 'systemd' being used + # Fedora 15 seems to have been the first place this was the default + # RHEL 7 and beyond will also use the mechanism. + # Since 'out' returns the fetched string, let's parse it a bit more + # looking for the number after the string 'release' which happens to + # be the version. On Fedora systems it's + # "Fedora release 18 (Spherical Cow)" while on RHEL systems it's: + # "Red Hat Enterprise Linux Server release 6.4 (Santiago)" + # + elems = out.split() + if elems[0] == 'Fedora' or (elems[0] == 'Red' and elems[1] == 'Hat'): + for i in range(1, len(elems)): + if elems[i] == 'release': + if (elems[0] == 'Fedora' and int(elems[i+1]) >= 15) or \ + (elems[0] == 'Red' and int(elems[i+1]) >= 7): + # Handle this differently - the command would be + # "systemctl {start|restart|status} nfs" + nfs_server_bin = "systemctl %s nfs" + is_systemd = 1 + break + + return nfs_server_bin, is_systemd + +def nfs_config(server, nfs_server_bin, is_systemd): + if is_systemd == 0: + cmd = "ps aux | grep -v -e nfsiod -e grep | grep nfsd" + else: + cmd = "systemctl | grep nfs-server" rc, out = utils.run_remote(server, cmd) # if NFS services is not found on the machine, start it.. if rc != PASS : # Check if NFS server is installed ... - if not os.path.exists(nfs_server_bin): - logger.error("NFS server '%s' does not seem to be installed "\ - "on '%s'", nfs_server_bin, server) - return SKIP + if is_systemd == 0: + if not os.path.exists(nfs_server_bin): + logger.error("NFS server '%s' does not seem to be installed "\ + "on '%s'", nfs_server_bin, server) + return SKIP + else: + # Works on Fedora and RHEL6 + cmd = "rpm -q nfs-utils" + rc, out = utils.run_remote(server, cmd) + if rc != PASS : + logger.error("NFS server package nfs-utils does not seem "\ + "to be installed on '%s'", server) + return SKIP # Start the nfs server ... - nfs_server_cmd = "%s start" % nfs_server_bin + if is_systemd == 0: + nfs_server_cmd = "%s start" % nfs_server_bin + else: + nfs_server_cmd = nfs_server_bin % "start" rc, out = utils.run_remote(server, nfs_server_cmd) if rc != PASS: logger.error("Could not start the nfsserver on '%s'", server) @@ -573,13 +611,16 @@ def netfs_cleanup(server, pool_attr): move_file(back_exports_file, exports_file) # restart the nfs server - nfs_server_bin = get_nfs_bin(server) - nfs_server_cmd = "%s restart" % nfs_server_bin + nfs_server_bin, is_systemd = get_nfs_bin(server) + if is_systemd == 0: + nfs_server_cmd = "%s restart" % nfs_server_bin + else: + nfs_server_cmd = nfs_server_bin % "restart" rc, out = utils.run_remote(server, nfs_server_cmd) if rc != PASS: logger.error("Could not restart NFS server on '%s'" % server) -def netfs_config(server, nfs_server_bin, dest_dir_to_mnt): +def netfs_config(server, nfs_server_bin, dest_dir_to_mnt, is_systemd): src_dir_for_mnt = mkdtemp() try: @@ -601,7 +642,10 @@ def netfs_config(server, nfs_server_bin, dest_dir_to_mnt): % (src_dir_for_mnt, dest_dir_to_mnt)) # Restart the nfs server.... - nfs_server_cmd = "%s restart" % nfs_server_bin + if is_systemd == 0: + nfs_server_cmd = "%s restart" % nfs_server_bin + else: + nfs_server_cmd = nfs_server_bin % "restart" rc, out = utils.run_remote(server, nfs_server_cmd) if rc != PASS: raise Exception("Could not restart NFS server on '%s'" % server) @@ -615,12 +659,12 @@ def netfs_config(server, nfs_server_bin, dest_dir_to_mnt): return PASS, src_dir_for_mnt def nfs_netfs_setup(server): - nfs_server_bin = get_nfs_bin(server) + nfs_server_bin, is_systemd = get_nfs_bin(server) dest_dir = mkdtemp() # Before going ahead verify that nfs server is available on machine.. - ret = nfs_config(server, nfs_server_bin) + ret = nfs_config(server, nfs_server_bin, is_systemd) if ret != PASS: logger.error("Failed to configure NFS on '%s'", server) logger.info("Trying to look for nfs mounted dir on '%s'...", server) @@ -631,7 +675,8 @@ def nfs_netfs_setup(server): else: return PASS, server, src_dir, dest_dir else: - ret, src_dir = netfs_config(server, nfs_server_bin, dest_dir) + ret, src_dir = netfs_config(server, nfs_server_bin, \ + dest_dir, is_systemd) if ret != PASS: logger.error("Failed to configure netfs on '%s'", server) return ret, None, None, None -- 1.8.1.4

If the status returned is an errno value, then os_status will be set outside of the bounds of the 'rc' array in Reporter.py which will cause a KeyError exception. Find, message, and adjust - we're failing anyway. --- suites/libvirt-cim/main.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/suites/libvirt-cim/main.py b/suites/libvirt-cim/main.py index a4e33e6..e5f3526 100644 --- a/suites/libvirt-cim/main.py +++ b/suites/libvirt-cim/main.py @@ -23,12 +23,14 @@ # from time import time +from time import sleep from optparse import OptionParser import os import sys sys.path.append('../../lib') import TestSuite from CimTest.Globals import logger, log_param +from CimTest.ReturnCodes import PASS, FAIL, XFAIL, SKIP import commands from VirtLib import groups import ConfigParser @@ -274,6 +276,14 @@ def main(options, args): os_status = os.WEXITSTATUS(status) + # status should be from our test; however, if there's an OS level + # failure, it could be set to errno. But that's included in our + # output, so just set it to FAIL; otherwise, we get a KeyError + # in Reporter.py when trying to index it's 'rc' record + if os_status not in (PASS, FAIL, XFAIL, SKIP): + logger.error("Changing os_status from %d to FAIL", os_status) + os_status = FAIL + testsuite.print_results(test['group'], test['test'], os_status, output) exec_time = end_time - start_time @@ -282,6 +292,11 @@ def main(options, args): if options.print_exec_time: print_exec_time(testsuite, exec_time, " Test execution time:") + # Give ourselves a 3 second pause before running the next + # test to help ensure we have cleaned things up properly just + # in case the cimserver is a little slow to respond + sleep(3) + testsuite.debug("%s\n" % div) if options.print_exec_time: -- 1.8.1.4

1. Use a MAC that isn't a multicast MAC. 2. Error messages changed in libvirt "0.9.8", so we need to account for that --- .../19_definenetwork_ers.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py index ad7c1ce..4cda327 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py @@ -37,7 +37,7 @@ from XenKvmLib.xm_virt_util import virsh_version sup_types = ['Xen', 'KVM', 'XenFV'] default_dom = 'brgtest_domain' -nmac = '99:aa:bb:cc:ee:ff' +nmac = '88:aa:bb:cc:ee:ff' npool_name = default_network_name + str(random.randint(1, 100)) brg_name = "br" + str(random.randint(1, 100)) @@ -89,11 +89,16 @@ def main(): expected_values['invalid']['bridge'] = inv_br_str else: + logger.error('DEBUG libvirt_version=%s', libvirt_version) if libvirt_version >= "0.7.0": expected_values['empty']['network'] = inv_empty_network expected_values['invalid']['network'] = inv_empty_network - expected_values['invalid']['bridge'] = " Failed to add tap "\ - "interface to bridge" + if libvirt_version >= "0.9.8": + expected_values['invalid']['bridge'] = "Cannot get interface "\ + "MTU on 'invalid'" + else: + expected_values['invalid']['bridge'] = " Failed to add tap "\ + "interface to bridge" tc_scen = { @@ -114,7 +119,8 @@ def main(): status = PASS for nettype in nettypes: for tc, field in tc_scen.iteritems(): - logger.error("DEBUG nettype is %s, field is %s, tc is %s", nettype, field, tc) + logger.error("DEBUG nettype is %s, field is %s, tc is %s", + nettype, field, tc) cxml = vxml.get_class(options.virt)(default_dom, mac=nmac, ntype=nettype, net_name=field) @@ -122,7 +128,7 @@ def main(): try: ret = cxml.cim_define(options.ip) - if not ret: + if not ret: status = verify_error(exp_rc, exp_desc, cxml) if status != PASS: # There are few libvirt version between 0.7.0 @@ -138,7 +144,7 @@ def main(): cxml.err_rc, cxml.err_desc)) continue ret = cxml.cim_start(options.ip) - if ret: + if ret: status = verify_error(exp_rc, exp_desc, cxml) cxml.undefine(options.ip) if status != PASS: -- 1.8.1.4

Fedora changed the default device naming scheme, see http://fedoraproject.org/wiki/Features/ConsistentNetworkDeviceNaming So if we're running on Fedora, let's "default" to "em1" although that doesn't guarantee that we will find what we're looking for. This code probably needs some mechanism to detect with interfaces are available, then query those interfaces to find one that supports the feature we want. --- .../27_definesystem_macvtap_dev.py | 19 ++++++++++++++++++- .../28_definesystem_with_vsi_profile.py | 15 +++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/27_definesystem_macvtap_dev.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/27_definesystem_macvtap_dev.py index 8c20781..36bf52f 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/27_definesystem_macvtap_dev.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/27_definesystem_macvtap_dev.py @@ -32,6 +32,7 @@ import sys from CimTest.Globals import logger from CimTest.ReturnCodes import FAIL, PASS, SKIP +from VirtLib import utils from XenKvmLib.classes import get_typed_class, inst_to_mof from XenKvmLib.rasd import get_default_rasds from XenKvmLib.const import do_main, get_provider_version @@ -101,6 +102,7 @@ def verify_net_rasd(ip, virt, target_dev, source_dev, guest_name): @do_main(sup_types) def main(): options = main.options + server = options.ip status = FAIL @@ -113,7 +115,22 @@ def main(): cxml = get_class(options.virt)(test_dom) target_dev = "vepa" - source_dev = "eth1" + + # Fedora changed the default device naming scheme, see + # http://fedoraproject.org/wiki/Features/ConsistentNetworkDeviceNaming + # + # So if we're running on Fedora, let's "default" to "em1" although that + # doesn't guarantee that we will find what we're looking for. This code + # probably needs some mechanism to detect with interfaces are available, + # then query those interfaces to find one that supports the feature we + # want. If not are found and XFAIL could be generated indicating so. + # + cmd = 'cat /etc/issue | grep -v ^$ | egrep "Fedora"' + rc, out = utils.run_remote(server, cmd) + if rc == 0: + source_dev = "em1" + else: + source_dev = "eth1" guest_defined = False diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py index d14dda3..2b108f9 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py @@ -35,6 +35,7 @@ import sys from CimTest.Globals import logger from CimTest.ReturnCodes import FAIL, PASS, SKIP, XFAIL_RC, XFAIL +from VirtLib import utils from XenKvmLib.classes import get_typed_class, inst_to_mof from XenKvmLib.rasd import get_default_rasds from XenKvmLib.const import do_main, get_provider_version @@ -173,6 +174,20 @@ def main(): 'VSITypeIDVersion' : "1" } + # Fedora changed the default device naming scheme, see + # http://fedoraproject.org/wiki/Features/ConsistentNetworkDeviceNaming + # + # So if we're running on Fedora, let's "default" to "em1" although that + # doesn't guarantee that we will find what we're looking for. This code + # probably needs some mechanism to detect with interfaces are available, + # then query those interfaces to find one that supports the feature we + # want. If not are found and XFAIL could be generated indicating so. + # + cmd = 'cat /etc/issue | grep -v ^$ | egrep "Fedora"' + rc, out = utils.run_remote(server, cmd) + if rc == 0: + vsi_defaults['SourceDevice'] = "em1" + nrasd_cn = get_typed_class(virt, 'NetResourceAllocationSettingData') status = FAIL cxml = None -- 1.8.1.4

--- .../cimtest/VirtualSystemManagementService/19_definenetwork_ers.py | 1 - 1 file changed, 1 deletion(-) diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py index 4cda327..cf461d1 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py @@ -89,7 +89,6 @@ def main(): expected_values['invalid']['bridge'] = inv_br_str else: - logger.error('DEBUG libvirt_version=%s', libvirt_version) if libvirt_version >= "0.7.0": expected_values['empty']['network'] = inv_empty_network expected_values['invalid']['network'] = inv_empty_network -- 1.8.1.4

Hi, John Thank u for the fix about cimtest. Currently I can't pay much time review this but later one colleague of mine will come to see the cimtest later. Since there are about 20+ patches for libvirt-cim hangs out there, and the queue is very long and make it hard to rebase, I think we need a way to sync our work, let's arrange out patches as following: 1-10: my patch V5. 11-later: your patches. I'll send V5 in a few days, could u rebase your work based on that? I'll provide a private git tree to easying down loading code.
Here's my set of cimtest changes. Quite a few of the changes deal with the illegal MAC address that starts with 99-* - this is a multicast MAC which is not allowed. There are changes to handle systemd/nfs, a couple dealing with fedora vs. rhel default network device name, and a couple of fixes that I just dug into to resolve on my f18 box.
I get the following results:
================================================= FAIL : 4 XFAIL : 3 SKIP : 11 PASS : 174 ----------------- Total : 192 ================================================= FAIL Test Summary: ComputerSystemIndication - 01_created_indication.py: FAIL RASDIndications - 01_guest_states_rasd_ind.py: FAIL RASDIndications - 02_guest_add_mod_rem_rasd_ind.py: FAIL VirtualSystemManagementService - 22_addmulti_brg_interface.py: FAIL
================================================= XFAIL Test Summary: SwitchService - 01_enum.py: XFAIL VirtualSystemManagementService - 28_definesystem_with_vsi_profile.py: XFAIL VirtualSystemManagementService - 30_dynamic_disk_mod.py: XFAIL
================================================= SKIP Test Summary: ComputerSystem - 02_nosystems.py: SKIP ComputerSystemMigrationJobIndication - 01_csmig_ind_for_offline_mig.py: SKIP LogicalDisk - 02_nodevs.py: SKIP Profile - 04_verify_libvirt_cim_slp_profiles.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 VSSD - 02_bootldr.py: SKIP
John Ferlan (9): Need to check "slp=true", not just "slp" since "slp=false" is possible Change the MAC from "99:" to "88:" Create a temporary directory for disk pool tests Use symbols as named in libvirt-cim for easier reference Fix nfs-server lookup code Fix os_status passing to reporter functions Resolve issues found in test. On Fedora systems default to using 'em1' instead of 'eth1' 19 - resolve issues found in test
.../Profile/04_verify_libvirt_cim_slp_profiles.py | 2 +- .../08_CreateDiskResourcePool.py | 26 ++++++-- .../09_DeleteDiskPool.py | 19 ++++-- .../15_DiskPoolAutostart.py | 11 +++- .../libvirt-cim/cimtest/VSSD/06_duplicate_uuid.py | 2 +- .../06_addresource.py | 2 +- .../08_modifyresource.py | 4 +- .../13_refconfig_additional_devs.py | 4 +- .../15_mod_system_settings.py | 11 ++-- .../18_define_sys_bridge.py | 2 +- .../19_definenetwork_ers.py | 17 +++-- .../22_addmulti_brg_interface.py | 2 +- .../27_definesystem_macvtap_dev.py | 19 +++++- .../28_definesystem_with_vsi_profile.py | 15 +++++ suites/libvirt-cim/lib/XenKvmLib/common_util.py | 77 +++++++++++++++++----- suites/libvirt-cim/lib/XenKvmLib/const.py | 6 +- suites/libvirt-cim/lib/XenKvmLib/test_xml.py | 2 +- suites/libvirt-cim/main.py | 15 +++++ 18 files changed, 183 insertions(+), 53 deletions(-)
-- Best Regards Wenchao Xia
participants (2)
-
John Ferlan
-
Wenchao Xia