On 07/30/2014 09:29 PM, Chun Yan Liu wrote:
> A better idea would be to rely on the volume lease manager -
obtaining a
> lease should be impossible for an image already in use (and should even
> cover the case of copying 'base <- active' onto 'base', which your
> equality test wouldn't catch). I'm not sure why the lease manager is not
> already flagging this issue - are we still using the nop lease manager
> by default, and would the fcntl or sanlock lease manager do a better job?
Besides the default lock is 'nop', currently lock manager is only used in:
VM start/stop and attach/detach disk, blockcopy not using it.
But that's not true - the code IS trying to use it. qemuDomainBlockCopy
calls qemuDomainPrepareDiskChainElement(), which calls
virDomainLockImageAttach(), and that should be the use of the lock
manager. Can you debug why it is not working when using something other
than the 'nop' manager?
To use it in blockcopy, maybe can refer to attach/detach disk: before
doing
blockcopy, try AcquireResource; after blockcopy finish, try releaseResource.
That should be what is already happening.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org