[Libvirt-cim] [PATCH] [TEST] #3 Fix LogicalDisk - 02_nodevs.py

Guo Lian Yun yunguol at cn.ibm.com
Tue Sep 16 03:03:20 UTC 2008


libvirt-cim-bounces at redhat.com wrote on 2008-09-13 05:09:25:

> >  def clean_system(host, virt='Xen'):
> > -    l = live.domain_list(host, virt)
> > -
> > -    if virt == "XenFV" or virt == "Xen":
> > -        if len(l) > 1:
> > -            return False 
> > +    timer_count = 10
> > +    for count in range(0, timer_count):
> > +        keys = ['Name', 'CreationClassName']
> > +        l = enumclass.enumerate(host, 'ComputerSystem', keys, virt)
> > +        if virt == "XenFV" or virt == "Xen":
> > +            if len(l) == 0:
> > +                return True
> > +            sleep(1)
> > +            if count == 9 and len(l) != 0:
> > +                return SKIP
> 
> In all other cases, the function returns a boolean.  So, you won't want 
> to return SKIP here.
> 
> >          else:
> >              return True
> > -    elif len(l) > 0:
> > -        return False
> > -    else:
> > -        return True
> 
> If you remove these lines, then for KVM and LXC, you're always returning 

> True.
> 
> What you have is close - how about something like:
> 
> def clean_system(host, virt='Xen'):
>      timer_count = 10
>      for count in range(0, timer_count):
>          keys = ['Name', 'CreationClassName']
>          l = enumclass.enumerate(host, 'ComputerSystem', keys, virt)
>    if len(l) == 0:
>                  return True
> 
>          if virt == "XenFV" or virt == "Xen":
>              sleep(1)
>          else:
>              break
> 
>      return False
> 
> You only need to poll in the Xen/XenFV case.  Otherwise, you can break 
> from the loop and return a failure.
 
  #4 patch on the way.

  Thanks!
> 
> -- 
> Kaitlin Rupert
> IBM Linux Technology Center
> kaitlin at linux.vnet.ibm.com
> 
> _______________________________________________
> 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/20080916/35dc043f/attachment.htm>


More information about the Libvirt-cim mailing list