[libvirt] RFC: Introduce a dlm-corosync for Lock manager plugin

Daniel P. Berrange berrange at redhat.com
Wed Dec 20 10:54:55 UTC 2017

On Wed, Dec 20, 2017 at 03:11:48PM +0800, Fu.Lin wrote:
> Hi,
> Currently the lock manager infrastructure has implementation of nop, sanlock
> and lockd. The first do nothing, while sanlock and lockd all requires the
> share
> stroage, and lockd is not provided fence mechanism, sanlock would force to
> restart OS when stopping daemon.
> The first half of 2017, QEMU introduced the `share-rw` and `file.locking` to
> handle a problem: https://bugzilla.redhat.com/show_bug.cgi?id=1080152 ,
> someone
> said:
>     There is also scope for creating new plugins for libvirt to use other
>     mechanism if someone comes up with other ideas.
> So what about dlm-corosync?
> DLM(distributed lock manage) is implemented by kernel, it provides some
> userspace
> API by "libdlm" to lock/unlock resource, using these API need a daemon named
> dlm_controld. "Corosync" is cluster messager layer using TCP or UDP,
> responsible
> for members management in cluster. dlm_controld and corosync are formed a
> kind of
> lock which could be used in cluster. And there is another component named
> "sbd"
> providing fence mechanism, it's not necessary, `dlm_controld -f 0` would
> disable it.

I don't have any direct experiance with DLM - just aware of it as a concept.
I think it can be considered in scope for a libvirt lock manager plugin if
you want to try writnig one.

> As for implement, I think we could make use of virtlockd daemon, just add
> some RPC callback in micro-on.

How are locks acquired by libdlm scoped ?  The reason we have virtlockd is
that the fcntl() locks need to be held by a running process, and we wanted
them to persist across libvirtd restarts. This required holding them in a
separate process.

Are libdlm locks automatically released when the process that acquired
them dies, or is a manual release action required ?  If they always require
a manual release, then there would be no need to use virtlockd - the plugin
can just take care of acquire & release, and still cope with lbivirtd

|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

More information about the libvir-list mailing list