[linux-lvm] [lvmlockd] Refresh lvmlockd leases after sanlock changes

David Teigland teigland at redhat.com
Mon Mar 5 16:59:27 UTC 2018


On Mon, Mar 05, 2018 at 04:37:58PM +0800, Damon Wang wrote:
> to SAN and provide a lun as lvm pv. Each vm gets a thin lv from lvm as root
> volume, and maybe some other thin lvs as data volume. So lvmlockd will
> assurance only one host will change metadata at same time, and lvmthin will
> provide thin provision.

thin lv's from the same thin pool cannot be used from different hosts
concurrently.  It's not because of lvm metadata, it's because of the way
dm-thin manages blocks that are shared between thin lvs.  This block
sharing/unsharing occurs as each read/write happens on the block device,
not on LV activation or any lvm command.

lvmlockd uses locks on the thin pool to enforce the dm-thin limitations.
If you manually remove the locks, you'll get a corrupted thin pool.

> But if want to live migrate the vm, it could be difficult since thin lv can
> only be exclusive active on one host, if you want to active on another
> host, the only way I find is use sanlock to release it manually. If you
> have a better way, please tell me and thanks a loooot !!!

I suggest trying https://ovirt.org

You need to release the lock on the source host after the vm is suspended,
and acquire the lock on the destination host before the vm is resumed.
There are hooks in libvirt to do this.  The LV shouldn't be active on both
hosts at once.  

Dave




More information about the linux-lvm mailing list