[libvirt PATCH] qemu: use stop reason as 'extra' field

Mike Pontillo mpontillo at digitalocean.com
Tue Mar 14 00:26:26 UTC 2023


On 3/13/23 14:19, Martin Kletzander wrote:
> I think this might be beneficial for other as well.  Just few things I
> noticed:
> 
> 1) This should be captured in documentation as well so that
>     libvirt.org/hooks.html mentions this

Good catch; I can look at updating the documentation as well.

> 2) Maybe we could come up with some simple key=value format for the
>     extra parameter so that it is extensible, although not many extending
>     was done in these parts

I think if an extensible format is desired, a JSON dictionary might be 
ideal. Then, hook processor authors can use standard tooling to parse 
and interpret the contents of 'extra'. Because even if we make it 
extensible using a simple key=value format, it starts become problematic 
even with a case like the enum value "from snapshot" for 
virDomainShutoffReason.

After looking at existing usages of the 'extra' field in virHookCall(), 
I think only VIR_HOOK_DRIVER_DAEMON uses the 'extra' field. In that 
case, it is a single string: either "SIGHUP", "start", or "shutdown". 
(Although in this case, the 'extra' information may be redundant; it 
looks like the contents of 'extra' are already implied by the other 
arguments.)

I'm not sure how much flexibility there is to change what 'extra' 
contains, since users' hook processors may be impacted. Maybe, in the 
future, an additional 'json' argument could be added after 'extra' if 
additional extension is needed.

Regards,
Mike



More information about the libvir-list mailing list