Delaying VM's until ceph/cephFS is mounted

dlasher

Renowned Member
Mar 23, 2011
239
28
93
In larger clusters, it can be quite a few seconds until all the OSD's are happy and cephfs is able to mount. Just restarted one cluster today (power loss) and noticed that while all the KVM's started fine, any LXC that used a CEPHFS bind-mount wouldn't start until cephfs was ready. (got unable to mount messages until it was alive)

Thinking that adding:
Code:
ConditionPathIsReadWrite=/mnt/pve/cephfs
ConditionDirectoryNotEmpty=/mnt/pve/cephfs

to
Code:
lrwxrwxrwx 1 root root 38 Jul 25  2021 pve-guests.service -> /lib/systemd/system/pve-guests.service

should take care of that dependency. Posting in case it helps others, or in case pmx guys have a better suggestion
 
Last edited:
We found that adding an override file to the pvestatd.service is sufficient as it will add the correct dependencies.
pve-guests.service is already waiting for pvestatd.service and with this pvestatd.service will wait for pve-storage.target which includes the Ceph services and remote-fs.target.

Put these two lines into /etc/systemd/system/pvestatd.service.d/override.conf or edit the unit file with systemctl edit pvestatd.service:
Code:
[Unit]
After=pve-storage.target

Your conditions could also be added to pve-guests.service but I really recommend it doing with systemctl edit.
 
Last edited:
We found that adding an override file to the pvestatd.service is sufficient as it will add the correct dependencies.
pve-guests.service is already waiting for pvestatd.service and with this pvestatd.service will wait for pve-storage.target which includes the Ceph services and remote-fs.target.

Put these two lines into /etc/systemd/system/pvestatd.service.d/override.conf or edit the unit file with systemctl edit pvestatd.service:
Code:
[Unit]
After=pve-storage.target

Your conditions could also be added to pve-guests.service but I really recommend it doing with systemctl edit.
Fantastic, thank you - will give it a shot - The option I suggested above seems to work 80% of the time, but leaves at least one node with no started services. :(
 
We found that adding an override file to the pvestatd.service is sufficient as it will add the correct dependencies.
pve-guests.service is already waiting for pvestatd.service and with this pvestatd.service will wait for pve-storage.target which includes the Ceph services and remote-fs.target.

Put these two lines into /etc/systemd/system/pvestatd.service.d/override.conf or edit the unit file with systemctl edit pvestatd.service:
Code:
[Unit]
After=pve-storage.target

Your conditions could also be added to pve-guests.service but I really recommend it doing with systemctl edit.

Not working for me - lxc tries to start immediately, before cephfs is ready and fails.
 
Not working for me - lxc tries to start immediately, before cephfs is ready and fails.

If you know how long it takes for things to always boot (and add 5 more second buffer), you could also just "simply" go to the GUI <datacenter> --> <node> --> System --> Options --> Start on boot delay --> Configure a delay. If you are in a cluster you do have to configure it per-node, but they don't all have to be the system (of one system is quiker then the other, you can set a lower delay)
 
  • Like
Reactions: blackpaw
If you know how long it takes for things to always boot (and add 5 more second buffer), you could also just "simply" go to the GUI <datacenter> --> <node> --> System --> Options --> Start on boot delay --> Configure a delay

Yah, not as neat and tidy but does work, which is what matters. Hopefully, its not something that happens often :)
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!