On Sat, Mar 11, 2023 at 01:08:33AM +0000, Mike Pontillo wrote:
This adds the reason the domain stopped to the 'extra' field,
which
will be sent to the 'qemu' hook script (if defined).
Signed-off-by: Mike Pontillo <mpontillo(a)digitalocean.com>
---
Our hook processor often needs to know the reason why a guest stopped. I
am propsing this change in case other hook processing implementations
could also benefit from this information.
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
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
---
src/qemu/qemu_process.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index be418ad8e6..425b73c37e 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -8432,7 +8432,7 @@ void qemuProcessStop(virQEMUDriver *driver,
/* we can't stop the operation even if the script raised an error */
ignore_value(virHookCall(VIR_HOOK_DRIVER_QEMU, vm->def->name,
VIR_HOOK_QEMU_OP_STOPPED, VIR_HOOK_SUBOP_END,
- NULL, xml, NULL));
+ virDomainShutoffReasonTypeToString(reason), xml,
NULL));
}
/* Reset Security Labels unless caller don't want us to */
--
2.34.1