On Thu, Jun 13, 2024 at 12:27 PM Harald Dunkel <harald.dunkel@xxxxxxxxxx> wrote: > > I missed to mention, drbdadm does know: > > # drbdadm role space > Primary/Secondary > > meaning "space" is primary on this host. You can also look > at /proc/drbd: > > # cat /proc/drbd > version: 8.4.11 (api:1/proto:86-101) > srcversion: 19D914EA50F713FCCE48607 > > 1: cs:Connected ro:Primary/Secondary ds:UpToDate/UpToDate C r----- > ns:4044664 nr:0 dw:4044664 dr:726481 al:188 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0 > 2: cs:Connected ro:Secondary/Primary ds:UpToDate/UpToDate C r----- > ns:0 nr:2228224 dw:2228224 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0 > 3: cs:Connected ro:Primary/Secondary ds:UpToDate/UpToDate C r----- > ns:699492 nr:0 dw:699492 dr:266197 al:75 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0 > > Problem is, it doesn't say "/dev/drbd1". "space" and "1" are > defined in drbd's config files, mapping it to "/dev/drbd1". To > evaluate the condition you have to perform a pretty complex > task. > > Does systemd allow to run a program to evaluate a custom > condition in a unit file? Maybe I am too blind to see, but > I haven't found it mentioned on https://www.freedesktop.org/\ > software/systemd/man/latest/systemd.unit.html. > > The context is: I want to mount/activate /dev/drbd1, if it is > primary. (If it is not, then /dev/drbd1 should be silently > ignored.) Next I want to start the LXC containers provided by > the virtual block device, and setup networking and storage > accordingly. The same should happen for /dev/dbrd{2..n}. > > Maybe this is beyond the scope of systemd. > What you are looking for is the pacemaker.