Hi guys, I sent this patch because we are having some troubles to introduce/remove a new hook. We are creating a package here (RPM, DEB, etc) that configures a VDI and introduces a hook for customization. When the package is removed, the hook is too. After that, all VMs stop to working saying this message. So, we need to restart libvirt to take the effect and it is annoying. -- Julio Cesar Faracco 2016-07-11 15:22 GMT-03:00 Julio Faracco <jcfaracco@xxxxxxxxx>: > This commit introduces the virHookCheck() before running the command (hook). > The virHookCheck() before virCommandRun() will avoid errors with changes > (removal and other permissions changes) in the hook file, while the libvirt > daemon is running. > > Now, when you remove the hook file while libvirtd is running you get the > following error: > > virsh # start WINDOWS_7 > error: Failed to start domain WINDOWS_7 > error: Hook script execution failed: internal error: Child process (LC_ALL=C > PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin > HOME=/home/julio USER=root LOGNAME=root /etc/libvirt/hooks/qemu WINDOWS_7 > prepare begin -) unexpected exit status 127: libvirt: error : cannot execute > binary /etc/libvirt/hooks/qemu: No such file or directory > > Cc: Carlos Castilho <ccast@xxxxxxxxxx> > Signed-off-by: Julio Faracco <jcfaracco@xxxxxxxxx> > --- > src/util/virhook.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/src/util/virhook.c b/src/util/virhook.c > index d37d6da..f741b30 100644 > --- a/src/util/virhook.c > +++ b/src/util/virhook.c > @@ -294,7 +294,12 @@ virHookCall(int driver, > if (output) > virCommandSetOutputBuffer(cmd, output); > > - ret = virCommandRun(cmd, NULL); > + ret = virHookCheck(driver, virHookDriverTypeToString(driver)); > + > + if (ret > 0) { > + ret = virCommandRun(cmd, NULL); > + } > + > if (ret < 0) { > /* Convert INTERNAL_ERROR into known error. */ > virReportError(VIR_ERR_HOOK_SCRIPT_FAILED, "%s", > -- > 1.9.1 > -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list