[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-API] [PATCH] add pool join and eject hooks executing /etc/xapi.d/pool-{join, eject}/*



I placed the hooks at the end of each action. I didn't go as far as
{pre,post}x{join,eject} but could do if that is desirable.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r e0955609cb2f -r 3198ac4809a2 ocaml/xapi/xapi_hooks.ml
--- a/ocaml/xapi/xapi_hooks.ml  Tue May 04 17:54:35 2010 +0100
+++ b/ocaml/xapi/xapi_hooks.ml  Tue May 04 18:26:04 2010 +0100
@@ -39,6 +39,8 @@
 (* 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_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
diff -r e0955609cb2f -r 3198ac4809a2 ocaml/xapi/xapi_pool.ml
--- a/ocaml/xapi/xapi_pool.ml   Tue May 04 17:54:35 2010 +0100
+++ b/ocaml/xapi/xapi_pool.ml   Tue May 04 18:26:04 2010 +0100
@@ -547,11 +547,11 @@
                        (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
 
@@ -686,7 +686,8 @@
                                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 *)

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.