[PATCH v5 11/30] network: add (empty) network.conf file to distribution files

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

 



This file is generated from network.conf.in because it will soon have
an item that must be modified according to meson buildtime config.

Signed-off-by: Laine Stump <laine@xxxxxxxxxx>
Reviewed-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
---
 libvirt.spec.in                          |  3 ++
 src/network/libvirtd_network.aug         | 36 ++++++++++++++++++++++++
 src/network/meson.build                  | 16 +++++++++++
 src/network/network.conf.in              |  3 ++
 src/network/test_libvirtd_network.aug.in |  2 ++
 5 files changed, 60 insertions(+)
 create mode 100644 src/network/libvirtd_network.aug
 create mode 100644 src/network/network.conf.in
 create mode 100644 src/network/test_libvirtd_network.aug.in

diff --git a/libvirt.spec.in b/libvirt.spec.in
index bea3c827bc..0e8dc000f3 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -2120,6 +2120,9 @@ exit 0
 %config(noreplace) %{_sysconfdir}/libvirt/virtnetworkd.conf
 %{_datadir}/augeas/lenses/virtnetworkd.aug
 %{_datadir}/augeas/lenses/tests/test_virtnetworkd.aug
+%config(noreplace) %{_sysconfdir}/libvirt/network.conf
+%{_datadir}/augeas/lenses/libvirtd_network.aug
+%{_datadir}/augeas/lenses/tests/test_libvirtd_network.aug
 %{_unitdir}/virtnetworkd.service
 %{_unitdir}/virtnetworkd.socket
 %{_unitdir}/virtnetworkd-ro.socket
diff --git a/src/network/libvirtd_network.aug b/src/network/libvirtd_network.aug
new file mode 100644
index 0000000000..ae153d96a1
--- /dev/null
+++ b/src/network/libvirtd_network.aug
@@ -0,0 +1,36 @@
+(* /etc/libvirt/network.conf *)
+
+module Libvirtd_network =
+   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 ]
+
+   (* Each entry in the config is one of the following *)
+   let comment = [ label "#comment" . del /#[ \t]*/ "# " .  store /([^ \t\n][^\n]*)?/ . del /\n/ "\n" ]
+   let empty = [ label "#empty" . eol ]
+
+   let record = indent . eol
+
+   let lns = ( record | comment | empty ) *
+
+   let filter = incl "/etc/libvirt/network.conf"
+              . Util.stdexcl
+
+   let xfm = transform lns filter
diff --git a/src/network/meson.build b/src/network/meson.build
index 305e2d52fb..0336435862 100644
--- a/src/network/meson.build
+++ b/src/network/meson.build
@@ -49,6 +49,22 @@ if conf.has('WITH_NETWORK')
     ],
   }
 
+  network_conf = configure_file(
+    input: 'network.conf.in',
+    output: 'network.conf',
+    configuration: configmake_conf,
+  )
+  virt_conf_files += network_conf
+  virt_aug_files += files('libvirtd_network.aug')
+  virt_test_aug_files += {
+    'name': 'test_libvirtd_network.aug',
+    'aug': files('test_libvirtd_network.aug.in'),
+    'conf': network_conf,
+    'test_name': 'libvirtd_network',
+    'test_srcdir': meson.current_source_dir(),
+    'test_builddir': meson.current_build_dir(),
+  }
+
   virt_daemon_confs += {
     'name': 'virtnetworkd',
   }
diff --git a/src/network/network.conf.in b/src/network/network.conf.in
new file mode 100644
index 0000000000..5c84003f6d
--- /dev/null
+++ b/src/network/network.conf.in
@@ -0,0 +1,3 @@
+# Master configuration file for the network driver.
+# All settings described here are optional - if omitted, sensible
+# defaults are used.
diff --git a/src/network/test_libvirtd_network.aug.in b/src/network/test_libvirtd_network.aug.in
new file mode 100644
index 0000000000..ffdca520ce
--- /dev/null
+++ b/src/network/test_libvirtd_network.aug.in
@@ -0,0 +1,2 @@
+module Test_libvirtd_network =
+  @CONFIG@
-- 
2.45.0




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux