+1

Sharad Mishra
Open Virtualization
Linux Technology Center
IBM

libvirt-cim-bounces@redhat.com wrote on 10/14/2011 01:27:48 PM:

> "Eduardo Lima \(Etrunko\)" <eblima@linux.vnet.ibm.com>

> Sent by: libvirt-cim-bounces@redhat.com
>

> 10/14/2011 01:27 PM
>
> Please respond to
> List for discussion and development of libvirt CIM <libvirt-cim@redhat.com>

>
> To

>
> libvirt-cim@redhat.com

>
> cc

>
> Subject

>
> [Libvirt-cim] [PATCH] [TEST] Fix syntax errors, small tweaks

>
>  suites/libvirt-cim/cimtest/VirtualSystemManagementService/
> 08_modifyresource.py     |  6 +++---
>  suites/libvirt-cim/cimtest/VirtualSystemManagementService/
> 31_unset_netrasd.py      |  2 +-
>  suites/libvirt-cim/cimtest/VirtualSystemManagementService/
> 32_modify_cdrom_media.py |  8 +++++++-
>  suites/libvirt-cim/main.py                                           |  2 +-
>  4 files changed, 12 insertions(+), 6 deletions(-)
>
>
> # HG changeset patch
> # User Eduardo Lima (Etrunko) <eblima@br.ibm.com>
> # Date 1317410876 10800
> # Node ID d8ac04bdc4806aecd1e5f28636a09ce501e36639
> # Parent  d9741a8b5eb7ccebf21d69f3cde72729bb60ad22
> [TEST] Fix syntax errors, small tweaks
>
> suites/libvirt-cim/cimtest/VirtualSystemManagementService/
> 08_modifyresource.py:
>  - Unecessary virt param
>
> suites/libvirt-cim/cimtest/VirtualSystemManagementService/31_unset_netrasd.py:
>  - Undefined symbols XFAIL, SKIP
>
> suites/libvirt-cim/cimtest/VirtualSystemManagementService/
> 32_modify_cdrom_media.py:
>  - Check for None return when ejecting media
>
> suites/libvirt-cim/main.py
>  - options referenced in except block without being defined
>
> Signed-off-by: Eduardo Lima (Etrunko) <eblima@br.ibm.com>
>
> diff --git a/suites/libvirt-cim/cimtest/
> VirtualSystemManagementService/08_modifyresource.py b/suites/
> libvirt-cim/cimtest/VirtualSystemManagementService/08_modifyresource.py
> --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/
> 08_modifyresource.py
> +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/
> 08_modifyresource.py
> @@ -47,7 +47,7 @@
>  new_int += 1
>  new_mac2 = "11:%s:22:%s:33:%s" % (new_int, new_int, new_int)
>  
> -def cleanup_env(ip, virt, cxml):
> +def cleanup_env(ip, cxml):
>      cxml.destroy(ip)
>      cxml.undefine(ip)
>  
> @@ -82,13 +82,13 @@
>          ret = cxml.cim_define(options.ip)
>          if not ret:
>              logger.error("Failed to define the dom: %s", default_dom)
> -            cleanup_env(options.ip, options.virt, cxml)
> +            cleanup_env(options.ip, cxml)
>              return FAIL
>          if case == "start":
>              ret = cxml.start(options.ip)
>              if not ret:
>                  logger.error("Failed to start the dom: %s", default_dom)
> -                cleanup_env(options.ip, options.virt, cxml)
> +                cleanup_env(options.ip, cxml)
>                  return FAIL
>  
>          status = vsms_util.mod_vcpu_res(options.ip, service, cxml,
> pasd, ncpu,
> diff --git a/suites/libvirt-cim/cimtest/
> VirtualSystemManagementService/31_unset_netrasd.py b/suites/libvirt-
> cim/cimtest/VirtualSystemManagementService/31_unset_netrasd.py
> --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/
> 31_unset_netrasd.py
> +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/
> 31_unset_netrasd.py
> @@ -28,7 +28,7 @@
>  import sys
>  import pywbem
>  
> -from CimTest.ReturnCodes import PASS, FAIL
> +from CimTest.ReturnCodes import PASS, FAIL, XFAIL, SKIP
>  from CimTest.Globals import logger, CIM_USER, CIM_PASS, CIM_NS
>  from XenKvmLib.const import do_main
>  from XenKvmLib.classes import get_typed_class
> diff --git a/suites/libvirt-cim/cimtest/
> VirtualSystemManagementService/32_modify_cdrom_media.py b/suites/
> libvirt-cim/cimtest/VirtualSystemManagementService/32_modify_cdrom_media.py
> --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/
> 32_modify_cdrom_media.py
> +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/
> 32_modify_cdrom_media.py
> @@ -105,8 +105,12 @@
>          return None
>  
>      inst = cim.GetInstance(ret[1]["ResultingResourceSettings"][0])
> +
> +    if not inst:
> +        logger.error("Unable to get CDROM device instance after
> ModifyResourceSettings")
> +        return None
> +
>      new_addr = inst["Address"]
> -
>      if new_addr != addr:
>          logger.error("New media '%s' does not match expected '%s'",
> new_addr, addr)
>          return None
> @@ -204,6 +208,8 @@
>          # Need to eject first?
>          if media and old_media:
>              inst = modify_media(cim, inst, "")
> +            if not inst:
> +                return FAIL
>  
>          media_path = os.path.join(_image_dir, media)
>          inst = modify_media(cim, inst, media_path)
> diff --git a/suites/libvirt-cim/main.py b/suites/libvirt-cim/main.py
> --- a/suites/libvirt-cim/main.py
> +++ b/suites/libvirt-cim/main.py
> @@ -306,8 +306,8 @@
>  
>  if __name__ == '__main__':
>      ret = -1
> +    options, args = parser.parse_args()
>      try:
> -        options, args = parser.parse_args()
>          ret = main(options, args)
>      except (KeyboardInterrupt, SystemExit):
>          print "\nKeyboardInterrupt. Cleaning up..."
>
> _______________________________________________
> Libvirt-cim mailing list
> Libvirt-cim@redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-cim
>