[libvirt-users] libvirt prepare and start hooks not callled

Jiri Denemark jdenemar at redhat.com
Mon Nov 16 13:17:26 UTC 2015


On Mon, Nov 16, 2015 at 12:43:21 +0000, Sundar Nadathur wrote:
> Hello Jirka,
>    The script is not even invoked for prepare/start calls, not that it
>    is invoking libvirt APIs or is hanging. When it is invoked for
>    'started', it runs to completion.

Strange. Do you see corresponding "Calling hook" messages in libvirtd
debug logs? (See http://wiki.libvirt.org/page/DebugLogs for instructions
how to enable debug logs.)

> I did notice the warning about talking to libvirt from the hooks.
> However, if the script were to be invoked, I will only be writing the
> modified xml to stdout. This is based on:
>    https://libvirt.org/hooks.html
> For migrate and restore calls, "the script acts as a filter and is
> supposed to modify the domain XML and print it out on its standard
> output".

> I am hoping the same method will work for prepare or start calls.

No, the hook only works as a filter for migrate and restore calls.

> If there is a better way to update the VM's xml before it is launched,
> please let me know.

There is, just redefine the XML before starting the domain. There's no
way of doing this via hooks.

Jirka




More information about the libvirt-users mailing list