how to delay pve startup until external iscsi service is ready?

m.ardito

Famous Member
Feb 17, 2010
1,473
18
103
Torino, Italy
hi,
i wonder if there is a way to tell pve servers to wait for iscsi vmdisks device to be ready. why?

our iscsi device (qnap ts809u) has a few services to start, and it may take a few minutes before iscsi target is available, so when ups power is on, both iscsi device and pve servers start up, but pve servers are faster than the iscsi target, particularly if the iscsi device, where vm disks are, has some checks to do, etc. so the first vms in pve could try to start and fail due to some timeout.
usually i can later restart the vm that failed booting, when iscsi is up and running and everything is fine, but how to prevent this behaviour?

i can extimate that - for sure - after 10 minutes the iscsi device will be fully ready to serve vm disks, and it would be fine to let pve servers wait that amount of time before starting vms, any suggestion?

i can't use the 2.x startup delay feature, i think, because that value of a vm specifies how much time should pass before _other_ vms will start - after - that particular one, and i can setup a starting order but the first will try to start immediately, afaik. i could setup a "fake" vm with local disks, which does just nothing but have a "following vms" delay... but i don't like this, and 'itsa waste of resources...

probably a general "vms launch delay" would be the ideal solution, but who knows, maybe there's another way?

Thanks, Marco
 
look at the command
pvesh --nooutput create /nodes/localhost/startall
inside
/etc/init.d/pve-manager
files.
Maybe u can add a wait to the command with a loop to check if device is available..
 
Many init scripts have settings that are loaded from /etc/default/
Adding some loops/sleep code to the default file is a perfect way to fix such issues.

For example, NTP server does not startup correctly if the network is not up when NTP init script runs.
My bonded interfaces were too slow to come up and NTP never started right, to fix this I made NTP wait 3 seconds, now it starts perfectly every time.

I edited /etc/default/ntp:
Code:
[B]sleep 3[/B]
NTPD_OPTS='-g'