On 02/27/2014 12:32 PM, Crístian Viana wrote:
Am 26-02-2014 17:55, schrieb Rodrigo Trujillo:
However I think you are only seeing the case where the flow just works, you did not took in account that
rollbacks are used in case of errors/crashes/fails in the middle of test.
You are right, I did not see the cases when the test fails.
If the code breaks in (4), while starting the vm (receive an exception), how would you remove the vms created above (1)(2) ? I asked myself this.
The option I could think know is to add try/except in the code, but, the with/rollback was implemented exactly for this (or to avoid this).
I also tried to split with/rollback, but this does not work.
One solution would be to remove the VMs by their UUIDs instead of by their names. The UUID is a unique value and it never changes, so the deferred commands would always work, even if the VM name changes.

However the Kimchi function "vm_delete" expects only a name, not a UUID (which, IMO, was not a good design, given that libvirt allows us to lookup VMs by names and UUIDs). So I do not see an easy way to solve this properly without having "vm_delete" to accept something like a domain object instead of its name.


Even using UUID, the rollback problem will still exist.
I don't see any other better solution to it

The function "_rollback_wrapper" still looks ugly though.


_______________________________________________
Kimchi-devel mailing list
Kimchi-devel@ovirt.org
http://lists.ovirt.org/mailman/listinfo/kimchi-devel