[Kimchi-devel] [PATCH V2 6/6] Fix Kimchi vm tests according to new messages sent from backend

Crístian Viana vianac at linux.vnet.ibm.com
Thu Feb 27 20:54:35 UTC 2014


Am 27-02-2014 14:29, schrieb Aline Manera:
> Even using UUID, the rollback problem will still exist.

Using UUID would be enough.

Take a look at the code:

with RollbackContext() as rollback:
     params = {'name': u'test', 'disks': []}
     inst.templates_create(params)
     rollback.prependDefer(inst.template_delete, 'test')

     params = {'name': u'ki-??hi--??', 'template': u'/templates/test'}
     inst.vms_create(params)
*    rollback.prependDefer(self._rollback_wrapper, inst.vm_delete,**
**                          u'ki-??hi--??')*

     inst.vm_start(u'ki-??hi--??')
*    rollback.prependDefer(self._rollback_wrapper, inst.vm_stop,**
**                          u'ki-??hi--??')*

     inst.vm_delete(u'ki-??hi--??')

     vms = inst.vms_get_list()
     self.assertFalse(u'ki-??hi--??' in vms)

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.

By the way, the command "inst.vm_delete(u'ki-??hi--??')" 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/kimchi-devel/attachments/20140227/08d4602e/attachment.html>


More information about the Kimchi-devel mailing list