How to Deny Start-VM when High System Load?

JohnMasinter

New Member
May 24, 2023
3
0
1
When too many users start VMs, the system bogs down due to low memory or over provisioned cpu. Is there a way to set some parameters that will deny a start-vm request, based on system resources? Of it not a built-in feature, can the start-vm action be redirected to a script that I provide? The script would check system utilization, and if too high, return without starting VM, otherwise pass control to real start-vm action. Any advice appreciated.
 
Hi,
I don't think there's any built-in feature for this currently. Well, if the VMs are in a HA-managed cluster, you could use the ha-rebalance-on-start option to select the least busy node to start the VM. If they are not, then yes, you could set a hook script for the VMs, do the check in the pre-start phase and abort if there's not enough resources.
 
I have developed a hook script that does this, and it works great! I'll share this with everyone via github soon.
Question: per past posts, there is no built-in way to automatically apply a hook script to every newly created VM.
Post# 54985 says you may add a hook script to a template, then every VM created from the template will have the hook.
But I need to apply the hook to every new VM created, with or without a template.
Post external says the work-around for my requirement is to run a forever background script to use inotifywait on /etc/pve/qemu-server to detect any new .conf file, and then automatically add the hook script line to the conf file.
I can do that. But these posts are a couple years old. Before I do that, just checking, has this feature been added to Proxmox recently? Can Proxmox auto add a hook to every new VM created?
 
I have developed a hook script that does this, and it works great! I'll share this with everyone via github soon.
Question: per past posts, there is no built-in way to automatically apply a hook script to every newly created VM.
Post# 54985 says you may add a hook script to a template, then every VM created from the template will have the hook.
But I need to apply the hook to every new VM created, with or without a template.
Post external says the work-around for my requirement is to run a forever background script to use inotifywait on /etc/pve/qemu-server to detect any new .conf file, and then automatically add the hook script line to the conf file.
I can do that. But these posts are a couple years old. Before I do that, just checking, has this feature been added to Proxmox recently? Can Proxmox auto add a hook to every new VM created?
No, there is not yet an integrated way to specify default options that will apply to all VM create operations.