[Kimchi-devel] [PATCH 4/4] Add/remove users and groups to VMs

Crístian Viana vianac at linux.vnet.ibm.com
Fri Feb 28 16:32:17 UTC 2014


Am 27-02-2014 13:09, schrieb Shu Ming:
> How about the result when two request come into Kimchi at the same 
> time to update the users and groups to the same VM?
Yes, there is a race condition here. If multiple users update that 
information at the same time, one update may overwrite the other one.

Race conditions are all around the Kimchi code: if one user creates a VM 
using some template and, at the same time, another user removes that 
template, the VM may be created with an invalid template. That is just 
one of the several scenarios in which we may hit a race condition today.

But we do not have an easy solution for this right now. In order to make 
sure our code is safe from race conditions, we need to use 
synchronization features like locks and mutexes. It will take a lot of 
effort for that to be implemented and tested across the multiple Kimchi 
layers. We also need to make sure that libvirt has some locking commands 
in its API, otherwise, even if we get this right in Kimchi, users from 
other VM managers can invalidate our operations. It would be useless to 
secure our own code from parallel access if someone is able to edit the 
VM XML using, let's say, virsh.

So in summary, I am aware of this problem (well, I wasn't before you 
brought it up here :) ) but I cannot fix it right away. We need to have 
a long discussion on how we will tackle race conditions in Kimchi and 
then we can fix this. In the meantime, we can only hope that 
simultaneous access for the same operations do not happen.




More information about the Kimchi-devel mailing list