From ca7a981b3e57e0de3a930d6d100a2e967f8bd229 Mon Sep 17 00:00:00 2001 From: Vincent Liu Date: Thu, 5 Sep 2024 14:46:01 +0100 Subject: [PATCH] New hook to execute before xapi shuts down Signed-off-by: Vincent Liu --- ocaml/xapi/xapi_hooks.ml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ocaml/xapi/xapi_hooks.ml b/ocaml/xapi/xapi_hooks.ml index 4e09084100c..ecc1a258063 100644 --- a/ocaml/xapi/xapi_hooks.ml +++ b/ocaml/xapi/xapi_hooks.ml @@ -20,6 +20,8 @@ let scriptname__host_pre_declare_dead = "host-pre-declare-dead" let scriptname__host_post_declare_dead = "host-post-declare-dead" +let scriptname__xapi_pre_shutdown = "xapi-pre-shutdown" + (* Host Script hook reason codes *) let reason__fenced = "fenced" @@ -127,6 +129,12 @@ let host_pre_declare_dead ~__context ~host ~reason = () ) +let xapi_pre_shutdown ~__context ~host ~reason = + info "%s Running xapi pre shutdown hooks for %s" __FUNCTION__ + (Ref.string_of host) ; + execute_host_hook ~__context ~script_name:scriptname__xapi_pre_shutdown + ~reason ~host + (* Called when host died -- !! hook code in here to abort outstanding forwarded ops *) let internal_host_dead_hook __context host = info "Running host dead hook for %s" (Ref.string_of host) ;