diff options
author | Peter Rajnoha <prajnoha@redhat.com> | 2013-10-18 11:07:21 +0200 |
---|---|---|
committer | Peter Rajnoha <prajnoha@redhat.com> | 2013-10-18 11:38:49 +0200 |
commit | 546db1c4be55d47d41082a345e15a35055223154 (patch) | |
tree | e2740a05ec3240e06126ad56b3206d5a396fd13d /scripts | |
parent | 9f406ce252c40a29c06dba4bebe92b570207df93 (diff) | |
download | lvm2-546db1c4be55d47d41082a345e15a35055223154.tar.gz |
udev+systemd: make pvscan --cache -aay run as systemd background job from udev
The new lvm2-pvscan@.service is responsible for on-demand execution
of "pvscan --cache --activate ay" which causes lvmetad to be
updated and LVM activation done if the VG is complete.
Also, use udev-systemd mechanism to instantiate the job as the
lvm2-pvscan@$devnode.service on each newly appeared PV in the system.
This prevents the background job to be killed (that would happen
if it was directly forked from udev rule - this behaviour is seen
in recent versions of udev with the help of systemd that can track
detached processes - the detached process would still be in the same
cgroup).
To enable this official udev-systemd protocol for instantiating
background jobs, use new --enable-udev-systemd-background-jobs
configure switch (it's disabled by default). This option is highly
recommended wherever systemd is used!
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Makefile.in | 2 | ||||
-rw-r--r-- | scripts/lvm2_pvscan_systemd_red_hat@.service.in | 11 |
2 files changed, 13 insertions, 0 deletions
diff --git a/scripts/Makefile.in b/scripts/Makefile.in index a658903ab..fac7e40dd 100644 --- a/scripts/Makefile.in +++ b/scripts/Makefile.in @@ -107,6 +107,7 @@ endif ifeq ("@BUILD_LVMETAD@", "yes") $(INSTALL_DATA) lvm2_lvmetad_systemd_red_hat.socket $(systemd_unit_dir)/lvm2-lvmetad.socket $(INSTALL_DATA) lvm2_lvmetad_systemd_red_hat.service $(systemd_unit_dir)/lvm2-lvmetad.service + $(INSTALL_DATA) lvm2_pvscan_systemd_red_hat@.service $(systemd_unit_dir)/lvm2-pvscan@.service endif install_tmpfiles_configuration: @@ -118,6 +119,7 @@ DISTCLEAN_TARGETS += clvmd_init_red_hat cmirrord_init_red_hat \ dm_event_systemd_red_hat.socket dm_event_systemd_red_hat.service \ lvm2_monitoring_systemd_red_hat.service \ lvm2_lvmetad_systemd_red_hat.socket lvm2_lvmetad_systemd_red_hat.service \ + lvm2_lvmetad_systemd_red_hat@.service \ lvm2_tmpfiles_red_hat.conf blk_availability_init_red_hat \ blk_availability_systemd_red_hat.service \ blkdeactivate.sh diff --git a/scripts/lvm2_pvscan_systemd_red_hat@.service.in b/scripts/lvm2_pvscan_systemd_red_hat@.service.in new file mode 100644 index 000000000..9d91b5ecb --- /dev/null +++ b/scripts/lvm2_pvscan_systemd_red_hat@.service.in @@ -0,0 +1,11 @@ +[Unit] +Description=LVM2 PV scan on %I +Documentation=man:pvscan(8) +DefaultDependencies=no +After=lvm2-lvmetad.socket %i.device +Before=shutdown.target +Conflicts=shutdown.target + +[Service] +Type=simple +ExecStart=@sbindir@/pvscan --cache --activate ay %I |