March 11, 20197 yr Yes. Parse the output of virsh list and when the VM in question changes to running, run the desired action. Probably need to think through timing and retriggering. There may be other better methods, but it's definitely possible to accomplish what you want, given the tools available right now.
March 12, 20197 yr Author Hi Jonathanm Thanks for the reply, could you give me abit more detail into how to parse the virsh list? Is there an unraidy way? Or just a cron a script ? That checks previous state, etc..
May 19, 20197 yr I had the same question when Googling around today. After reading @jonathanm's response, I investigated and found this: https://libvirt.org/hooks.html which looks promising! I am interested in the possibility of releasing hardware from other processes (i.e. dockers) I want to provide to a VM, but leave available when not in use. I don't have an UnRaid server (contemplating the migration) so I am interested if this works with the current build of the OS. Care to check and report back @DeeR? -JesterEE
August 25, 20214 yr This isn't the most elegant solution but it works for me. I wanted to run a script when my VM started up to switch the scaling_governor from ondemand to performance when my gaming VM was running. I took @JonathanMs suggestion to use virsh list. Then setup a User Script to run every 5 minutes. If all the settings are already right, it does nothing, otherwise it will update the system. You can see the script here: https://github.com/Goobaroo/unraid-setCPUgovernor
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.