[Libvirt-cim] [PATCH 2 of 2] [TEST] Replace calls to CIM_REV with get_provider_revision()

Guo Lian Yun yunguol at cn.ibm.com
Thu Aug 21 09:49:47 UTC 2008


+1 from me.

Best,
Regards

Daisy (运国莲)
VSM Team, China Systems & Technology Labs (CSTL)
E-mail: yunguol at cn.ibm.com
TEL: (86)-21-60922403
Building 10, 399 Ke Yuan Rd, Pudong Shanghai, 201203


libvirt-cim-bounces at redhat.com wrote on 2008-08-21 04:41:10:

> # HG changeset patch
> # User Kaitlin Rupert <karupert at us.ibm.com>
> # Date 1219263328 25200
> # Node ID 3c67961e54f615da6fc86862031f068cc8ed9745
> # Parent  7d4ed16e284fe614f8f61909850db14fec0070ab
> [TEST] Replace calls to CIM_REV with get_provider_revision()
> 
> Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>
> 
> diff -r 7d4ed16e284f -r 3c67961e54f6 suites/libvirt-
> cim/cimtest/NetworkPort/01_netport.py
> --- a/suites/libvirt-cim/cimtest/NetworkPort/01_netport.py   Wed Aug
> 20 13:15:28 2008 -0700
> +++ b/suites/libvirt-cim/cimtest/NetworkPort/01_netport.py   Wed Aug
> 20 13:15:28 2008 -0700
> @@ -39,11 +39,25 @@
>  from CimTest.Globals import logger
>  from CimTest.Globals import do_main
>  from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC
> +from XenKvmLib.const import get_provider_version 
> 
>  sup_types = ['Xen', 'KVM', 'XenFV']
> 
>  test_dom = "test_domain"
>  test_mac = "00:11:22:33:44:55"
> +
> +def get_linktech(ip, virt):
> +    rev, changeset = get_provider_version(virt, ip)
> +
> +    net_rev = 599
> +
> +    # The value of LinkTechnology should be set to 0 for rev > 599
> +    # else, it should be set to 2
> +    if net_rev > rev:
> +        return 0
> +    else:
> +        return 2
> +
> 
>  @do_main(sup_types)
>  def main():
> @@ -75,10 +89,12 @@
>          return FAIL
> 
>      status = PASS
> +
> +    link_tech = get_linktech(options.ip, options.virt)
> 
> -    if dev.LinkTechnology != devices.LinkTechnology_Ethernet:
> +    if dev.LinkTechnology != link_tech:
>          logger.error("LinkTechnology should be set to `%i' instead 
> of `%s'" % \
> -              (devices.LinkTechnology_Ethernet, dev.LinkTechnology))
> +              (link_tech, dev.LinkTechnology))
>          status = FAIL
> 
>      addrs = dev.NetworkAddresses
> diff -r 7d4ed16e284f -r 3c67961e54f6 suites/libvirt-
> cim/lib/XenKvmLib/devices.py
> --- a/suites/libvirt-cim/lib/XenKvmLib/devices.py   Wed Aug 20 13:
> 15:28 2008 -0700
> +++ b/suites/libvirt-cim/lib/XenKvmLib/devices.py   Wed Aug 20 13:
> 15:28 2008 -0700
> @@ -26,19 +26,8 @@
>  from CimTest import CimExt
>  from CimTest import Globals
>  from XenKvmLib import assoc
> -from XenKvmLib.const import CIM_REV
>  from XenKvmLib.classes import get_typed_class
> 
> -net_rev = 599
> -
> -# The branch has to be removed once the new rpm
> -# including the changes in revision 599 is available.
> -# The value of LinkTechnology should be set to 2 for
> -# network, bridge and ethernet type interfaces.
> -if net_rev > CIM_REV:
> -    LinkTechnology_Ethernet = 0
> -else:
> -    LinkTechnology_Ethernet = 2
> 
>  class CIM_Instance:
>      def __init__(self, inst):
> diff -r 7d4ed16e284f -r 3c67961e54f6 suites/libvirt-
> cim/lib/XenKvmLib/reporting.py
> --- a/suites/libvirt-cim/lib/XenKvmLib/reporting.py   Wed Aug 20 13:
> 15:28 2008 -0700
> +++ b/suites/libvirt-cim/lib/XenKvmLib/reporting.py   Wed Aug 20 13:
> 15:28 2008 -0700
> @@ -24,6 +24,7 @@
>  import smtplib
>  from time import gmtime, strftime
>  from VirtLib import utils
> +from XenKvmLib.const import get_provider_version 
> 
>  def get_cmd_val(cmd, ip):
>      rc, out = utils.run_remote(ip, cmd)
> @@ -67,7 +68,7 @@
>      return cimom, cimom_ver
> 
> 
> -def get_env_data(rev, changeset, ip):
> +def get_env_data(ip, virt):
>      distro = get_cmd_val("cat /etc/issue | awk 'NR<=1'", ip)
>      kernel_ver = get_cmd_val("uname -r", ip)
> 
> @@ -77,6 +78,8 @@
> 
>      env = "Distro: %s\nKernel: %s\nlibvirt: %s\nHypervisor: %
> s\nCIMOM: %s %s\n"\
>            % (distro, kernel_ver, libvirt_ver, hyp_ver, cimom, 
cimom_ver)
> +
> +    rev, changeset = get_provider_version(virt, ip)
> 
>      lc_ver = "Libvirt-cim revision: %s\nLibvirt-cim changeset: %s\n" % 
\
>               (rev, changeset)
> @@ -129,13 +132,13 @@
> 
>      return results, results_total, test_block
> 
> -def gen_report(rev, changeset, virt, ip, log_file):
> +def gen_report(virt, ip, log_file):
>      date = strftime("%b %d %Y", gmtime())
> 
>      cimom, cimom_ver = get_cimom_ver(ip)
> 
>      heading  = "%s on %s Test Run Summary for %s" % (virt, cimom, date)
> -    sys_env = get_env_data(rev, changeset, ip)
> +    sys_env = get_env_data(ip, virt)
> 
>      divider = "=================================================\n"
> 
> diff -r 7d4ed16e284f -r 3c67961e54f6 suites/libvirt-cim/main.py
> --- a/suites/libvirt-cim/main.py   Wed Aug 20 13:15:28 2008 -0700
> +++ b/suites/libvirt-cim/main.py   Wed Aug 20 13:15:28 2008 -0700
> @@ -192,8 +192,7 @@
>      testsuite.debug("%s\n" % div) 
>      testsuite.finish()
> 
> -    msg_body, heading = gen_report(revision, changeset, options.virt,
> -                                   options.ip, testsuite.log_file)
> +    msg_body, heading = gen_report(options.virt, options.ip, 
> testsuite.log_file)
> 
>      if options.report:
>          print "Sending mail from %s to %s using %s relay.\n" % \
> 
> _______________________________________________
> Libvirt-cim mailing list
> Libvirt-cim at redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-cim

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-cim/attachments/20080821/45323351/attachment.htm>


More information about the Libvirt-cim mailing list