1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-27 10:25:13 +03:00
lvm2/udev
Peter Rajnoha 3fee661028 udev+systemd: refine lvm2-pvscan@.service to better track device existence
When using ENV{SYSTEMD_WANTS}=lvm2-pvscan@... to instantiate a service
for lvmetad scan when the new PV appears in the system, the service
is started and executed. However, to track device removal, we need
to bind it (the "BindsTo" systemd directive) to a certain .device
systemd unit.

In default systemd setup, the device is tracked by it's name and
sysfs path (there's normally a sysfs path .device systemd unit for
a device and then the device name .device unit as an alias for it).
Neither of these two is useful for lvmetad update as we need to bind
it to device's <major>:<minor> pair.

The /dev/block/<major>:<minor> is the essential symlink under /dev
that exists for each block device (created by default udev rules
provided by udev directly). So let's use this as an alias for
the device's .device unit as well by means of "ENV{SYSTEMD_ALIAS}"
declaration within udev rules which systemd understands (this will
create a new alias "dev-block-<major>:<minor>.device".

Then we can easily bind the "dev-block-<major>:<minor>" device
systemd unit with instantiated lvm2-pvscan@<major>:<minor>.service.
So once the device is removed from the systemd, the
lvm-pvscan@<major>:<minor>.service executes it's ExecStop action
(which in turn notifies lvmetad about the device being gone).

This completes the udev-systemd-lvmetad interaction then.
2013-10-22 14:22:40 +02:00
..
10-dm.rules.in udev: make subsystem rules responsible for importing subsystem flags 2013-09-30 11:11:18 +02:00
11-dm-lvm.rules.in udev: add support for "NOSCAN" flag 2013-10-08 13:43:14 +02:00
12-dm-permissions.rules add copyright lines 2009-10-26 22:42:07 +00:00
13-dm-disk.rules.in udev: add support for "NOSCAN" flag 2013-10-08 13:43:14 +02:00
69-dm-lvm-metad.rules.in udev+systemd: make pvscan --cache -aay run as systemd background job from udev 2013-10-18 11:38:49 +02:00
95-dm-notify.rules.in udev: udev rules cleanup 2012-06-27 12:11:56 +02:00
Makefile.in udev+systemd: refine lvm2-pvscan@.service to better track device existence 2013-10-22 14:22:40 +02:00