From 07ed15bbbd7c0fc2c946620f15f1963882144633 Mon Sep 17 00:00:00 2001
Message-Id: <07ed15bbbd7c0fc2c946620f15f1963882144633.1377873638.git.jdenemar@redhat.com>
From: "Daniel P. Berrange" <berrange@redhat.com>
Date: Tue, 13 Aug 2013 11:36:00 +0100
Subject: [PATCH] Add an example config file for virtlockd
For https://bugzilla.redhat.com/show_bug.cgi?id=991494
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@redhat.com>
(cherry picked from commit 38550ae80978d590a0dccf79108ec96180771fe1)
---
.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/src/Makefile.am b/src/Makefile.am
index 5a7e05a..12ca204 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1586,7 +1586,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
@@ -1634,11 +1634,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:
#
@@ -2013,6 +2022,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 += \
@@ -2020,6 +2035,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.2