1

I need to do "virsh managedsave-remove VMname" from a libvirt QEMU hook. https://www.libvirt.org/hooks.html says: "Calling libvirt functions from within a hook script - DO NOT DO THIS!: A hook script must not call back into libvirt, as the libvirt daemon is already waiting for the script to exit." That means I can not do:

virsh managedsave-remove VMname

from within the QEMU hook because I will hang libvirt daemon.

Is there a way to perfom the same function from the libvirt QEMU hook?

Details: I have a VM (Win7) which opens a file on a network drive. When this VM is closed (in any way) and then restarted, program that did open the file can not reconnect to it as the file remained locked. VM is QEMU/KVM, machine is QNAP NAS, and the program in quesiton is hMailServer with its database hMailServer.sdf on the network drive.

In some situation, the VM is saved as managedsave - I have no control over that. When VM is restarted from managedsave, it can not connect to the file which I simply fix from the script using virsh managedsave-remove VMname.

I fixed both problems in my script which starts VM if it is not active.

Then I wanted to improve by hooking into the launch process of VMname so fixes will be applied in every possible situation automatically. And got stuck there. I need both fixes for things to work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.