WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

[Xen-API] [PATCH] add pool join and eject hooks executing /etc/xapi.d/po

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH] add pool join and eject hooks executing /etc/xapi.d/pool-{join, eject}/*
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Tue, 04 May 2010 18:26:36 +0100
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Delivery-date: Tue, 04 May 2010 10:26:45 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
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

<Prev in Thread] Current Thread [Next in Thread>