]> xenbits.xensource.com Git - xcp/xen-api.git/commitdiff
I placed the hooks at the end of each action. I didn't go as far as
authorIan Campbell <ian.campbell@citrix.com>
Thu, 8 Jul 2010 15:28:43 +0000 (16:28 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 8 Jul 2010 15:28:43 +0000 (16:28 +0100)
{pre,post}x{join,eject} but could do if that is desirable.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
ocaml/xapi/xapi_hooks.ml
ocaml/xapi/xapi_pool.ml

index 44b7c450574e0949b159696aa3c399454f9c328d..89901a682c079c5572323501c9d55a91765911d9 100644 (file)
@@ -39,6 +39,8 @@ let reason__fenced = "fenced"
 (* Names of Pool script hooks *)
 let scriptname__pool_ha_overcommitted = "pool-ha-overcommitted"
 let scriptname__pool_pre_ha_vm_restart = "pool-pre-ha-vm-restart"
+let scriptname__pool_join = "pool-join"
+let scriptname__pool_eject = "pool-eject"
 let reason__none = "none"
 
 (* Exit codes: *)
@@ -121,4 +123,10 @@ let pool_ha_overcommitted_hook ~__context =
 let pool_pre_ha_vm_restart_hook ~__context = 
   execute_pool_hook ~__context ~script_name:scriptname__pool_pre_ha_vm_restart ~reason:reason__none
 
+let pool_join_hook ~__context =
+  execute_pool_hook ~__context ~script_name:scriptname__pool_join ~reason:reason__none
+
+let pool_eject_hook ~__context =
+  execute_pool_hook ~__context ~script_name:scriptname__pool_eject ~reason:reason__none
+
 let pool_pre_ha_vm_restart_hook_exists () = Array.length (list_individual_hooks ~script_name:scriptname__pool_pre_ha_vm_restart) > 0
index af39b83f30a251e0564204b62b7a8e232c863708..54acaafd3b7d150568156bbbf14d4b95c3e0c45d 100644 (file)
@@ -587,11 +587,11 @@ let join_common ~__context ~master_address ~master_username ~master_password ~fo
                        (fun (host, _) ->
                                Client.Host.update_pool_secret my_rpc my_session_id host !cluster_secret;
                                Client.Host.update_master my_rpc my_session_id host master_address)
-               (Db.Host.get_all_records ~__context))
+               (Db.Host.get_all_records ~__context));
+       Xapi_hooks.pool_join_hook ~__context
 
 let join ~__context ~master_address ~master_username ~master_password  =
   join_common ~__context ~master_address ~master_username ~master_password ~force:false
-
 let join_force ~__context ~master_address ~master_username ~master_password  =
   join_common ~__context ~master_address ~master_username ~master_password ~force:true
 
@@ -726,7 +726,8 @@ let eject ~__context ~host =
                                Xapi_globs.remote_db_conf_fragment_path
                                (Xapi_globs.remote_db_conf_fragment_path ^ ".bak")) ()
                )
-               (fun () -> Xapi_fuse.light_fuse_and_reboot_after_eject())
+               (fun () -> Xapi_fuse.light_fuse_and_reboot_after_eject());
+               Xapi_hooks.pool_eject_hook ~__context
        end
 
 (* Prohibit parallel flushes since they're so expensive *)