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

Sundar Nadathur snadathu at altera.com
Thu Nov 19 21:32:05 UTC 2015

   Is there a reason why the prepare and start hooks cannot modify the domain xml? One would think it is a common use case to inject a device or some content at VM creation time.

Thank you very much.


-----Original Message-----
From: Jiri Denemark [mailto:jdenemar at redhat.com]
Sent: Monday, November 16, 2015 5:17 AM
To: Sundar Nadathur
Cc: 'libvirt-users at redhat.com'
Subject: Re: [libvirt-users] libvirt prepare and start hooks not callled

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.



Confidentiality Notice.
This message may contain information that is confidential or otherwise protected from disclosure. If you are not the intended recipient, you are hereby notified that any use, disclosure, dissemination, distribution, or copying of this message, or any attachments, is strictly prohibited. If you have received this message in error, please advise the sender by reply e-mail, and delete the message and any attachments. Thank you.

More information about the libvirt-users mailing list