Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/Makefile.am | 21 ------
src/interface/Makefile.inc.am | 26 -------
src/interface/meson.build | 9 +++
src/libxl/Makefile.inc.am | 27 -------
src/libxl/meson.build | 10 +++
src/locking/Makefile.inc.am | 19 -----
src/locking/meson.build | 10 +++
src/logging/Makefile.inc.am | 19 -----
src/logging/meson.build | 10 +++
src/lxc/Makefile.inc.am | 23 ------
src/lxc/meson.build | 9 +++
src/meson.build | 67 +++++++++++++++++
src/network/Makefile.inc.am | 25 -------
src/network/meson.build | 9 +++
src/node_device/Makefile.inc.am | 25 -------
src/node_device/meson.build | 9 +++
src/nwfilter/Makefile.inc.am | 25 -------
src/nwfilter/meson.build | 9 +++
src/qemu/Makefile.inc.am | 23 ------
src/qemu/meson.build | 9 +++
src/remote/Makefile.inc.am | 71 -------------------
src/remote/meson.build | 29 ++++++++
...n.target.in => virt-guest-shutdown.target} | 0
src/secret/Makefile.inc.am | 25 -------
src/secret/meson.build | 9 +++
src/storage/Makefile.inc.am | 25 -------
src/storage/meson.build | 9 +++
src/vbox/Makefile.inc.am | 23 ------
src/vbox/meson.build | 9 +++
src/vz/Makefile.inc.am | 23 ------
src/vz/meson.build | 9 +++
31 files changed, 216 insertions(+), 400 deletions(-)
rename src/remote/{virt-guest-shutdown.target.in => virt-guest-shutdown.target}
(100%)
diff --git a/src/Makefile.am b/src/Makefile.am
index 82e7212b186..bd27e5acc29 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -34,8 +34,6 @@ tapset_DATA =
endif WITH_DTRACE_PROBES
RPC_PROBE_FILES =
LOGROTATE_FILES_IN =
-SYSTEMD_UNIT_FILES =
-SYSTEMD_UNIT_FILES_IN =
OPENRC_INIT_FILES =
OPENRC_INIT_FILES_IN =
OPENRC_CONF_FILES =
@@ -275,25 +273,6 @@ endif WITH_LIBVIRTD
if WITH_LIBVIRTD
-if LIBVIRT_INIT_SCRIPT_SYSTEMD
-
-SYSTEMD_UNIT_DIR = $(prefix)/lib/systemd/system
-
-install-systemd: $(SYSTEMD_UNIT_FILES) install-sysconfig
- $(MKDIR_P) $(DESTDIR)$(SYSTEMD_UNIT_DIR)
- for f in $(SYSTEMD_UNIT_FILES); \
- do \
- $(INSTALL_DATA) $$f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/ ; \
- done
-
-uninstall-systemd: uninstall-sysconfig
- rm -f $(SYSTEMD_UNIT_FILES:%=$(DESTDIR)$(SYSTEMD_UNIT_DIR)/%)
- rmdir $(DESTDIR)$(SYSTEMD_UNIT_DIR) || :
-
-INSTALL_DATA_LOCAL += install-systemd
-UNINSTALL_LOCAL += uninstall-systemd
-endif LIBVIRT_INIT_SCRIPT_SYSTEMD
-
if LIBVIRT_INIT_SCRIPT_OPENRC
OPENRC_INIT_DIR = $(sysconfdir)/init.d
diff --git a/src/interface/Makefile.inc.am b/src/interface/Makefile.inc.am
index a189105dcac..b4bcfb7ecaa 100644
--- a/src/interface/Makefile.inc.am
+++ b/src/interface/Makefile.inc.am
@@ -8,16 +8,6 @@ if WITH_INTERFACE
SYSCONF_FILES += interface/virtinterfaced.sysconf
-SYSTEMD_UNIT_FILES += \
- virtinterfaced.service \
- virtinterfaced.socket \
- virtinterfaced-ro.socket \
- virtinterfaced-admin.socket \
- $(NULL)
-SYSTEMD_UNIT_FILES_IN += \
- interface/virtinterfaced.service.in \
- $(NULL)
-
OPENRC_INIT_FILES += \
virtinterfaced.init \
$(NULL)
@@ -25,23 +15,7 @@ OPENRC_INIT_FILES_IN += \
interface/virtinterfaced.init.in \
$(NULL)
-VIRTINTERFACED_UNIT_VARS = \
- $(VIRTD_UNIT_VARS) \
- -e 's|[@]name[@]|Libvirt interface|g' \
- -e 's|[@]service[@]|virtinterfaced|g' \
- -e 's|[@]sockprefix[@]|virtinterfaced|g' \
- $(NULL)
-
virtinterfaced.init: interface/virtinterfaced.init.in \
$(top_builddir)/config.status
$(AM_V_GEN)$(SED) $(LIBVIRTD_INIT_VARS) $< > $@-t && mv $@-t $@
-
-virtinterfaced.service: interface/virtinterfaced.service.in \
- $(top_builddir)/config.status
- $(AM_V_GEN)$(SED) $(VIRTINTERFACED_UNIT_VARS) $< > $@-t && mv $@-t $@
-
-virtinterface%.socket: remote/libvirt%.socket.in \
- $(top_builddir)/config.status
- $(AM_V_GEN)$(SED) $(VIRTINTERFACED_UNIT_VARS) $< > $@-t && mv $@-t $@
-
endif WITH_INTERFACE
diff --git a/src/interface/meson.build b/src/interface/meson.build
index fa9c674c084..a94b1164aa1 100644
--- a/src/interface/meson.build
+++ b/src/interface/meson.build
@@ -39,4 +39,13 @@ if conf.has('WITH_INTERFACE')
'name': 'virtinterfaced',
'name_uc': 'Virtinterfaced',
}
+
+ virt_daemon_units += {
+ 'service': 'virtinterfaced',
+ 'service_in': files('virtinterfaced.service.in'),
+ 'name': 'Libvirt interface',
+ 'sockprefix': 'virtinterfaced',
+ 'sockets': [ 'main', 'ro', 'admin' ],
+ 'conflicts': true,
+ }
endif
diff --git a/src/libxl/Makefile.inc.am b/src/libxl/Makefile.inc.am
index 57271db1be8..b29ae98269c 100644
--- a/src/libxl/Makefile.inc.am
+++ b/src/libxl/Makefile.inc.am
@@ -7,16 +7,6 @@ if WITH_LIBXL
SYSCONF_FILES += libxl/virtxend.sysconf
-SYSTEMD_UNIT_FILES += \
- virtxend.service \
- virtxend.socket \
- virtxend-ro.socket \
- virtxend-admin.socket \
- $(NULL)
-SYSTEMD_UNIT_FILES_IN += \
- libxl/virtxend.service.in \
- $(NULL)
-
OPENRC_INIT_FILES += \
virtxend.init \
$(NULL)
@@ -24,26 +14,9 @@ OPENRC_INIT_FILES_IN += \
libxl/virtxend.init.in \
$(NULL)
-LIBXL_UNIT_COND = ConditionPathExists=/proc/xen/capabilities
-LIBXL_UNIT_CONFLICT = Conflicts=$(LIBVIRTD_SOCKET_UNIT_FILES)
-
-VIRTXEND_UNIT_VARS = \
- $(COMMON_UNIT_VARS) \
- -e 's|[@]deps[@]|$(LIBXL_UNIT_CONFLICT)\n$(LIBXL_UNIT_COND)|g' \
- -e 's|[@]name[@]|Libvirt libxl|g' \
- -e 's|[@]service[@]|virtxend|g' \
- -e 's|[@]sockprefix[@]|virtxend|g' \
- $(NULL)
-
virtxend.init: libxl/virtxend.init.in $(top_builddir)/config.status
$(AM_V_GEN)$(SED) $(LIBVIRTD_INIT_VARS) $< > $@-t && mv $@-t $@
-virtxend.service: libxl/virtxend.service.in $(top_builddir)/config.status
- $(AM_V_GEN)$(SED) $(VIRTXEND_UNIT_VARS) $< > $@-t && mv $@-t $@
-
-virtxen%.socket: remote/libvirt%.socket.in $(top_builddir)/config.status
- $(AM_V_GEN)$(SED) $(VIRTXEND_UNIT_VARS) $< > $@-t && mv $@-t $@
-
INSTALL_DATA_DIRS += libxl
install-data-libxl:
diff --git a/src/libxl/meson.build b/src/libxl/meson.build
index 2fc72d92ac2..4a872198702 100644
--- a/src/libxl/meson.build
+++ b/src/libxl/meson.build
@@ -57,4 +57,14 @@ if conf.has('WITH_LIBXL')
'name': 'virtxend',
'name_uc': 'Virtxend',
}
+
+ virt_daemon_units += {
+ 'service': 'virtxend',
+ 'service_in': files('virtxend.service.in'),
+ 'name': 'Libvirt libxl',
+ 'sockprefix': 'virtxend',
+ 'sockets': [ 'main', 'ro', 'admin' ],
+ 'deps': 'ConditionPathExists=/proc/xen/capabilities',
+ 'conflicts': true,
+ }
endif
diff --git a/src/locking/Makefile.inc.am b/src/locking/Makefile.inc.am
index a2a0a4c6250..8727efdc9a5 100644
--- a/src/locking/Makefile.inc.am
+++ b/src/locking/Makefile.inc.am
@@ -3,15 +3,6 @@
RPC_PROBE_FILES += $(srcdir)/locking/lock_protocol.x
SYSCONF_FILES += locking/virtlockd.sysconf
-VIRTLOCKD_UNIT_FILES_IN = \
- locking/virtlockd.service.in \
- locking/virtlockd.socket.in \
- locking/virtlockd-admin.socket.in \
- $(NULL)
-
-SYSTEMD_UNIT_FILES += $(notdir $(VIRTLOCKD_UNIT_FILES_IN:%.in=%))
-SYSTEMD_UNIT_FILES_IN += $(VIRTLOCKD_UNIT_FILES_IN)
-
OPENRC_INIT_FILES += \
virtlockd.init \
$(NULL)
@@ -46,13 +37,3 @@ endif WITH_LIBVIRTD
virtlockd.init: locking/virtlockd.init.in $(top_builddir)/config.status
$(AM_V_GEN)$(SED) $(COMMON_UNIT_VARS) $< > $@-t && mv $@-t $@
-
-virtlockd.service: locking/virtlockd.service.in $(top_builddir)/config.status
- $(AM_V_GEN)sed $(COMMON_UNIT_VARS) $< > $@-t && mv $@-t $@
-
-virtlockd.socket: locking/virtlockd.socket.in $(top_builddir)/config.status
- $(AM_V_GEN)sed $(COMMON_UNIT_VARS) $< > $@-t && mv $@-t $@
-
-virtlockd-admin.socket: locking/virtlockd-admin.socket.in \
- $(top_builddir)/config.status
- $(AM_V_GEN)sed $(COMMON_UNIT_VARS) $< > $@-t && mv $@-t $@
diff --git a/src/locking/meson.build b/src/locking/meson.build
index 0681e4fbc4d..d35853e799b 100644
--- a/src/locking/meson.build
+++ b/src/locking/meson.build
@@ -134,6 +134,16 @@ if conf.has('WITH_LIBVIRTD')
],
}
+ virt_daemon_units += {
+ 'service': 'virtlockd',
+ 'service_in': files('virtlockd.service.in'),
+ 'name': '',
+ 'sockprefix': '',
+ 'sockets': [ 'main', 'admin' ],
+ 'socket_in': files('virtlockd.socket.in'),
+ 'socket_admin_in': files('virtlockd-admin.socket.in'),
+ }
+
if conf.has('WITH_SANLOCK')
virt_helpers += {
'name': 'libvirt_sanlock_helper',
diff --git a/src/logging/Makefile.inc.am b/src/logging/Makefile.inc.am
index b13f53ffe41..ad07c7b7f77 100644
--- a/src/logging/Makefile.inc.am
+++ b/src/logging/Makefile.inc.am
@@ -2,15 +2,6 @@
SYSCONF_FILES += logging/virtlogd.sysconf
-VIRTLOGD_UNIT_FILES_IN = \
- logging/virtlogd.service.in \
- logging/virtlogd.socket.in \
- logging/virtlogd-admin.socket.in \
- $(NULL)
-
-SYSTEMD_UNIT_FILES += $(notdir $(VIRTLOGD_UNIT_FILES_IN:%.in=%))
-SYSTEMD_UNIT_FILES_IN += $(VIRTLOGD_UNIT_FILES_IN)
-
OPENRC_INIT_FILES += \
virtlogd.init \
$(NULL)
@@ -20,13 +11,3 @@ OPENRC_INIT_FILES_IN += \
virtlogd.init: logging/virtlogd.init.in $(top_builddir)/config.status
$(AM_V_GEN)$(SED) $(COMMON_UNIT_VARS) $< > $@-t && mv $@-t $@
-
-virtlogd.service: logging/virtlogd.service.in $(top_builddir)/config.status
- $(AM_V_GEN)sed $(COMMON_UNIT_VARS) $< > $@-t && mv $@-t $@
-
-virtlogd.socket: logging/virtlogd.socket.in $(top_builddir)/config.status
- $(AM_V_GEN)sed $(COMMON_UNIT_VARS) $< > $@-t && mv $@-t $@
-
-virtlogd-admin.socket: logging/virtlogd-admin.socket.in \
- $(top_builddir)/config.status
- $(AM_V_GEN)sed $(COMMON_UNIT_VARS) $< > $@-t && mv $@-t $@
diff --git a/src/logging/meson.build b/src/logging/meson.build
index 4897cbf1f32..9cfd60019ea 100644
--- a/src/logging/meson.build
+++ b/src/logging/meson.build
@@ -77,4 +77,14 @@ if conf.has('WITH_LIBVIRTD')
'aug': files('test_virtlogd.aug.in'),
'conf': files('virtlogd.conf'),
}
+
+ virt_daemon_units += {
+ 'service': 'virtlogd',
+ 'service_in': files('virtlogd.service.in'),
+ 'name': '',
+ 'sockprefix': '',
+ 'sockets': [ 'main', 'admin' ],
+ 'socket_in': files('virtlogd.socket.in'),
+ 'socket_admin_in': files('virtlogd-admin.socket.in'),
+ }
endif
diff --git a/src/lxc/Makefile.inc.am b/src/lxc/Makefile.inc.am
index 2692163226c..1b3d0a2b4a8 100644
--- a/src/lxc/Makefile.inc.am
+++ b/src/lxc/Makefile.inc.am
@@ -13,16 +13,6 @@ if WITH_LXC
SYSCONF_FILES += lxc/virtlxcd.sysconf
-SYSTEMD_UNIT_FILES += \
- virtlxcd.service \
- virtlxcd.socket \
- virtlxcd-ro.socket \
- virtlxcd-admin.socket \
- $(NULL)
-SYSTEMD_UNIT_FILES_IN += \
- lxc/virtlxcd.service.in \
- $(NULL)
-
OPENRC_INIT_FILES += \
virtlxcd.init \
$(NULL)
@@ -30,22 +20,9 @@ OPENRC_INIT_FILES_IN += \
lxc/virtlxcd.init.in \
$(NULL)
-VIRTLXCD_UNIT_VARS = \
- $(VIRTD_UNIT_VARS) \
- -e 's|[@]name[@]|Libvirt lxc|g' \
- -e 's|[@]service[@]|virtlxcd|g' \
- -e 's|[@]sockprefix[@]|virtlxcd|g' \
- $(NULL)
-
virtlxcd.init: lxc/virtlxcd.init.in $(top_builddir)/config.status
$(AM_V_GEN)$(SED) $(LIBVIRTD_INIT_VARS) $< > $@-t && mv $@-t $@
-virtlxcd.service: lxc/virtlxcd.service.in $(top_builddir)/config.status
- $(AM_V_GEN)$(SED) $(VIRTLXCD_UNIT_VARS) $< > $@-t && mv $@-t $@
-
-virtlxc%.socket: remote/libvirt%.socket.in $(top_builddir)/config.status
- $(AM_V_GEN)$(SED) $(VIRTLXCD_UNIT_VARS) $< > $@-t && mv $@-t $@
-
if WITH_DTRACE_PROBES
RPC_PROBE_FILES += $(srcdir)/lxc/lxc_monitor_protocol.x
endif
diff --git a/src/lxc/meson.build b/src/lxc/meson.build
index 650eaef1d81..c539149a8c9 100644
--- a/src/lxc/meson.build
+++ b/src/lxc/meson.build
@@ -141,4 +141,13 @@ if conf.has('WITH_LXC')
'name': 'virtlxcd',
'name_uc': 'Virtlxcd',
}
+
+ virt_daemon_units += {
+ 'service': 'virtlxcd',
+ 'service_in': files('virtlxcd.service.in'),
+ 'name': 'Libvirt lxc',
+ 'sockprefix': 'virtlxcd',
+ 'sockets': [ 'main', 'ro', 'admin' ],
+ 'conflicts': true,
+ }
endif
diff --git a/src/meson.build b/src/meson.build
index f19870d2c18..b22c950c6d4 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -175,6 +175,22 @@ virt_daemon_confs = []
virt_aug_dir = datadir / 'augeas' / 'lenses'
virt_test_aug_dir = datadir / 'augeas' / 'lenses' / 'tests'
+# guest_unit_files:
+# guest unit files to install
+guest_unit_files = []
+
+# virt_daemon_units:
+# generate libvirt daemon systemd unit files
+# * service - name of the service (required)
+# * service_in - service source file (required)
+# * name - socket description (required)
+# * sockprefix - socket prefix name (required)
+# * sockets - array of additional sockets (optional, default [ 'main',
'ro', 'admin' ])
+# * socket_$name_in - additional socket source files (optional, default
remote/libvirtd.socket.in )
+# * deps - socket dependencies (optional, default '')
+# * conflicts - if the service conflicts with libvirtd (optional, true)
+virt_daemon_units = []
+
# list subdirectories
@@ -652,3 +668,54 @@ foreach data : virt_daemon_confs
install_dir: virt_test_aug_dir,
)
endforeach
+
+
+if conf.has('WITH_LIBVIRTD')
+ # Generate systemd service and socket unit files
+ if init_script == 'systemd'
+ systemd_unit_dir = prefix / 'lib' / 'systemd' / 'system'
+
+ install_data(
+ guest_unit_files,
+ install_dir: systemd_unit_dir,
+ )
+
+ foreach unit : virt_daemon_units
+ unit_conf = configuration_data()
+ unit_conf.set('runstatedir', runstatedir)
+ unit_conf.set('sbindir', sbindir)
+ unit_conf.set('sysconfdir', sysconfdir)
+ unit_conf.set('name', unit['name'])
+ unit_conf.set('service', unit['service'])
+ unit_conf.set('sockprefix', unit['sockprefix'])
+ unit_conf.set('deps', unit.get('deps', ''))
+
+ configure_file(
+ input: unit['service_in'],
+ output: '@0@.service'.format(unit['service']),
+ configuration: unit_conf,
+ install: true,
+ install_dir: systemd_unit_dir,
+ )
+
+ foreach socket : unit.get('sockets', [ 'main', 'ro',
'admin' ])
+ if socket == 'main'
+ socket_in_def = 'remote' / 'libvirtd.socket.in'
+ socket_in = unit.get('socket_in', socket_in_def)
+ socket_out = '@0@.socket'.format(unit['service'])
+ else
+ socket_in_def = 'remote' /
'libvirtd-@0@.socket.in'.format(socket)
+ socket_in = unit.get('socket_@0(a)_in'.format(socket), socket_in_def)
+ socket_out = '@0@-@1@.socket'.format(unit['service'], socket)
+ endif
+ configure_file(
+ input: socket_in,
+ output: socket_out,
+ configuration: unit_conf,
+ install: true,
+ install_dir: systemd_unit_dir,
+ )
+ endforeach
+ endforeach
+ endif
+endif
diff --git a/src/network/Makefile.inc.am b/src/network/Makefile.inc.am
index ee5413e85e1..b84057eeb72 100644
--- a/src/network/Makefile.inc.am
+++ b/src/network/Makefile.inc.am
@@ -7,16 +7,6 @@ STATEFUL_DRIVER_SOURCE_FILES += \
if WITH_NETWORK
SYSCONF_FILES += network/virtnetworkd.sysconf
-SYSTEMD_UNIT_FILES += \
- virtnetworkd.service \
- virtnetworkd.socket \
- virtnetworkd-ro.socket \
- virtnetworkd-admin.socket \
- $(NULL)
-SYSTEMD_UNIT_FILES_IN += \
- network/virtnetworkd.service.in \
- $(NULL)
-
OPENRC_INIT_FILES += \
virtnetworkd.init \
$(NULL)
@@ -24,24 +14,9 @@ OPENRC_INIT_FILES_IN += \
network/virtnetworkd.init.in \
$(NULL)
-VIRTNETWORKD_UNIT_VARS = \
- $(VIRTD_UNIT_VARS) \
- -e 's|[@]name[@]|Libvirt network|g' \
- -e 's|[@]service[@]|virtnetworkd|g' \
- -e 's|[@]sockprefix[@]|virtnetworkd|g' \
- $(NULL)
-
virtnetworkd.init: network/virtnetworkd.init.in $(top_builddir)/config.status
$(AM_V_GEN)$(SED) $(LIBVIRTD_INIT_VARS) $< > $@-t && mv $@-t $@
-virtnetworkd.service: network/virtnetworkd.service.in \
- $(top_builddir)/config.status
- $(AM_V_GEN)$(SED) $(VIRTNETWORKD_UNIT_VARS) $< > $@-t && mv $@-t $@
-
-virtnetwork%.socket: remote/libvirt%.socket.in \
- $(top_builddir)/config.status
- $(AM_V_GEN)$(SED) $(VIRTNETWORKD_UNIT_VARS) $< > $@-t && mv $@-t $@
-
INSTALL_DATA_DIRS += network
UUID=$(shell uuidgen 2>/dev/null)
diff --git a/src/network/meson.build b/src/network/meson.build
index 1e31f8d30cb..0c643900c15 100644
--- a/src/network/meson.build
+++ b/src/network/meson.build
@@ -58,4 +58,13 @@ if conf.has('WITH_NETWORK')
dtrace_gen_objects,
],
}
+
+ virt_daemon_units += {
+ 'service': 'virtnetworkd',
+ 'service_in': files('virtnetworkd.service.in'),
+ 'name': 'Libvirt network',
+ 'sockprefix': 'virtnetworkd',
+ 'sockets': [ 'main', 'ro', 'admin' ],
+ 'conflicts': true,
+ }
endif
diff --git a/src/node_device/Makefile.inc.am b/src/node_device/Makefile.inc.am
index 79491aee577..beff0d6ed04 100644
--- a/src/node_device/Makefile.inc.am
+++ b/src/node_device/Makefile.inc.am
@@ -14,16 +14,6 @@ STATEFUL_DRIVER_SOURCE_FILES += \
if WITH_NODE_DEVICES
SYSCONF_FILES += node_device/virtnodedevd.sysconf
-SYSTEMD_UNIT_FILES += \
- virtnodedevd.service \
- virtnodedevd.socket \
- virtnodedevd-ro.socket \
- virtnodedevd-admin.socket \
- $(NULL)
-SYSTEMD_UNIT_FILES_IN += \
- node_device/virtnodedevd.service.in \
- $(NULL)
-
OPENRC_INIT_FILES += \
virtnodedevd.init \
$(NULL)
@@ -31,22 +21,7 @@ OPENRC_INIT_FILES_IN += \
node_device/virtnodedevd.init.in \
$(NULL)
-VIRTNODEDEVD_UNIT_VARS = \
- $(VIRTD_UNIT_VARS) \
- -e 's|[@]name[@]|Libvirt nodedev|g' \
- -e 's|[@]service[@]|virtnodedevd|g' \
- -e 's|[@]sockprefix[@]|virtnodedevd|g' \
- $(NULL)
-
virtnodedevd.init: node_device/virtnodedevd.init.in \
$(top_builddir)/config.status
$(AM_V_GEN)$(SED) $(LIBVIRTD_INIT_VARS) $< > $@-t && mv $@-t $@
-
-virtnodedevd.service: node_device/virtnodedevd.service.in \
- $(top_builddir)/config.status
- $(AM_V_GEN)$(SED) $(VIRTNODEDEVD_UNIT_VARS) $< > $@-t && mv $@-t $@
-
-virtnodedev%.socket: remote/libvirt%.socket.in \
- $(top_builddir)/config.status
- $(AM_V_GEN)$(SED) $(VIRTNODEDEVD_UNIT_VARS) $< > $@-t && mv $@-t $@
endif WITH_NODE_DEVICES
diff --git a/src/node_device/meson.build b/src/node_device/meson.build
index e81fe281359..875e4ec775f 100644
--- a/src/node_device/meson.build
+++ b/src/node_device/meson.build
@@ -51,4 +51,13 @@ if conf.has('WITH_NODE_DEVICES')
'name': 'virtnodedevd',
'name_uc': 'Virtnodedevd',
}
+
+ virt_daemon_units += {
+ 'service': 'virtnodedevd',
+ 'service_in': files('virtnodedevd.service.in'),
+ 'name': 'Libvirt nodedev',
+ 'sockprefix': 'virtnodedevd',
+ 'sockets': [ 'main', 'ro', 'admin' ],
+ 'conflicts': true,
+ }
endif
diff --git a/src/nwfilter/Makefile.inc.am b/src/nwfilter/Makefile.inc.am
index 2c0d29454bb..2384f053aeb 100644
--- a/src/nwfilter/Makefile.inc.am
+++ b/src/nwfilter/Makefile.inc.am
@@ -13,16 +13,6 @@ nwfilterxml_DATA = $(NWFILTER_XML_FILES)
SYSCONF_FILES += nwfilter/virtnwfilterd.sysconf
-SYSTEMD_UNIT_FILES += \
- virtnwfilterd.service \
- virtnwfilterd.socket \
- virtnwfilterd-ro.socket \
- virtnwfilterd-admin.socket \
- $(NULL)
-SYSTEMD_UNIT_FILES_IN += \
- nwfilter/virtnwfilterd.service.in \
- $(NULL)
-
OPENRC_INIT_FILES += \
virtnwfilterd.init \
$(NULL)
@@ -30,22 +20,7 @@ OPENRC_INIT_FILES_IN += \
nwfilter/virtnwfilterd.init.in \
$(NULL)
-VIRTNWFILTERD_UNIT_VARS = \
- $(VIRTD_UNIT_VARS) \
- -e 's|[@]name[@]|Libvirt nwfilter|g' \
- -e 's|[@]service[@]|virtnwfilterd|g' \
- -e 's|[@]sockprefix[@]|virtnwfilterd|g' \
- $(NULL)
-
virtnwfilterd.init: nwfilter/virtnwfilterd.init.in \
$(top_builddir)/config.status
$(AM_V_GEN)$(SED) $(LIBVIRTD_INIT_VARS) $< > $@-t && mv $@-t $@
-
-virtnwfilterd.service: nwfilter/virtnwfilterd.service.in \
- $(top_builddir)/config.status
- $(AM_V_GEN)$(SED) $(VIRTNWFILTERD_UNIT_VARS) $< > $@-t && mv $@-t $@
-
-virtnwfilter%.socket: remote/libvirt%.socket.in \
- $(top_builddir)/config.status
- $(AM_V_GEN)$(SED) $(VIRTNWFILTERD_UNIT_VARS) $< > $@-t && mv $@-t $@
endif WITH_NWFILTER
diff --git a/src/nwfilter/meson.build b/src/nwfilter/meson.build
index 0c8641735c8..50ee78933e2 100644
--- a/src/nwfilter/meson.build
+++ b/src/nwfilter/meson.build
@@ -46,4 +46,13 @@ if conf.has('WITH_NWFILTER')
'name': 'virtnwfilterd',
'name_uc': 'Virtnwfilterd',
}
+
+ virt_daemon_units += {
+ 'service': 'virtnwfilterd',
+ 'service_in': files('virtnwfilterd.service.in'),
+ 'name': 'Libvirt nwfilter',
+ 'sockprefix': 'virtnwfilterd',
+ 'sockets': [ 'main', 'ro', 'admin' ],
+ 'conflicts': true,
+ }
endif
diff --git a/src/qemu/Makefile.inc.am b/src/qemu/Makefile.inc.am
index 46a7d1e9be2..0ea8905ed57 100644
--- a/src/qemu/Makefile.inc.am
+++ b/src/qemu/Makefile.inc.am
@@ -6,16 +6,6 @@ STATEFUL_DRIVER_SOURCE_FILES += $(addprefix
$(srcdir)/,$(QEMU_DRIVER_SOURCES))
if WITH_QEMU
SYSCONF_FILES += qemu/virtqemud.sysconf
-SYSTEMD_UNIT_FILES += \
- virtqemud.service \
- virtqemud.socket \
- virtqemud-ro.socket \
- virtqemud-admin.socket \
- $(NULL)
-SYSTEMD_UNIT_FILES_IN += \
- qemu/virtqemud.service.in \
- $(NULL)
-
OPENRC_INIT_FILES += \
virtqemud.init \
$(NULL)
@@ -23,22 +13,9 @@ OPENRC_INIT_FILES_IN += \
qemu/virtqemud.init.in \
$(NULL)
-VIRTQEMUD_UNIT_VARS = \
- $(VIRTD_UNIT_VARS) \
- -e 's|[@]name[@]|Libvirt qemu|g' \
- -e 's|[@]service[@]|virtqemud|g' \
- -e 's|[@]sockprefix[@]|virtqemud|g' \
- $(NULL)
-
virtqemud.init: qemu/virtqemud.init.in $(top_builddir)/config.status
$(AM_V_GEN)$(SED) $(LIBVIRTD_INIT_VARS) $< > $@-t && mv $@-t $@
-virtqemud.service: qemu/virtqemud.service.in $(top_builddir)/config.status
- $(AM_V_GEN)$(SED) $(VIRTQEMUD_UNIT_VARS) $< > $@-t && mv $@-t $@
-
-virtqemu%.socket: remote/libvirt%.socket.in $(top_builddir)/config.status
- $(AM_V_GEN)$(SED) $(VIRTQEMUD_UNIT_VARS) $< > $@-t && mv $@-t $@
-
INSTALL_DATA_DIRS += qemu
install-data-qemu:
diff --git a/src/qemu/meson.build b/src/qemu/meson.build
index 35af65cf5f5..479c530ece8 100644
--- a/src/qemu/meson.build
+++ b/src/qemu/meson.build
@@ -138,4 +138,13 @@ if conf.has('WITH_QEMU')
'name': 'virtqemud',
'name_uc': 'Virtqemud',
}
+
+ virt_daemon_units += {
+ 'service': 'virtqemud',
+ 'service_in': files('virtqemud.service.in'),
+ 'name': 'Libvirt qemu',
+ 'sockprefix': 'virtqemud',
+ 'sockets': [ 'main', 'ro', 'admin' ],
+ 'conflicts': true,
+ }
endif
diff --git a/src/remote/Makefile.inc.am b/src/remote/Makefile.inc.am
index dfea32ff21e..159bc5e01be 100644
--- a/src/remote/Makefile.inc.am
+++ b/src/remote/Makefile.inc.am
@@ -12,41 +12,6 @@ SYSCONF_FILES += \
remote/virtproxyd.sysconf \
$(NULL)
-LIBVIRTD_SOCKET_UNIT_FILES_IN = \
- remote/libvirtd.socket.in \
- remote/libvirtd-ro.socket.in \
- remote/libvirtd-admin.socket.in \
- remote/libvirtd-tcp.socket.in \
- remote/libvirtd-tls.socket.in \
- $(NULL)
-
-LIBVIRTD_SOCKET_UNIT_FILES = $(notdir $(LIBVIRTD_SOCKET_UNIT_FILES_IN:%.in=%))
-
-LIBVIRTD_UNIT_FILES_IN = \
- remote/libvirtd.service.in \
- $(LIBVIRTD_SOCKET_UNIT_FILES_IN) \
- $(NULL)
-
-VIRTPROXYD_UNIT_FILES_IN = \
- remote/virtproxyd.service.in \
- $(NULL)
-
-GUEST_UNIT_FILES_IN = \
- remote/virt-guest-shutdown.target.in \
- $(NULL)
-
-
-SYSTEMD_UNIT_FILES += \
- $(notdir $(LIBVIRTD_UNIT_FILES_IN:%.in=%)) \
- $(notdir $(LIBVIRTD_UNIT_FILES_IN:remote/libvirtd%.in=remote/virtproxyd%)) \
- $(notdir $(GUEST_UNIT_FILES_IN:%.in=%)) \
- $(NULL)
-SYSTEMD_UNIT_FILES_IN += \
- $(LIBVIRTD_UNIT_FILES_IN) \
- $(VIRTPROXYD_UNIT_FILES_IN) \
- $(GUEST_UNIT_FILES_IN) \
- $(NULL)
-
OPENRC_INIT_FILES += \
libvirtd.init \
virtproxyd.init \
@@ -136,14 +101,6 @@ INSTALL_DATA_LOCAL += install-sasl
UNINSTALL_LOCAL += uninstall-sasl
endif WITH_SASL
-LIBVIRTD_UNIT_VARS = \
- $(COMMON_UNIT_VARS) \
- -e 's|[@]name[@]|Libvirt|g' \
- -e 's|[@]service[@]|libvirtd|g' \
- -e 's|[@]sockprefix[@]|libvirt|g' \
- -e 's|[@]deps[@]||g' \
- $(NULL)
-
LIBVIRTD_INIT_VARS = \
$(COMMON_UNIT_VARS)
@@ -155,36 +112,8 @@ LIBVIRTD_INIT_VARS += \
-e 's|[@]NEED_FIREWALLD[@]||g'
endif ! WITH_FIREWALLD
-VIRTD_UNIT_VARS = \
- $(COMMON_UNIT_VARS) \
- -e 's|[@]deps[@]|Conflicts=$(LIBVIRTD_SOCKET_UNIT_FILES)|g' \
- $(NULL)
-
-VIRTPROXYD_UNIT_VARS = \
- $(VIRTD_UNIT_VARS) \
- -e 's|[@]name[@]|Libvirt proxy|g' \
- -e 's|[@]service[@]|virtproxyd|g' \
- -e 's|[@]sockprefix[@]|libvirt|g' \
- $(NULL)
-
libvirtd.init: remote/libvirtd.init.in $(top_builddir)/config.status
$(AM_V_GEN)$(SED) $(LIBVIRTD_INIT_VARS) $< > $@-t && mv $@-t $@
virtproxyd.init: remote/virtproxyd.init.in $(top_builddir)/config.status
$(AM_V_GEN)$(SED) $(LIBVIRTD_INIT_VARS) $< > $@-t && mv $@-t $@
-
-libvirtd.service: remote/libvirtd.service.in $(top_builddir)/config.status
- $(AM_V_GEN)$(SED) $(LIBVIRTD_UNIT_VARS) $< > $@-t && mv $@-t $@
-
-libvirt%.socket: remote/libvirt%.socket.in $(top_builddir)/config.status
- $(AM_V_GEN)$(SED) $(LIBVIRTD_UNIT_VARS) $< > $@-t && mv $@-t $@
-
-virtproxyd.service: remote/virtproxyd.service.in $(top_builddir)/config.status
- $(AM_V_GEN)$(SED) $(VIRTPROXYD_UNIT_VARS) $< > $@-t && mv $@-t $@
-
-virtproxy%.socket: remote/libvirt%.socket.in $(top_builddir)/config.status
- $(AM_V_GEN)$(SED) $(VIRTPROXYD_UNIT_VARS) $< > $@-t && mv $@-t $@
-
-virt-guest-shutdown.target: remote/virt-guest-shutdown.target.in \
- $(top_builddir)/config.status
- $(AM_V_GEN)cp $< $@
diff --git a/src/remote/meson.build b/src/remote/meson.build
index 20ccd14b458..c0bc6f14b93 100644
--- a/src/remote/meson.build
+++ b/src/remote/meson.build
@@ -89,6 +89,16 @@ foreach name : libvirt_conf_files
set_variable(name[2].underscorify(), tmp)
endforeach
+libvirtd_socket_unit_files = [
+ 'libvirtd.socket',
+ 'libvirtd-ro.socket',
+ 'libvirtd-admin.socket',
+ 'libvirtd-tcp.socket',
+ 'libvirtd-tls.socket',
+]
+
+libvirtd_socket_conflicts = ' '.join(libvirtd_socket_unit_files)
+
if conf.has('WITH_REMOTE')
remote_driver_lib = static_library(
'virt_remote_driver',
@@ -110,6 +120,8 @@ if conf.has('WITH_REMOTE')
libvirt_libs += remote_driver_lib
if conf.has('WITH_LIBVIRTD')
+ guest_unit_files += files('virt-guest-shutdown.target')
+
virt_daemons += {
'name': 'libvirtd',
'c_args': [
@@ -126,6 +138,14 @@ if conf.has('WITH_REMOTE')
'with_ip': true,
}
+ virt_daemon_units += {
+ 'service': 'libvirtd',
+ 'service_in': files('libvirtd.service.in'),
+ 'name': 'Libvirt',
+ 'sockprefix': 'libvirtd',
+ 'sockets': [ 'main', 'ro', 'admin', 'tcp',
'tls' ],
+ }
+
virt_daemons += {
'name': 'virtproxyd',
'c_args': [
@@ -141,6 +161,15 @@ if conf.has('WITH_REMOTE')
'name_uc': 'Virtproxyd',
'with_ip': true,
}
+
+ virt_daemon_units += {
+ 'service': 'virtproxyd',
+ 'service_in': files('virtproxyd.service.in'),
+ 'name': 'Libvirt proxy',
+ 'sockprefix': 'libvirtd',
+ 'sockets': [ 'main', 'ro', 'admin', 'tcp',
'tls' ],
+ 'deps': libvirtd_socket_conflicts,
+ }
endif
endif
diff --git a/src/remote/virt-guest-shutdown.target.in
b/src/remote/virt-guest-shutdown.target
similarity index 100%
rename from src/remote/virt-guest-shutdown.target.in
rename to src/remote/virt-guest-shutdown.target
diff --git a/src/secret/Makefile.inc.am b/src/secret/Makefile.inc.am
index 648648c260c..3aafe7a6a5d 100644
--- a/src/secret/Makefile.inc.am
+++ b/src/secret/Makefile.inc.am
@@ -7,16 +7,6 @@ STATEFUL_DRIVER_SOURCE_FILES += \
if WITH_SECRETS
SYSCONF_FILES += secret/virtsecretd.sysconf
-SYSTEMD_UNIT_FILES += \
- virtsecretd.service \
- virtsecretd.socket \
- virtsecretd-ro.socket \
- virtsecretd-admin.socket \
- $(NULL)
-SYSTEMD_UNIT_FILES_IN += \
- secret/virtsecretd.service.in \
- $(NULL)
-
OPENRC_INIT_FILES += \
virtsecretd.init \
$(NULL)
@@ -24,22 +14,7 @@ OPENRC_INIT_FILES_IN += \
secret/virtsecretd.init.in \
$(NULL)
-VIRTSECRETD_UNIT_VARS = \
- $(VIRTD_UNIT_VARS) \
- -e 's|[@]name[@]|Libvirt secret|g' \
- -e 's|[@]service[@]|virtsecretd|g' \
- -e 's|[@]sockprefix[@]|virtsecretd|g' \
- $(NULL)
-
virtsecretd.init: secret/virtsecretd.init.in $(top_builddir)/config.status
$(AM_V_GEN)$(SED) $(LIBVIRTD_INIT_VARS) $< > $@-t && mv $@-t $@
-virtsecretd.service: secret/virtsecretd.service.in \
- $(top_builddir)/config.status
- $(AM_V_GEN)$(SED) $(VIRTSECRETD_UNIT_VARS) $< > $@-t && mv $@-t $@
-
-virtsecret%.socket: remote/libvirt%.socket.in \
- $(top_builddir)/config.status
- $(AM_V_GEN)$(SED) $(VIRTSECRETD_UNIT_VARS) $< > $@-t && mv $@-t $@
-
endif WITH_SECRETS
diff --git a/src/secret/meson.build b/src/secret/meson.build
index 7b9e253d4a4..a6b919dfabb 100644
--- a/src/secret/meson.build
+++ b/src/secret/meson.build
@@ -28,4 +28,13 @@ if conf.has('WITH_SECRETS')
'name': 'virtsecretd',
'name_uc': 'Virtsecretd',
}
+
+ virt_daemon_units += {
+ 'service': 'virtsecretd',
+ 'service_in': files('virtsecretd.service.in'),
+ 'name': 'Libvirt secret',
+ 'sockprefix': 'virtsecretd',
+ 'sockets': [ 'main', 'ro', 'admin' ],
+ 'conflicts': true,
+ }
endif
diff --git a/src/storage/Makefile.inc.am b/src/storage/Makefile.inc.am
index 1ac4da02164..3b4a13032aa 100644
--- a/src/storage/Makefile.inc.am
+++ b/src/storage/Makefile.inc.am
@@ -7,16 +7,6 @@ STATEFUL_DRIVER_SOURCE_FILES += \
if WITH_STORAGE
SYSCONF_FILES += storage/virtstoraged.sysconf
-SYSTEMD_UNIT_FILES += \
- virtstoraged.service \
- virtstoraged.socket \
- virtstoraged-ro.socket \
- virtstoraged-admin.socket \
- $(NULL)
-SYSTEMD_UNIT_FILES_IN += \
- storage/virtstoraged.service.in \
- $(NULL)
-
OPENRC_INIT_FILES += \
virtstoraged.init \
$(NULL)
@@ -24,22 +14,7 @@ OPENRC_INIT_FILES_IN += \
storage/virtstoraged.init.in \
$(NULL)
-VIRTSTORAGED_UNIT_VARS = \
- $(VIRTD_UNIT_VARS) \
- -e 's|[@]name[@]|Libvirt storage|g' \
- -e 's|[@]service[@]|virtstoraged|g' \
- -e 's|[@]sockprefix[@]|virtstoraged|g' \
- $(NULL)
-
virtstoraged.init: storage/virtstoraged.init.in $(top_builddir)/config.status
$(AM_V_GEN)$(SED) $(LIBVIRTD_INIT_VARS) $< > $@-t && mv $@-t $@
-virtstoraged.service: storage/virtstoraged.service.in \
- $(top_builddir)/config.status
- $(AM_V_GEN)$(SED) $(VIRTSTORAGED_UNIT_VARS) $< > $@-t && mv $@-t $@
-
-virtstorage%.socket: remote/libvirt%.socket.in \
- $(top_builddir)/config.status
- $(AM_V_GEN)$(SED) $(VIRTSTORAGED_UNIT_VARS) $< > $@-t && mv $@-t $@
-
endif WITH_STORAGE
diff --git a/src/storage/meson.build b/src/storage/meson.build
index b23b5823caa..acc9600ba4b 100644
--- a/src/storage/meson.build
+++ b/src/storage/meson.build
@@ -126,6 +126,15 @@ if conf.has('WITH_STORAGE')
'name': 'virtstoraged',
'name_uc': 'Virtstoraged',
}
+
+ virt_daemon_units += {
+ 'service': 'virtstoraged',
+ 'service_in': files('virtstoraged.service.in'),
+ 'name': 'Libvirt storage',
+ 'sockprefix': 'virtstoraged',
+ 'sockets': [ 'main', 'ro', 'admin' ],
+ 'conflicts': true,
+ }
endif
if conf.has('WITH_STORAGE_DISK')
diff --git a/src/vbox/Makefile.inc.am b/src/vbox/Makefile.inc.am
index 62c7dc98a0c..4968777858c 100644
--- a/src/vbox/Makefile.inc.am
+++ b/src/vbox/Makefile.inc.am
@@ -8,16 +8,6 @@ DRIVER_SOURCE_FILES += \
if WITH_VBOX
SYSCONF_FILES += vbox/virtvboxd.sysconf
-SYSTEMD_UNIT_FILES += \
- virtvboxd.service \
- virtvboxd.socket \
- virtvboxd-ro.socket \
- virtvboxd-admin.socket \
- $(NULL)
-SYSTEMD_UNIT_FILES_IN += \
- vbox/virtvboxd.service.in \
- $(NULL)
-
OPENRC_INIT_FILES += \
virtvboxd.init \
$(NULL)
@@ -25,20 +15,7 @@ OPENRC_INIT_FILES_IN += \
vbox/virtvboxd.init.in \
$(NULL)
-VIRTVBOXD_UNIT_VARS = \
- $(VIRTD_UNIT_VARS) \
- -e 's|[@]name[@]|Libvirt vbox|g' \
- -e 's|[@]service[@]|virtvboxd|g' \
- -e 's|[@]sockprefix[@]|virtvboxd|g' \
- $(NULL)
-
virtvboxd.init: vbox/virtvboxd.init.in $(top_builddir)/config.status
$(AM_V_GEN)$(SED) $(LIBVIRTD_INIT_VARS) $< > $@-t && mv $@-t $@
-virtvboxd.service: vbox/virtvboxd.service.in $(top_builddir)/config.status
- $(AM_V_GEN)$(SED) $(VIRTVBOXD_UNIT_VARS) $< > $@-t && mv $@-t $@
-
-virtvbox%.socket: remote/libvirt%.socket.in $(top_builddir)/config.status
- $(AM_V_GEN)$(SED) $(VIRTVBOXD_UNIT_VARS) $< > $@-t && mv $@-t $@
-
endif WITH_VBOX
diff --git a/src/vbox/meson.build b/src/vbox/meson.build
index 2c28855e420..1fb88513ba0 100644
--- a/src/vbox/meson.build
+++ b/src/vbox/meson.build
@@ -51,4 +51,13 @@ if conf.has('WITH_VBOX')
'name': 'virtvboxd',
'name_uc': 'Virtvboxd',
}
+
+ virt_daemon_units += {
+ 'service': 'virtvboxd',
+ 'service_in': files('virtvboxd.service.in'),
+ 'name': 'Libvirt vbox',
+ 'sockprefix': 'virtvboxd',
+ 'sockets': [ 'main', 'ro', 'admin' ],
+ 'conflicts': true,
+ }
endif
diff --git a/src/vz/Makefile.inc.am b/src/vz/Makefile.inc.am
index ffc684d76de..5889d0170a4 100644
--- a/src/vz/Makefile.inc.am
+++ b/src/vz/Makefile.inc.am
@@ -7,16 +7,6 @@ STATEFUL_DRIVER_SOURCE_FILES += $(addprefix
$(srcdir)/,$(VZ_DRIVER_SOURCES))
if WITH_VZ
SYSCONF_FILES += vz/virtvzd.sysconf
-SYSTEMD_UNIT_FILES += \
- virtvzd.service \
- virtvzd.socket \
- virtvzd-ro.socket \
- virtvzd-admin.socket \
- $(NULL)
-SYSTEMD_UNIT_FILES_IN += \
- vz/virtvzd.service.in \
- $(NULL)
-
OPENRC_INIT_FILES += \
virtvzd.init \
$(NULL)
@@ -24,20 +14,7 @@ OPENRC_INIT_FILES_IN += \
vz/virtvzd.init.in \
$(NULL)
-VIRTVZD_UNIT_VARS = \
- $(VIRTD_UNIT_VARS) \
- -e 's|[@]name[@]|Libvirt vz|g' \
- -e 's|[@]service[@]|virtvzd|g' \
- -e 's|[@]sockprefix[@]|virtvzd|g' \
- $(NULL)
-
virtvzd.init: vz/virtvzd.init.in $(top_builddir)/config.status
$(AM_V_GEN)$(SED) $(LIBVIRTD_INIT_VARS) $< > $@-t && mv $@-t $@
-virtvzd.service: vz/virtvzd.service.in $(top_builddir)/config.status
- $(AM_V_GEN)$(SED) $(VIRTVZD_UNIT_VARS) $< > $@-t && mv $@-t $@
-
-virtvz%.socket: remote/libvirt%.socket.in $(top_builddir)/config.status
- $(AM_V_GEN)$(SED) $(VIRTVZD_UNIT_VARS) $< > $@-t && mv $@-t $@
-
endif WITH_VZ
diff --git a/src/vz/meson.build b/src/vz/meson.build
index ff901179cdd..dcf8f5037fd 100644
--- a/src/vz/meson.build
+++ b/src/vz/meson.build
@@ -43,4 +43,13 @@ if conf.has('WITH_VZ')
'name': 'virtvzd',
'name_uc': 'Virtvzd',
}
+
+ virt_daemon_units += {
+ 'service': 'virtvzd',
+ 'service_in': files('virtvzd.service.in'),
+ 'name': 'Libvirt vz',
+ 'sockprefix': 'virtvzd',
+ 'sockets': [ 'main', 'ro', 'admin' ],
+ 'conflicts': true,
+ }
endif
--
2.26.2