[libvirt] Using XML returned from domain hook script
Daniel P. Berrange
berrange at redhat.com
Mon Oct 30 07:48:20 UTC 2017
On Sun, Oct 29, 2017 at 08:39:08PM -0600, Jim Fehlig wrote:
> Hi All,
>
> It may be a foolish en devour, but I'm trying to make a qemu hook script
> that provides the semantics of an old, custom xen block script. The script
> parses <disk> info, does some setup based on that, and then rewrites part of
> the config based on results of the setup. As an example, here is an XML
> snippet of a <disk> device on input to the hook script
>
> <disk type='block' device='disk'>
> <driver name='qemu' type='raw'/>
> <source dev='some-dev-config'/>
> <target dev='vdb' bus='virtio'/>
> </disk>
>
> and XML returned by the script
>
> <disk type='block' device='disk'>
> <driver name='qemu' type='raw'/>
> <source dev='/dev/foo'/>
> <target dev='vdb' bus='virtio'/>
> </disk>
>
> The hook script performs the setup and substitution in the "prepare" phase,
> but I noticed the results are never used when subsequently starting the
> domain. Indeed qemuProcessStartHook passes a NULL buffer to virHookCall, so
> the output XML of the hook is never collected. Does anyone have objections
> to using the XML returned from the "prepare" and "release" hook script
> phases, similar to how it is used in the "restore" and "migrate" phases?
That was an explicit decision - we don't want hook scripts arbitrarily
modifying the XML during startup. They're there to let you trigger
external actions, but they're not there to let you modify the config.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
More information about the libvir-list
mailing list