Re: "primary" Condition for drbd?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Do, 13.06.24 11:27, 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.

Youre are assuming that people know what drbd is and does, and what
"primary" or "secondary" means in the context. I certainly have no
clue.

> 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.

There's ExecCondition=. But what would you use it for?

ExecCondition= is intended for quick checks.

> 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}.

I have no idea what this all means, but I have the suspicion you
actually want a generator, i.e. a plugin to systemd that adds some
deps depending on external configuration files.

i.e. implement this stuff:

https://www.freedesktop.org/software/systemd/man/latest/systemd.generator.html

Lennart

--
Lennart Poettering, Berlin



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux