Bug#719738: [PATCH] Please install the lvm2 systemd generator

Peter Rajnoha prajnoha at redhat.com
Fri Aug 23 13:22:18 UTC 2013


On 08/23/2013 01:59 PM, Bastian Blank wrote:
> Second the init-script and the generated unit have different names, so
> systemd won't be able to consider them equal. I have no idea how this
> really works anyway.

The aim of the lvm2-activation-generator is to:

 - do nothing if global/use_lvmetad=1 in lvm.conf
   This is because when using lvmetad, the LVM event-based autoactivation is used
   as well so we don't need any direct call to activate LVM volumes and also
   we don't need any wait for udev to complete - the LVM volumes are activated
   automatically once the VG is complete (it has all the PVs present in the system).

 - generate the systemd units to activate the LVM volumes if global/use_lvmetad=0 in lvm.conf.
   These units (lvm2-activation*.service) then bring in all that's needed - udev wait
   service as well as being called before and after the encrypted volumes are in place
   Though it works only in one layer of course - PV -> VG -> LV -> encrypted -> PV ...,
   so we have lvm2-activation-early.service for the first layer, then decryption and
   then lvm2-activation.service after decrypting - if such layout is chosen by user
   for any reason. If more encrypted layers are needed, then a loop is needed with vgchange
   (but I haven't seen such a request yet).

When using the generator, all the former initscripts (or whatever else was used
before) is not needed and should be removed since the generator will generate the
units to activate the volumes if needed. I don't know what exactly is used in
Debian, but in Fedora the former vgchange -ay call was part of the initscripts
packaged was removed after the introduction of lvm2-activation-generator
(which is part of the lvm2 package). But as I said, I don't know what's
the exact logic used in Debian... so take this as a hint only.

Current movement is to use event-based activation together with lvmetad.

The lvm2-activation-generator is here for the transition as using
lvmetad + event-based activation is configurable in lvm.conf via that use_lvmetad
configuration option. Systemd services can't be run conditionally based on
external configuration. That's what the generator solves - it either
generates the units if needed or not. And those units with direct LVM
activation are not needed if lvmetad is used as that activation is
event-based and done via udev rules (69-dm-lvmetad.rules) and with the
help of lvmetad. It all happens automatically then.

This solution with the generator for lvm2 was discussed directly with
Lennart Poettering from systemd. Similar generator is used for fstab,
for example - which is also an external configuration from systemd point of view.
The fstab generator which generates systemd units on the fly for fstab content.
The same logic applies for lvm2 and its lvm.conf configuration...

Peter



More information about the pkg-lvm-maintainers mailing list