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

Jiri Denemark jdenemar at redhat.com
Fri Nov 20 18:05:28 UTC 2015


On Thu, Nov 19, 2015 at 21:32:05 +0000, Sundar Nadathur wrote:
> Hello,
>    Is there a reason why the prepare and start hooks cannot modify the
>    domain xml?

Because they were not designed that way. It's already too late to change
the domain definition in any of the hooks.

>    One would think it is a common use case to inject a device or some
>    content at VM creation time.

Not really, there's no reason to do anything like that. You can just
change the XML before starting it. Or you can use transient domains if
you want domain XMLs to be generated dynamically. It would certainly be
possible to add a new hook which would work as a filter when starting a
new domain, but using existing methods may be easier.

Both migrate and restore hooks were designed as filters because they are
(in case of migration) or can be (in case of restore) called on a
different host where, e.g., disk image files are mounted in a different
path.

Jirka




More information about the libvirt-users mailing list