According to the document of libvirt:
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.
A deadlock is likely to occur.
Maybe we should use other CLI tools like sysfs instead.
According to the document of libvirt:
Maybe we should use other CLI tools like
sysfsinstead.