On 08/14/2013 03:50 PM, Alex Bligh wrote: > Assuming the cache quota is not exhausted, how do you know how that > a VM has finished 'creating' the cache? At any point it might > read a bit more from the backing image.
I was assuming on shutdown. > I'm wondering whether you could just use POSIX mandatory locking for > this, i.e. open it exclusive and r/w until the 'finish point', then > reopen RO, which would allow other VMs to share it. Any other VMs > starting before the cache was populated simply fail to get the > exclusive lock and go direct to the backing file. This is a good idea, since it relaxes the requirement for releasing the cache only on shutdown. I am not sure how the 'finish point' can be recognized. Full cache quota is one obvious scenario, but I imagine most VMs do/should not really read till that point (unless they are doing something that should not be cached anyway - e.g. file-system check). Another possibility is registering some sort of event to be executed periodically (e.g. every 30 seconds), and if the cache is not modified in a period, then that is the 'finish point'. I do not know how feasible that is with the facilities that qemu provides. Kaveh