Hi,
I'm starting to build units workflow/dependencies to handle static volumes for my services so it might not be the perfect practice, but here is my problem :
I created a path unit to detect the presence of a volume.
[Unit]
Description=Presence of Repl 3 LVM
DefaultDependencies=false
[Path]
PathExists=/dev/mapper/vol_rs_repl3-rs_repl3
Unit=data-mongodb-repl3.mount
[Install]
WantedBy=data-mongodb-repl3.mount
[X-Fleet]
Global=true
I created a mount unit to mount the volume
[Unit]
Description=Mount third bo replica volume
After=data-mongodb-repl3.path
Requires=data-mongodb-repl3.path
[Mount]
What=/dev/mapper/vol_rs_repl3-rs_repl3
Where=/data/mongodb/repl3
Type=xfs
Options=rw,relatime,attr2,inode64,noquota
DirectoryMode=0755
It's working well with "[X-Fleet] Global=true", the volume is mounted on the nodes wich have one.
As expected, I can see this failed units on the nodes without volume, it's not a big problem :
data-mongodb-repl3.path active waiting
data-mongodb-repl3.mount inactive dead
I tried to use MachineOf=data-mongodb-repl3.path on the mount unit (doc : "MachineOf Limit eligible machines to the one that hosts a specific unit") in order to deploy the mount unit only on the nodes with running path unit and to limit the number of failed units.
But it does not work, the unit is deployed randomly on one node of the cluster (and only one node), without considering the unit state/presence in MachineOf .
What do I miss about this parameter ?
Arthur