<br><tt><font size=2>libvirt-cim-bounces@redhat.com wrote on 2008-09-13
05:09:25:<br>
<br>
> > def clean_system(host, virt='Xen'):<br>
> > - l = live.domain_list(host, virt)<br>
> > -<br>
> > - if virt == "XenFV" or virt == "Xen":<br>
> > - if len(l) > 1:<br>
> > - return False <br>
> > + timer_count = 10<br>
> > + for count in range(0, timer_count):<br>
> > + keys = ['Name', 'CreationClassName']<br>
> > + l = enumclass.enumerate(host, 'ComputerSystem',
keys, virt)<br>
> > + if virt == "XenFV" or
virt == "Xen":<br>
> > + if len(l) == 0:<br>
> > + return
True<br>
> > + sleep(1)<br>
> > + if count == 9 and
len(l) != 0:<br>
> > + return
SKIP<br>
> <br>
> In all other cases, the function returns a boolean. So, you
won't want <br>
> to return SKIP here.<br>
> <br>
> > else:<br>
> > return True<br>
> > - elif len(l) > 0:<br>
> > - return False<br>
> > - else:<br>
> > - return True<br>
> <br>
> If you remove these lines, then for KVM and LXC, you're always returning
<br>
> True.<br>
> <br>
> What you have is close - how about something like:<br>
> <br>
> def clean_system(host, virt='Xen'):<br>
> timer_count = 10<br>
> for count in range(0, timer_count):<br>
> keys = ['Name', 'CreationClassName']<br>
> l = enumclass.enumerate(host, 'ComputerSystem',
keys, virt)<br>
> if len(l) == 0:<br>
> return
True<br>
> <br>
> if virt == "XenFV" or
virt == "Xen":<br>
> sleep(1)<br>
> else:<br>
> break<br>
> <br>
> return False<br>
> <br>
> You only need to poll in the Xen/XenFV case. Otherwise, you
can break <br>
> from the loop and return a failure.</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> #4 patch on the way.</font></tt>
<br>
<br><tt><font size=2> Thanks!<br>
> <br>
> -- <br>
> Kaitlin Rupert<br>
> IBM Linux Technology Center<br>
> kaitlin@linux.vnet.ibm.com<br>
> <br>
> _______________________________________________<br>
> Libvirt-cim mailing list<br>
> Libvirt-cim@redhat.com<br>
> https://www.redhat.com/mailman/listinfo/libvirt-cim<br>
</font></tt>