From nobody Thu May 15 01:41:30 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1517822142556596.3717444040748; Mon, 5 Feb 2018 01:15:42 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 64FA681DE4; Mon, 5 Feb 2018 09:15:41 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CFAAB608F0; Mon, 5 Feb 2018 09:15:40 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id DA0CD18033D9; Mon, 5 Feb 2018 09:15:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w1598bqE000855 for ; Mon, 5 Feb 2018 04:08:37 -0500 Received: by smtp.corp.redhat.com (Postfix) id 170D118EE3; Mon, 5 Feb 2018 09:08:37 +0000 (UTC) Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 05C2B18EDF for ; Mon, 5 Feb 2018 09:08:33 +0000 (UTC) Received: from prv3-mh.provo.novell.com (victor.provo.novell.com [137.65.250.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6660B76545 for ; Mon, 5 Feb 2018 09:08:25 +0000 (UTC) Received: from localhost.localdomain (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by prv3-mh.provo.novell.com with ESMTP (NOT encrypted); Mon, 05 Feb 2018 02:08:21 -0700 From: river To: libvir-list@redhat.com Date: Mon, 5 Feb 2018 17:07:56 +0800 Message-Id: <1517821676-14399-4-git-send-email-lfu@suse.com> In-Reply-To: <1517821676-14399-1-git-send-email-lfu@suse.com> References: <1517821676-14399-1-git-send-email-lfu@suse.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 05 Feb 2018 09:08:25 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 05 Feb 2018 09:08:25 +0000 (UTC) for IP:'137.65.250.26' DOMAIN:'victor.provo.novell.com' HELO:'prv3-mh.provo.novell.com' FROM:'lfu@suse.com' RCPT:'' X-RedHat-Spam-Score: -2.301 (RCVD_IN_DNSWL_MED, SPF_PASS) 137.65.250.26 victor.provo.novell.com 137.65.250.26 victor.provo.novell.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/3] Add configuration files for dlm plugin X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 05 Feb 2018 09:15:42 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: river --- .gitignore | 2 ++ src/Makefile.am | 40 +++++++++++++++++++++++++++- src/libxl/libxl.conf | 8 +++--- src/locking/dlm.conf | 52 +++++++++++++++++++++++++++++++++= ++++ src/locking/libvirt_dlm.aug | 35 +++++++++++++++++++++++++ src/locking/test_libvirt_dlm.aug.in | 9 +++++++ src/qemu/qemu.conf | 8 +++--- 7 files changed, 146 insertions(+), 8 deletions(-) create mode 100644 src/locking/dlm.conf create mode 100644 src/locking/libvirt_dlm.aug create mode 100644 src/locking/test_libvirt_dlm.aug.in diff --git a/.gitignore b/.gitignore index 189116a3d..d9b0aaec1 100644 --- a/.gitignore +++ b/.gitignore @@ -139,10 +139,12 @@ /src/libvirt_*helper /src/libvirt_*probes.h /src/libvirt_lxc +/src/locking/libxl-dlm.conf /src/locking/libxl-lockd.conf /src/locking/libxl-sanlock.conf /src/locking/lock_daemon_dispatch_stubs.h /src/locking/lock_protocol.[ch] +/src/locking/qemu-dlm.conf /src/locking/qemu-lockd.conf /src/locking/qemu-sanlock.conf /src/locking/test_libvirt_sanlock.aug diff --git a/src/Makefile.am b/src/Makefile.am index 8742921fa..95b46dc89 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2111,6 +2111,19 @@ else ! WITH_LXC check-augeas-lxc: endif ! WITH_LXC =20 +if WITH_DLM +test_libvirt_dlm.aug: locking/test_libvirt_dlm.aug.in \ + locking/qemu-dlm.conf $(AUG_GENTEST) + $(AM_V_GEN)$(AUG_GENTEST) locking/qemu-dlm.conf $< $@ + +check-augeas-dlm: test_libvirt_dlm.aug + $(AM_V_GEN)if test -x '$(AUGPARSE)'; then \ + '$(AUGPARSE)' -I $(srcdir)/locking test_libvirt_dlm.aug; \ + fi +else ! WITH_DLM +check-augeas-dlm: +endif ! WITH_DLM + if WITH_SANLOCK test_libvirt_sanlock.aug: locking/test_libvirt_sanlock.aug.in \ locking/qemu-sanlock.conf $(AUG_GENTEST) @@ -2891,9 +2904,34 @@ dlm_la_LDFLAGS =3D -module -avoid-version $(AM_LDFLA= GS) dlm_la_LIBADD =3D ../gnulib/lib/libgnu.la \ $(CPG_LIBS) \ $(DLM_LIBS) + +augeas_DATA +=3D locking/libvirt_dlm.aug +augeastest_DATA +=3D test_libvirt_dlm.aug +CLEANFILES +=3D test_libvirt_dlm.aug + +locking/%-dlm.conf: $(srcdir)/locking/dlm.conf + $(AM_V_GEN)$(MKDIR_P) locking ; \ + cp $< $@ + +if WITH_QEMU +nodist_conf_DATA +=3D locking/qemu-dlm.conf +BUILT_SOURCES +=3D locking/qemu-dlm.conf +DISTCLEANFILES +=3D locking/qemu-dlm.conf +endif WITH_QEMU + +if WITH_LIBXL +nodist_conf_DATA +=3D locking/libxl-dlm.conf +BUILT_SOURCES +=3D locking/libxl-dlm.conf +DISTCLEANFILES +=3D locking/libxl-dlm.conf +endif WITH_LIBXL + else ! WITH_DLM EXTRA_DIST +=3D $(LOCK_DRIVER_DLM_SOURCES) -endif +endif ! WITH_DLM + +EXTRA_DIST +=3D locking/dlm.conf \ + locking/libvirt_dlm.aug \ + locking/test_libvirt_dlm.aug.in =20 if WITH_SANLOCK lockdriver_LTLIBRARIES +=3D sanlock.la diff --git a/src/libxl/libxl.conf b/src/libxl/libxl.conf index 264af7cf9..85be09b99 100644 --- a/src/libxl/libxl.conf +++ b/src/libxl/libxl.conf @@ -13,11 +13,13 @@ =20 =20 # In order to prevent accidentally starting two domains that -# share one writable disk, libvirt offers two approaches for -# locking files: sanlock and virtlockd. sanlock is an external +# share one writable disk, libvirt offers three approaches for +# locking files: sanlock, virtlockd and dlm. sanlock is an external # project which libvirt integrates with via the libvirt-lock-sanlock # package. virtlockd is a libvirt implementation that is enabled with -# "lockd". Accepted values are "sanlock" and "lockd". +# "lockd", dlm is the linux kernel implementation lock manager that +# is using cluster software by other projects. Accepted values are +# "sanlock", "lockd" and "dlm". # #lock_manager =3D "lockd" =20 diff --git a/src/locking/dlm.conf b/src/locking/dlm.conf new file mode 100644 index 000000000..7cc60f5c2 --- /dev/null +++ b/src/locking/dlm.conf @@ -0,0 +1,52 @@ +# +# The default lockd behaviour is to acquire locks directly +# against each configured disk file / block device. If the +# application wishes to instead manually manage leases in +# the guest XML, then this parameter can be disabled +# +#auto_disk_leases =3D 1 + +# +# Flag to determine whether we allow starting of guests +# which do not have any elements defined in their +# configuration. +# +# If 'auto_disk_leases' is disabled, this setting defaults +# to enabled, otherwise it defaults to disabled. +# +#require_lease_for_disks =3D 0 + +# +# The DLM allows locks to be partitioned into "lockspaces", +# The purpose of lockspaces is to provide a private namespace +# for locks that are part of a single application. Lockspaces +# are identified by name and are cluster-wide. A lockspace +# named "myLS" is the same lockspace on all nodes in the +# cluster and locks will contend for resources the same as +# if they were on the same system. Lockspace names are +# case-sensitive so "MyLS" is a distinct lockspace to "myLS". +# +# More information refers to '3.8. Lockspaces' in +# http://people.redhat.com/ccaulfie/docs/rhdlmbook.pdf +# +#lockspace_name =3D "libvirt" + +# +# One lock must belong to one lockspace, and is associated +# with one lock resource, owned by one process. The lock +# without `LKF_PERSISTENT` would disappear if owner process +# was dead. However, a lock with `LKF_PERSISTENT` flag means +# lock is alive although owner process was dead. However, it +# will become a orphan lock and could't be released. In order +# to adopt those orphan locks we need a file to record the +# lock information. +# +#lock_record_file_path =3D "/tmp/libvirtd-dlm-file" +# + +# +# Flag to determine to whether purge orphan locks which could +# not be adopted or not during the dlm lock plugin +# initialization. +# +#purge_lockspace =3D 1 diff --git a/src/locking/libvirt_dlm.aug b/src/locking/libvirt_dlm.aug new file mode 100644 index 000000000..257e4c421 --- /dev/null +++ b/src/locking/libvirt_dlm.aug @@ -0,0 +1,35 @@ +(* /etc/libvirt/qemu-lockd.conf *) + +module Libvirt_lockd =3D + autoload xfm + + let eol =3D del /[ \t]*\n/ "\n" + let value_sep =3D del /[ \t]*=3D[ \t]*/ " =3D " + let indent =3D del /[ \t]*/ "" + + let str_val =3D del /\"/ "\"" . store /[^\"]*/ . del /\"/ "\"" + let bool_val =3D store /0|1/ + let int_val =3D store /[0-9]+/ + + let str_entry (kw:string) =3D [ key kw . value_sep . str_val ] + let bool_entry (kw:string) =3D [ key kw . value_sep . bool_val ] + let int_entry (kw:string) =3D [ key kw . value_sep . int_val ] + + + (* Each enty in the config is one of the following three ... *) + let entry =3D bool_entry "auto_disk_leases" + | bool_entry "require_lease_for_disks" + | str_entry "lockspace_name" + | str_entry "lock_record_file_path" + | str_entry "purge_lockspace" + let comment =3D [ label "#comment" . del /#[ \t]*/ "# " . store /([^ \= t\n][^\n]*)?/ . del /\n/ "\n" ] + let empty =3D [ label "#empty" . eol ] + + let record =3D indent . entry . eol + + let lns =3D ( record | comment | empty ) * + + let filter =3D incl "/etc/libvirt/qemu-lockd.conf" + . Util.stdexcl + + let xfm =3D transform lns filter diff --git a/src/locking/test_libvirt_dlm.aug.in b/src/locking/test_libvirt= _dlm.aug.in new file mode 100644 index 000000000..ceb8a0324 --- /dev/null +++ b/src/locking/test_libvirt_dlm.aug.in @@ -0,0 +1,9 @@ +module Test_libvirt_dlm =3D + ::CONFIG:: + + test Libvirt_dlm.lns get conf =3D +{ "auto_disk_leases" =3D "1" } +{ "require_lease_for_disks" =3D "0" } +{ "lockspace_name" =3D "libvirt" } +{ "lock_record_file_path" =3D "/tmp/libvirtd-dlm-file" } +{ "purge_lockspace" =3D "1" } diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf index 62c4265ea..bcb6b80bd 100644 --- a/src/qemu/qemu.conf +++ b/src/qemu/qemu.conf @@ -629,10 +629,10 @@ =20 =20 # In order to prevent accidentally starting two domains that -# share one writable disk, libvirt offers two approaches for -# locking files. The first one is sanlock, the other one, -# virtlockd, is then our own implementation. Accepted values -# are "sanlock" and "lockd". +# share one writable disk, libvirt offers three approaches for +# locking files. The first one is sanlock, the second one, +# virtlockd, is then our own implementation, the third one is +# dlm. Accepted values are "sanlock", "lockd" and "dlm". # #lock_manager =3D "lockd" =20 --=20 2.15.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list