From: "Daniel P. Berrange" <berrange@xxxxxxxxxx> The virtlockd daemon supports an /etc/libvirt/virtlockd.conf config file, but we never installed a default config, nor created any augeas scripts. This change addresses that omission. Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx> --- .gitignore | 1 + libvirt.spec.in | 3 ++ src/Makefile.am | 20 ++++++++++++- src/locking/test_virtlockd.aug.in | 12 ++++++++ src/locking/virtlockd.aug | 44 ++++++++++++++++++++++++++++ src/locking/virtlockd.conf | 60 +++++++++++++++++++++++++++++++++++++++ 6 files changed, 139 insertions(+), 1 deletion(-) create mode 100644 src/locking/test_virtlockd.aug.in create mode 100644 src/locking/virtlockd.aug create mode 100644 src/locking/virtlockd.conf diff --git a/.gitignore b/.gitignore index 26bd829..e47421a 100644 --- a/.gitignore +++ b/.gitignore @@ -141,6 +141,7 @@ /src/rpc/virkeepaliveprotocol.[ch] /src/rpc/virnetprotocol.[ch] /src/test_libvirt*.aug +/src/test_virtlockd.aug /src/util/virkeymaps.h /src/virt-aa-helper /src/virtlockd diff --git a/libvirt.spec.in b/libvirt.spec.in index a95b783..fba7658 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -1759,6 +1759,7 @@ fi %config(noreplace) %{_sysconfdir}/sysconfig/libvirtd %config(noreplace) %{_sysconfdir}/sysconfig/virtlockd %config(noreplace) %{_sysconfdir}/libvirt/libvirtd.conf +%config(noreplace) %{_sysconfdir}/libvirt/virtlockd.conf %if 0%{?fedora} >= 14 || 0%{?rhel} >= 6 %config(noreplace) %{_prefix}/lib/sysctl.d/libvirtd.conf %endif @@ -1840,6 +1841,8 @@ fi %{_datadir}/augeas/lenses/libvirtd.aug %{_datadir}/augeas/lenses/tests/test_libvirtd.aug +%{_datadir}/augeas/lenses/virtlockd.aug +%{_datadir}/augeas/lenses/tests/test_virtlockd.aug %{_datadir}/augeas/lenses/libvirt_lockd.aug %{_datadir}/augeas/lenses/tests/test_libvirt_lockd.aug diff --git a/src/Makefile.am b/src/Makefile.am index d351539..6c13d80 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1608,7 +1608,7 @@ check-local: check-augeas $(NULL) check-augeas: check-augeas-qemu check-augeas-lxc check-augeas-sanlock \ - check-augeas-lockd + check-augeas-lockd check-augeas-virtlockd AUG_GENTEST = $(PERL) $(top_srcdir)/build-aux/augeas-gentest.pl EXTRA_DIST += $(top_srcdir)/build-aux/augeas-gentest.pl @@ -1656,11 +1656,20 @@ test_libvirt_lockd.aug: locking/test_libvirt_lockd.aug.in \ locking/qemu-lockd.conf $(AUG_GENTEST) $(AM_V_GEN)$(AUG_GENTEST) locking/qemu-lockd.conf $< $@ +test_virtlockd.aug: locking/test_virtlockd.aug.in \ + locking/virtlockd.conf $(AUG_GENTEST) + $(AM_V_GEN)$(AUG_GENTEST) locking/virtlockd.conf $< $@ + check-augeas-lockd: test_libvirt_lockd.aug $(AM_V_GEN)if test -x '$(AUGPARSE)'; then \ '$(AUGPARSE)' -I $(srcdir)/locking test_libvirt_lockd.aug; \ fi +check-augeas-virtlockd: test_virtlockd.aug + $(AM_V_GEN)if test -x '$(AUGPARSE)'; then \ + '$(AUGPARSE)' -I $(srcdir)/locking test_virtlockd.aug; \ + fi + # # Build our version script. This is composed of three parts: # @@ -2035,6 +2044,12 @@ virtlockd.8: $(srcdir)/virtlockd.8.in man8_MANS = virtlockd.8 +conf_DATA += locking/virtlockd.conf + +augeas_DATA += locking/virtlockd.aug +augeastest_DATA += test_virtlockd.aug + +CLEANFILES += test_virtlockd.aug MAINTAINERCLEANFILES += $(srcdir)/virtlockd.8.in EXTRA_DIST += \ @@ -2042,6 +2057,9 @@ EXTRA_DIST += \ locking/virtlockd.socket.in \ locking/virtlockd.pod.in \ virtlockd.8.in \ + locking/virtlockd.aug \ + locking/virtlockd.conf \ + locking/test_virtlockd.aug.in \ $(NULL) diff --git a/src/locking/test_virtlockd.aug.in b/src/locking/test_virtlockd.aug.in new file mode 100644 index 0000000..dcd47c3 --- /dev/null +++ b/src/locking/test_virtlockd.aug.in @@ -0,0 +1,12 @@ +module Test_virtlockd = + let conf = "log_level = 3 +log_filters=\"3:remote 4:event\" +log_outputs=\"3:syslog:libvirtd\" +log_buffer_size = 64 +" + + test Libvirtd.lns get conf = + { "log_level" = "3" } + { "log_filters" = "3:remote 4:event" } + { "log_outputs" = "3:syslog:libvirtd" } + { "log_buffer_size" = "64" } diff --git a/src/locking/virtlockd.aug b/src/locking/virtlockd.aug new file mode 100644 index 0000000..9d20e72 --- /dev/null +++ b/src/locking/virtlockd.aug @@ -0,0 +1,44 @@ +(* /etc/libvirt/libvirtd.conf *) + +module Libvirtd = + autoload xfm + + let eol = del /[ \t]*\n/ "\n" + let value_sep = del /[ \t]*=[ \t]*/ " = " + let indent = del /[ \t]*/ "" + + let array_sep = del /,[ \t\n]*/ ", " + let array_start = del /\[[ \t\n]*/ "[ " + let array_end = del /\]/ "]" + + let str_val = del /\"/ "\"" . store /[^\"]*/ . del /\"/ "\"" + let bool_val = store /0|1/ + let int_val = store /[0-9]+/ + let str_array_element = [ seq "el" . str_val ] . del /[ \t\n]*/ "" + let str_array_val = counter "el" . array_start . ( str_array_element . ( array_sep . str_array_element ) * ) ? . array_end + + let str_entry (kw:string) = [ key kw . value_sep . str_val ] + let bool_entry (kw:string) = [ key kw . value_sep . bool_val ] + let int_entry (kw:string) = [ key kw . value_sep . int_val ] + let str_array_entry (kw:string) = [ key kw . value_sep . str_array_val ] + + + (* Config entry grouped by function - same order as example config *) + let logging_entry = int_entry "log_level" + | str_entry "log_filters" + | str_entry "log_outputs" + | int_entry "log_buffer_size" + + (* Each enty in the config is one of the following three ... *) + let entry = logging_entry + let comment = [ label "#comment" . del /#[ \t]*/ "# " . store /([^ \t\n][^\n]*)?/ . del /\n/ "\n" ] + let empty = [ label "#empty" . eol ] + + let record = indent . entry . eol + + let lns = ( record | comment | empty ) * + + let filter = incl "/etc/libvirt/virtlockd.conf" + . Util.stdexcl + + let xfm = transform lns filter diff --git a/src/locking/virtlockd.conf b/src/locking/virtlockd.conf new file mode 100644 index 0000000..b6450b4 --- /dev/null +++ b/src/locking/virtlockd.conf @@ -0,0 +1,60 @@ +# Master virtlockd daemon configuration file +# + +################################################################# +# +# Logging controls +# + +# Logging level: 4 errors, 3 warnings, 2 information, 1 debug +# basically 1 will log everything possible +#log_level = 3 + +# Logging filters: +# A filter allows to select a different logging level for a given category +# of logs +# The format for a filter is one of: +# x:name +# x:+name +# where name is a string which is matched against source file name, +# e.g., "remote", "qemu", or "util/json", the optional "+" prefix +# tells libvirt to log stack trace for each message matching name, +# and x is the minimal level where matching messages should be logged: +# 1: DEBUG +# 2: INFO +# 3: WARNING +# 4: ERROR +# +# Multiple filter can be defined in a single @filters, they just need to be +# separated by spaces. +# +# e.g. to only get warning or errors from the remote layer and only errors +# from the event layer: +#log_filters="3:remote 4:event" + +# Logging outputs: +# An output is one of the places to save logging information +# The format for an output can be: +# x:stderr +# output goes to stderr +# x:syslog:name +# use syslog for the output and use the given name as the ident +# x:file:file_path +# output to a file, with the given filepath +# In all case the x prefix is the minimal level, acting as a filter +# 1: DEBUG +# 2: INFO +# 3: WARNING +# 4: ERROR +# +# Multiple output can be defined, they just need to be separated by spaces. +# e.g. to log all warnings and errors to syslog under the virtlockd ident: +#log_outputs="3:syslog:virtlockd" +# + +# Log debug buffer size: default 64 +# The daemon keeps an internal debug log buffer which will be dumped in case +# of crash or upon receiving a SIGUSR2 signal. This setting allows to override +# the default buffer size in kilobytes. +# If value is 0 or less the debug log buffer is deactivated +#log_buffer_size = 64 -- 1.8.3.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list