[PATCH] [TEST] #2 Add test for hypervisor version string

# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1217426131 25200 # Node ID e3d4987d295d2905b921a1a3980430cd7bb03735 # Parent 32d78f23f6e73f5443022179410128767896465d [TEST] #2 Add test for hypervisor version string Changes: - Check for None result of service Signed-off-by: Dan Smith <danms@us.ibm.com> diff -r 32d78f23f6e7 -r e3d4987d295d lib/VirtLib/live.py --- a/lib/VirtLib/live.py Wed Jul 23 00:32:36 2008 -0700 +++ b/lib/VirtLib/live.py Wed Jul 30 06:55:31 2008 -0700 @@ -347,3 +347,10 @@ return out return None +def get_hv_ver(server, virt="Xen"): + cmd = "virsh -c %s version | grep ^Running | cut -d ' ' -f 3,4" % utils.virt2uri(virt) + ret, out = utils.run_remote(server, cmd) + if ret == 0: + return out + else: + return None diff -r 32d78f23f6e7 -r e3d4987d295d suites/libvirt-cim/cimtest/VirtualSystemManagementService/10_hv_version.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/10_hv_version.py Wed Jul 30 06:55:31 2008 -0700 @@ -0,0 +1,63 @@ +#!/usr/bin/python +# +# Copyright 2008 IBM Corp. +# +# Authors: +# Dan Smith <danms@us.ibm.com> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +import sys +import pywbem +from VirtLib import live +from XenKvmLib import vsms +from CimTest.Globals import do_main +from CimTest.Globals import logger +from CimTest.ReturnCodes import FAIL, PASS + +sup_types = ['Xen', 'XenFV', 'KVM', 'LXC'] + +@do_main(sup_types) +def main(): + options = main.options + + try: + service = vsms.enumerate_instances(options.ip, options.virt)[0] + except Exception, details: + service = None + + if not service: + logger.error("Did not find VSMS instance") + logger.error(details) + return FAIL + + try: + cim_ver = service["Caption"] + local_ver = live.get_hv_ver(options.ip, options.virt) + + if cim_ver != local_ver: + logger.error("CIM says version is `%s', but libvirt says `%s'") + return FAIL + else: + logger.info("Verified %s == %s" % (cim_ver, local_ver)) + except Exception, details: + logger.error(details) + return FAIL + + return PASS + +if __name__ == "__main__": + sys.exit(main())
participants (1)
-
Dan Smith