First of all I would like to thank the Proxmox team for the great software and the nice community they built.
I'm using a custom hook script (hookscript.pl) to manage VMs on a system with various GPUs passed through.
The first motivation to do so is to avoid a VM (which requires a GPU) being started when another VM is using the same GPU already, because neither Proxmox or qemu or vfio check if the device is already in use and the VM gets started unconditionally (but it doesn't end well).
Without this workaround, the system tries to start the VM but it fails to, while the other VM which was using the GPU loses access to it and I have to restart the latter in order to make recover access.
Up to this point everything in the script works almost fine, I will eventually share it once I'm sure enough it is safe for others to use (please also suggest what would be the correct license).
Anyway, since the system has multiple GPUs of the same type, I tried to enhance the script and make it edit the configuration to do the following:
So the question is: would it be possible to reload the configuration before starting the VM from the hook script? And what would be the correct API to do so?
Thanks in advance
Best regards
P.S. It's worth mentioning that, when Proxmox starts a backup, it will fail due to the reasons described above, hence the motivations for such a script are many.
I'm using a custom hook script (hookscript.pl) to manage VMs on a system with various GPUs passed through.
The first motivation to do so is to avoid a VM (which requires a GPU) being started when another VM is using the same GPU already, because neither Proxmox or qemu or vfio check if the device is already in use and the VM gets started unconditionally (but it doesn't end well).
Without this workaround, the system tries to start the VM but it fails to, while the other VM which was using the GPU loses access to it and I have to restart the latter in order to make recover access.
Up to this point everything in the script works almost fine, I will eventually share it once I'm sure enough it is safe for others to use (please also suggest what would be the correct license).
Anyway, since the system has multiple GPUs of the same type, I tried to enhance the script and make it edit the configuration to do the following:
- Check if the GPU is currently in use,
- If it's not, the VM can be started normally,
- If it's in use, find an alternative GPU which is not being used,
- If there isn't one, abort and exit,
- If there's one, edit the VM's configuration and replace the GPU with the free one,
- Continue and start the VM (hopefully with the new configuration),
So the question is: would it be possible to reload the configuration before starting the VM from the hook script? And what would be the correct API to do so?
Thanks in advance
Best regards
P.S. It's worth mentioning that, when Proxmox starts a backup, it will fail due to the reasons described above, hence the motivations for such a script are many.
Last edited: