[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 7/7] lxc: add augeas support for config file



Ryota Ozaki wrote:  [Tue Oct 06 2009, 12:01:30AM EDT]
>On Mon, Oct 5, 2009 at 9:55 PM, Daniel P. Berrange <berrange redhat com> wrote:
>> It'd be good to add to the check-local:  test here, so the config
>> file parser is tested as part of 'make check'
>
>Oh, the check-local is corrupted.
>
>check-local:
>        test -x '$(AUGPARSE)' \
>          && '$(AUGPARSE)' -I $(srcdir) $(srcdir)/test_libvirtd_qemu.aug || :
>
>We ought to append qemu/ to $(srcdir).
>
>  ozaki-r

I just caught that too. I think this updated patch should fix it. I
changed the rule slightly so it won't fail when there's no $(AUGPARSE)
but it will fail if it doesn't parse correctly. I think that's what
you would want.

Amy

---

 libvirt.spec.in               |   10 ++++++++++
 src/Makefile.am               |   36 ++++++++++++++++++++++++++----------
 src/lxc/libvirtd_lxc.aug      |   30 ++++++++++++++++++++++++++++++
 src/lxc/test_libvirtd_lxc.aug |   31 +++++++++++++++++++++++++++++++
 4 files changed, 97 insertions(+), 10 deletions(-)

diff --git a/libvirt.spec.in b/libvirt.spec.in
index 725ef60..4af1f00 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -539,6 +539,11 @@ rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/tests/test_libvirtd_qemu.aug
  %endif
  %find_lang %{name}
  
+%if ! %{with_lxc}
+rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/libvirtd_lxc.aug
+rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/tests/test_libvirtd_lxc.aug
+endif
+
  %if ! %{with_python}
  rm -rf $RPM_BUILD_ROOT%{_datadir}/doc/libvirt-python-%{version}
  %endif
@@ -674,6 +679,11 @@ fi
  %{_datadir}/augeas/lenses/tests/test_libvirtd_qemu.aug
  %endif
  
+%if %{with_lxc}
+%{_datadir}/augeas/lenses/libvirtd_lxc.aug
+%{_datadir}/augeas/lenses/tests/test_libvirtd_lxc.aug
+%endif
+
  %{_datadir}/augeas/lenses/libvirtd.aug
  %{_datadir}/augeas/lenses/tests/test_libvirtd.aug
  
diff --git a/src/Makefile.am b/src/Makefile.am
index 73bbb70..689b947 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -35,6 +35,12 @@ mod_LTLIBRARIES =
  confdir = $(sysconfdir)/libvirt
  conf_DATA =
  
+augeasdir = $(datadir)/augeas/lenses
+augeas_DATA =
+
+augeastestdir = $(datadir)/augeas/lenses/tests
+augeastest_DATA =
+
  # These files are not related to driver APIs. Simply generic
  # helper APIs for various purposes
  UTIL_SOURCES =							\
@@ -429,15 +435,8 @@ libvirt_driver_qemu_la_SOURCES = $(QEMU_DRIVER_SOURCES)
  
  conf_DATA += qemu/qemu.conf
  
-augeasdir = $(datadir)/augeas/lenses
-augeas_DATA = qemu/libvirtd_qemu.aug
-
-augeastestdir = $(datadir)/augeas/lenses/tests
-augeastest_DATA = qemu/test_libvirtd_qemu.aug
-
-check-local:
-	test -x '$(AUGPARSE)' \
-	  && '$(AUGPARSE)' -I $(srcdir) $(srcdir)/test_libvirtd_qemu.aug || :
+augeas_DATA += qemu/libvirtd_qemu.aug
+augeastest_DATA += qemu/test_libvirtd_qemu.aug
  
  endif
  EXTRA_DIST += qemu/qemu.conf qemu/libvirtd_qemu.aug qemu/test_libvirtd_qemu.aug
@@ -460,8 +459,11 @@ libvirt_driver_lxc_la_SOURCES = $(LXC_DRIVER_SOURCES)
  
  conf_DATA += lxc/lxc.conf
  
+augeas_DATA += lxc/libvirtd_lxc.aug
+augeastest_DATA += lxc/test_libvirtd_lxc.aug
+
  endif
-EXTRA_DIST += lxc/lxc.conf
+EXTRA_DIST += lxc/lxc.conf lxc/libvirtd_lxc.aug lxc/test_libvirtd_lxc.aug
  
  if WITH_UML
  if WITH_DRIVER_MODULES
@@ -679,6 +681,20 @@ EXTRA_DIST +=							\
  		$(SECRET_DRIVER_SOURCES)			\
  		$(VBOX_DRIVER_EXTRA_DIST)
  
+check-local:
+if WITH_QEMU
+	if test -x '$(AUGPARSE)'; then \
+	    '$(AUGPARSE)' -I $(srcdir)/qemu \
+	    $(srcdir)/qemu/test_libvirtd_qemu.aug; \
+	fi
+endif
+if WITH_LXC
+	if test -x '$(AUGPARSE)'; then \
+	    '$(AUGPARSE)' -I $(srcdir)/lxc \
+	    $(srcdir)/lxc/test_libvirtd_lxc.aug; \
+	fi
+endif
+
  #
  # Build our version script.  This is composed of three parts:
  #
diff --git a/src/lxc/libvirtd_lxc.aug b/src/lxc/libvirtd_lxc.aug
new file mode 100644
index 0000000..10f25e4
--- /dev/null
+++ b/src/lxc/libvirtd_lxc.aug
@@ -0,0 +1,30 @@
+(* /etc/libvirt/lxc.conf *)
+
+module Libvirtd_lxc =
+   autoload xfm
+
+   let eol   = del /[ \t]*\n/ "\n"
+   let value_sep   = del /[ \t]*=[ \t]*/  " = "
+   let indent = del /[ \t]*/ ""
+
+   let bool_val = store /0|1/
+
+   let bool_entry      (kw:string) = [ key kw . value_sep . bool_val ]
+
+
+   (* Config entry grouped by function - same order as example config *)
+   let log_entry = bool_entry "log_with_libvirtd"
+
+   (* Each enty in the config is one of the following three ... *)
+   let entry = log_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/lxc.conf"
+              . Util.stdexcl
+
+   let xfm = transform lns filter
diff --git a/src/lxc/test_libvirtd_lxc.aug b/src/lxc/test_libvirtd_lxc.aug
new file mode 100644
index 0000000..e757b82
--- /dev/null
+++ b/src/lxc/test_libvirtd_lxc.aug
@@ -0,0 +1,31 @@
+module Test_libvirtd_lxc =
+
+   let conf = "# Master configuration file for the LXC driver.
+# All settings described here are optional - if omitted, sensible
+# defaults are used.
+
+# By default, log messages generated by the lxc controller go to the
+# container logfile. It is also possible to accumulate log messages
+# from all lxc controllers along with libvirtd's log outputs. In this
+# case, the lxc controller will honor either LIBVIRT_LOG_OUTPUTS or
+# log_outputs from libvirtd.conf.
+#
+# This is disabled by default, uncomment below to enable it.
+#
+log_with_libvirtd = 1
+"
+
+   test Libvirtd_lxc.lns get conf =
+{ "#comment" = "Master configuration file for the LXC driver." }
+{ "#comment" = "All settings described here are optional - if omitted, sensible" }
+{ "#comment" = "defaults are used." }
+{ "#empty" }
+{ "#comment" = "By default, log messages generated by the lxc controller go to the" }
+{ "#comment" = "container logfile. It is also possible to accumulate log messages" }
+{ "#comment" = "from all lxc controllers along with libvirtd's log outputs. In this" }
+{ "#comment" = "case, the lxc controller will honor either LIBVIRT_LOG_OUTPUTS or" }
+{ "#comment" = "log_outputs from libvirtd.conf." }
+{ "#comment" = "" }
+{ "#comment" = "This is disabled by default, uncomment below to enable it." }
+{ "#comment" = "" }
+{ "log_with_libvirtd" = "1" }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]