For abnormal shutoff reasons, we can start guest again with qemu hooks. Signed-off-by: Sun Feng <loyou85@xxxxxxxxx> --- docs/hooks.rst | 3 ++- src/qemu/qemu_process.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/hooks.rst b/docs/hooks.rst index 1dbc492bd4..45856e4ca4 100644 --- a/docs/hooks.rst +++ b/docs/hooks.rst @@ -204,7 +204,8 @@ operation. There is no specific operation to indicate a "restart" is occurring. - When a QEMU guest is stopped, the qemu hook script is called in two locations, to match the startup. First, :since:`since 0.8.0`, the hook is - called before libvirt restores any labels: + called before libvirt restores any labels, :since:`since 9.10.0`, shutoff + reason is delivered with **extra argument**: :: diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index e4bcb628cf..c42f5c9139 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -8564,7 +8564,8 @@ 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 _______________________________________________ Devel mailing list -- devel@xxxxxxxxxxxxxxxxx To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx