<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Am 26-02-2014 17:55, schrieb Rodrigo Trujillo:<br>
<blockquote cite="mid:530E54BF.6040003@linux.vnet.ibm.com"
type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<div class="moz-cite-prefix">However I think you are only seeing
the case where the flow just works, you did not took in account
that<br>
rollbacks are used in case of errors/crashes/fails in the middle
of test.<br>
</div>
</blockquote>
You are right, I did not see the cases when the test fails.<br>
<blockquote cite="mid:530E54BF.6040003@linux.vnet.ibm.com"
type="cite">
<div class="moz-cite-prefix"> 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.<br>
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).<br>
I also tried to split with/rollback, but this does not work.<br>
</div>
</blockquote>
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.<br>
<br>
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.<br>
<br>
The function "_rollback_wrapper" still looks ugly though.<br>
</body>
</html>