<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 02/27/2014 05:54 PM, Crístian Viana
wrote:<br>
</div>
<blockquote cite="mid:530FA60B.6050802@linux.vnet.ibm.com"
type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
Am 27-02-2014 14:29, schrieb Aline Manera:<br>
<blockquote cite="mid:530F75DC.7030203@linux.vnet.ibm.com"
type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
Even using UUID, the rollback problem will still exist.<br>
</blockquote>
<br>
Using UUID would be enough.<br>
<br>
Take a look at the code:<br>
<br>
<tt>with RollbackContext() as rollback:</tt><tt><br>
</tt><tt> params = {'name': u'test', 'disks': []}</tt><tt><br>
</tt><tt> inst.templates_create(params)</tt><tt><br>
</tt><tt> rollback.prependDefer(inst.template_delete, 'test')</tt><tt><br>
</tt><tt><br>
</tt><tt> params = {'name': u'kīмсhī-∨м', 'template':
u'/templates/test'}</tt><tt><br>
</tt><tt> inst.vms_create(params)</tt><tt><br>
</tt><b><tt> rollback.prependDefer(self._rollback_wrapper,
inst.vm_delete,</tt></b><b><tt><br>
</tt></b><b><tt> u'kīмсhī-∨м')</tt></b><tt><br>
</tt><tt><br>
</tt><tt> inst.vm_start(u'kīмсhī-∨м')</tt><tt><br>
</tt><b><tt> rollback.prependDefer(self._rollback_wrapper,
inst.vm_stop,</tt></b><b><tt><br>
</tt></b><b><tt> u'kīмсhī-∨м')</tt></b><tt><br>
</tt><tt><br>
</tt><tt> inst.vm_delete(u'kīмсhī-∨м')</tt><tt><br>
</tt><tt><br>
</tt><tt> vms = inst.vms_get_list()</tt><tt><br>
</tt><tt> self.assertFalse(u'kīмсhī-∨м' in vms)</tt><br>
<br>
Suppose the two lines defer commands like
"inst.vm_delete_by_uuid(uuid)". Even if something fails, if the
VMs' names change, or if everything executes successfully, they
would stop and delete the VM in the end of the transaction.<br>
</blockquote>
<br>
I agree with you that UUID works ... but I see it solving the
problem when VM is renamed, only.<br>
<br>
<blockquote cite="mid:530FA60B.6050802@linux.vnet.ibm.com"
type="cite"> <br>
By the way, the command "inst.vm_delete(u'kīмсhī-∨м')" will delete
the VM and will obviously lead to an error when the deferred
"vm_delete" is executed, because the VM will not exist anymore.<br>
</blockquote>
<br>
Yeap, this was the root cause of the bug... and would happen using
UUID or 'name'.<br>
I understand that rollback_wrapper function is not so elegant ...
but, in fact, it is just "checking" if the vm exists in order to
does not break rollback, which does not have its behaviour changed
(maybe I named the function wrongly).<br>
<br>
<blockquote cite="mid:530FA60B.6050802@linux.vnet.ibm.com"
type="cite"> <br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Kimchi-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Kimchi-devel@ovirt.org">Kimchi-devel@ovirt.org</a>
<a class="moz-txt-link-freetext" href="http://lists.ovirt.org/mailman/listinfo/kimchi-devel">http://lists.ovirt.org/mailman/listinfo/kimchi-devel</a>
</pre>
</blockquote>
<br>
</body>
</html>