+1 from me.

libvirt-cim-bounces@redhat.com wrote on 2008-07-02 04:39:25:

> # HG changeset patch
> # User Kaitlin Rupert <karupert@us.ibm.com>
> # Date 1214942997 25200
> # Node ID da0aebe9e441c2a0020fad9d063c489026eee2b2
> # Parent  0c3bd5f782c4776719799ad5c74226c95e70092e
> [TEST] #2 A few migration related fixes.
>
> Fixes:
>  -Remove destroy_and_undefine_domain() call from
> migrate_guest_to_host().  This call takes the domain name as a
> parameter, but migrate_guest_to_host() doesn't take the domain name
> So calling destroy_and_undefine_domain() resulted in an error.
>  -Add a hack to get_typed_class() so it supports Virt_MigrationJob
> (which doesn't fit the typical <virt>_<basename> pattern.
>
> Updates from 1 to 2:
>   -Improve error catching / reporting in start_guest_get_ref()
>
> Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com>
>
> diff -r 0c3bd5f782c4 -r da0aebe9e441 suites/libvirt-
> cim/cimtest/VirtualSystemMigrationService/01_migratable_host.py
> --- a/suites/libvirt-
> cim/cimtest/VirtualSystemMigrationService/01_migratable_host.py  
> Fri Jun 27 09:57:11 2008 +0800
> +++ b/suites/libvirt-
> cim/cimtest/VirtualSystemMigrationService/01_migratable_host.py  
> Tue Jul 01 13:09:57 2008 -0700
> @@ -42,19 +42,26 @@
>  def start_guest_get_ref(ip, guest_name):
>      try:
>          xmlfile = testxml(guest_name)  
> -        define_test_domain(xmlfile, ip)
> +        ret = define_test_domain(xmlfile, ip)
> +        if not ret:
> +            return FAIL, None
>  
> -        start_test_domain(guest_name, ip)
> +        ret = start_test_domain(guest_name, ip)
> +        if not ret:
> +            return FAIL, None
> +
>          time.sleep(10)
>      except Exception:
>          logger.error("Error creating domain %s" % guest_name)
> -        destroy_and_undefine_domain(guest_name, options.ip)
>          return FAIL, None
>  
>      classname = 'Xen_ComputerSystem'
>      cs_ref = CIMInstanceName(classname, keybindings = {
>                                          'Name':guest_name,
>                                          'CreationClassName':classname})
> +
> +    if cs_ref is None:
> +        return FAIL, None
>  
>      return PASS, cs_ref
>  
> @@ -80,6 +87,7 @@
>  
>      status, cs_ref = start_guest_get_ref(options.ip, dom_name)
>      if status != PASS:
> +        destroy_and_undefine_domain(guest_name, options.ip)
>          return FAIL
>  
>      guest_name = cs_ref['Name']
> @@ -90,10 +98,10 @@
>          return FAIL
>  
>      status, ret = migrate_guest_to_host(service, cs_ref, target_ip)
> -
>      if status == FAIL:
>          logger.error("MigrateVirtualSystemToHost: unexpected list length %s"
>                       % len(ret))
> +        destroy_and_undefine_domain(dom_name, options.ip)
>          return status
>      elif len(ret) == 2:
>          id = ret[1]['Job'].keybindings['InstanceID']
> @@ -102,7 +110,7 @@
>                                    guest_name, local_migrate)
>  
>  
> -    destroy_and_undefine_domain(dom_name, options.ip)  
> +    destroy_and_undefine_domain(dom_name, options.ip)
>  
>      return status
>  
> diff -r 0c3bd5f782c4 -r da0aebe9e441 suites/libvirt-
> cim/cimtest/VirtualSystemMigrationService/02_host_migrate_type.py
> --- a/suites/libvirt-
> cim/cimtest/VirtualSystemMigrationService/02_host_migrate_type.py  
> Fri Jun 27 09:57:11 2008 +0800
> +++ b/suites/libvirt-
> cim/cimtest/VirtualSystemMigrationService/02_host_migrate_type.py  
> Tue Jul 01 13:09:57 2008 -0700
> @@ -145,12 +145,11 @@
>  
>          logger.info("Migrating guest with the following options:")
>          logger.info("%s" % item)
> -        status, ret = migrate_guest_to_host(service, cs_ref, target_ip,
> -                                            item)
> -
> +        status, ret = migrate_guest_to_host(service, cs_ref, target_ip, item)
>          if status == FAIL:
>              logger.error("MigrateVirtualSystemToHost: unexpected
> list length %s"
>                           % len(ret))
> +            destroy_and_undefine_domain(dom_name, options.ip)  
>              return status
>          elif len(ret) == 2:
>              id = ret[1]['Job'].keybindings['InstanceID']
> diff -r 0c3bd5f782c4 -r da0aebe9e441 suites/libvirt-
> cim/lib/XenKvmLib/classes.py
> --- a/suites/libvirt-cim/lib/XenKvmLib/classes.py   Fri Jun 27 09:
> 57:11 2008 +0800
> +++ b/suites/libvirt-cim/lib/XenKvmLib/classes.py   Tue Jul 01 13:
> 09:57 2008 -0700
> @@ -23,7 +23,8 @@
>  
>  def get_typed_class(virt, basename):
>      if virt not in virt_types:
> -        raise ValueError('Invalid class type')
> +        if virt != "Virt" and basename != "MigrationJob":
> +            raise ValueError('Invalid class type')
>  
>      if basename == None or basename == '':
>          raise ValueError('Invalide class base name')
> diff -r 0c3bd5f782c4 -r da0aebe9e441 suites/libvirt-
> cim/lib/XenKvmLib/vsmigrations.py
> --- a/suites/libvirt-cim/lib/XenKvmLib/vsmigrations.py   Fri Jun 27
> 09:57:11 2008 +0800
> +++ b/suites/libvirt-cim/lib/XenKvmLib/vsmigrations.py   Tue Jul 01
> 13:09:57 2008 -0700
> @@ -95,10 +95,10 @@
>      except Exception, details:
>          logger.error("Error invoke method 'MigrateVirtualSystemToHost\'.")
>          logger.error("%s", details)
> +        return FAIL, ret
>  
>      if len(ret) == 0:
>          logger.error("MigrateVirtualSystemToHost returns an empty list")
> -        destroy_and_undefine_domain(test_dom, ip)
>          return FAIL, ret
>  
>      return PASS, ret
>
> _______________________________________________
> Libvirt-cim mailing list
> Libvirt-cim@redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-cim