I
I
Ilya2015-05-09 02:05:48
KVM
Ilya, 2015-05-09 02:05:48

How to run a script in libvirt when starting/stopping a virtual machine?

I created a Windows guest using the virt-manager GUI and pushed the GPU into it. Everything works, but there was a task before / after starting the guest to "reset" the physical device on the host. I can write a reset script (a couple of commands), but how can I run it at the time of VM startup? How to intercept libvirt/kvm events and run this script as root?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vlad Zhivotnev, 2015-05-09
@mirspo

https://www.libvirt.org/hooks.html

I
Ilya, 2015-05-09
@mirspo

Thanks, but there is a question: I
partially figured it out, we write the /etc/libvirt/hooks/qemu script and catch events.
How to intercept guest reboot?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question