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

Mike Pontillo mpontillo at digitalocean.com
Sat Mar 11 01:08:33 UTC 2023


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 at 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.
---
 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



More information about the libvir-list mailing list