[libvirt] [PATCH 09/29] remote: conditionalize IP socket config in augeas definitions

Michal Privoznik mprivozn at redhat.com
Fri Jul 12 13:37:14 UTC 2019


On 7/11/19 6:04 PM, Daniel P. Berrangé wrote:
> Prepare for reusing libvirtd augeas defintions with other daemons by
> making the config parameters for IP sockets conditionally defined by
> the make rules.
> 
> Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
> ---
>   build-aux/augeas-gentest.pl                  |  2 +-
>   src/remote/Makefile.inc.am                   | 27 +++++++++++++++-----
>   src/remote/{libvirtd.aug => libvirtd.aug.in} | 24 ++++++++++++-----
>   src/remote/test_libvirtd.aug.in              | 14 +++++++---
>   4 files changed, 49 insertions(+), 18 deletions(-)
>   rename src/remote/{libvirtd.aug => libvirtd.aug.in} (88%)
> 
> diff --git a/build-aux/augeas-gentest.pl b/build-aux/augeas-gentest.pl
> index 567fc651f3..69d94e6a0f 100755
> --- a/build-aux/augeas-gentest.pl
> +++ b/build-aux/augeas-gentest.pl
> @@ -37,7 +37,7 @@ open TEMPLATE, "<", $template or die "cannot read $template: $!";
>   
>   my $group = 0;
>   while (<TEMPLATE>) {
> -    if (/::CONFIG::/) {
> +    if (/::\s*CONFIG\s*::/) {
>           my $group = 0;
>           print AUGTEST "  let conf = \"";
>           while (<CONFIG>) {
> diff --git a/src/remote/Makefile.inc.am b/src/remote/Makefile.inc.am
> index 4bc71346f2..7732fa744c 100644
> --- a/src/remote/Makefile.inc.am
> +++ b/src/remote/Makefile.inc.am
> @@ -124,11 +124,11 @@ sbin_PROGRAMS += libvirtd
>   
>   augeas_DATA += remote/libvirtd.aug

In order to generate this, we need to distribute libvirtd.aug.in:

--- i/src/remote/Makefile.inc.am
+++ w/src/remote/Makefile.inc.am
@@ -70,7 +70,7 @@ EXTRA_DIST += \
        $(REMOTE_DRIVER_SOURCES) \
        $(LIBVIRTD_SOURCES) \
        remote/test_libvirtd.aug.in \
-       remote/libvirtd.aug \
+       remote/libvirtd.aug.in \
        remote/libvirtd.conf.in \
        remote/libvirtd.policy \
        remote/libvirtd.rules \

>   
> -augeastest_DATA += test_libvirtd.aug
> +augeastest_DATA += remote/test_libvirtd.aug
>   
>   conf_DATA += remote/libvirtd.conf
>   
> -CLEANFILES += test_libvirtd.aug
> +CLEANFILES += remote/libvirtd.aug remote/test_libvirtd.aug
>   
>   man8_MANS += libvirtd.8
>   
> @@ -198,13 +198,28 @@ uninstall-data-remote:
>   
>   AUGEAS_DIRS += remote
>   
> -test_libvirtd.aug: remote/test_libvirtd.aug.in \
> +remote/libvirtd.aug: remote/libvirtd.aug.in
> +	$(AM_V_GEN)$(SED) \
> +		-e '/:: CUT ENABLE_IP ::/d' \
> +		-e '/:: END ::/d' \
> +		-e 's/:: DAEMON_NAME ::/libvirtd/' \
> +		-e 's/:: DAEMON_NAME_UC ::/Libvirtd/' \
> +		$< > $@
> +
> +remote/test_libvirtd.aug.tmp: remote/test_libvirtd.aug.in \
>   		remote/libvirtd.conf $(AUG_GENTEST)
> -	$(AM_V_GEN)$(AUG_GENTEST) $(srcdir)/remote/libvirtd.conf $< $@
> +	$(AM_V_GEN)$(AUG_GENTEST) remote/libvirtd.conf remote/test_libvirtd.aug.in $@
> +
> +remote/test_libvirtd.aug: remote/test_libvirtd.aug.tmp
> +	$(AM_V_GEN)$(SED) -e '/:: CUT ENABLE_IP ::/d' \
> +		-e '/:: END ::/d' \
> +		-e 's/:: DAEMON_NAME ::/libvirtd/' \
> +		-e 's/:: DAEMON_NAME_UC ::/Libvirtd/' \
> +		< $^ > $@ || rm -f $@
>   
> -check-augeas-remote: test_libvirtd.aug
> +check-augeas-remote: remote/test_libvirtd.aug
>   	$(AM_V_GEN)if test -x '$(AUGPARSE)'; then \
> -	    '$(AUGPARSE)' -I $(srcdir)/remote test_libvirtd.aug; \
> +	    '$(AUGPARSE)' -I $(srcdir)/remote remote/test_libvirtd.aug; \
>   	fi
>   
>   if WITH_SYSCTL
> diff --git a/src/remote/libvirtd.aug b/src/remote/libvirtd.aug.in
> similarity index 88%
> rename from src/remote/libvirtd.aug
> rename to src/remote/libvirtd.aug.in
> index 0188c23dd7..54a45e438a 100644
> --- a/src/remote/libvirtd.aug
> +++ b/src/remote/libvirtd.aug.in
> @@ -1,6 +1,6 @@
> -(* /etc/libvirt/libvirtd.conf *)
> +(* /etc/libvirt/:: DAEMON_NAME ::.conf *)
>   
> -module Libvirtd =
> +module :: DAEMON_NAME_UC :: =
>      autoload xfm
>   
>      let eol   = del /[ \t]*\n/ "\n"
> @@ -24,11 +24,13 @@ module Libvirtd =
>   
>   
>      (* Config entry grouped by function - same order as example config *)
> +:: CUT ENABLE_IP ::
>      let network_entry = bool_entry "listen_tls"
>                        | bool_entry "listen_tcp"
>                        | str_entry "tls_port"
>                        | str_entry "tcp_port"
>                        | str_entry "listen_addr"
> +:: END::

s/END::/END ::/

>   
>      let sock_acl_entry = str_entry "unix_sock_group"
>                         | str_entry "unix_sock_ro_perms"
> @@ -38,6 +40,7 @@ module Libvirtd =
>   
>      let authentication_entry = str_entry "auth_unix_ro"
>                               | str_entry "auth_unix_rw"
> +:: CUT ENABLE_IP ::
>                               | str_entry "auth_tcp"
>                               | str_entry "auth_tls"
>   
> @@ -46,12 +49,16 @@ module Libvirtd =
>                            | str_entry "ca_file"
>                            | str_entry "crl_file"
>   
> -   let authorization_entry = bool_entry "tls_no_verify_certificate"
> +   let tls_authorization_entry = bool_entry "tls_no_verify_certificate"
>                              | bool_entry "tls_no_sanity_certificate"
>                              | str_array_entry "tls_allowed_dn_list"
>                              | str_array_entry "sasl_allowed_username_list"
>                              | str_array_entry "access_drivers"
>                              | str_entry "tls_priority"
> +:: END ::
> +
> +   let misc_authorization_entry = str_array_entry "sasl_allowed_username_list"
> +                           | str_array_entry "access_drivers"

You need to remove these two variables from tls_authorization_entry then:

@@ -52,8 +52,6 @@ module :: DAEMON_NAME_UC :: =
    let tls_authorization_entry = bool_entry "tls_no_verify_certificate"
                            | bool_entry "tls_no_sanity_certificate"
                            | str_array_entry "tls_allowed_dn_list"
-                           | str_array_entry "sasl_allowed_username_list"
-                           | str_array_entry "access_drivers"
                            | str_entry "tls_priority"
 :: END ::


>   
>      let processing_entry = int_entry "min_workers"
>                           | int_entry "max_workers"


Surprisingly, 'distcheck' fails for me after this because augeas-gentest.pl is unable to find libvirtd.conf. What is surprising is that you're not touching libvirtd.conf in this patch but the previous one and distcheck just works there.

Michal




More information about the libvir-list mailing list