mirror of
https://git.proxmox.com/git/mirror_corosync
synced 2025-08-15 09:13:21 +00:00
Modify AMF to use new timer.c/timer.h routines properly
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1076 fd59a12c-fef9-0310-b244-a6a79926bd2f
This commit is contained in:
parent
01afe82393
commit
f9abb3899e
@ -86,7 +86,6 @@
|
||||
#include "../include/list.h"
|
||||
#include "../lcr/lcr_comp.h"
|
||||
#include "totempg.h"
|
||||
#include "aispoll.h"
|
||||
#include "mempool.h"
|
||||
#include "util.h"
|
||||
#include "amf.h"
|
||||
|
@ -43,8 +43,8 @@
|
||||
#include "../include/saAmf.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/ipc_gen.h"
|
||||
#include "aispoll.h"
|
||||
#include "objdb.h"
|
||||
#include "timer.h"
|
||||
|
||||
enum escalation_levels {
|
||||
ESCALATION_LEVEL_NO_ESCALATION = 1, /* execute component restart */
|
||||
@ -78,7 +78,7 @@ struct amf_cluster {
|
||||
struct amf_application *application_head;
|
||||
|
||||
/* Implementation */
|
||||
poll_timer_handle timeout_handle;
|
||||
openais_timer_handle timeout_handle;
|
||||
};
|
||||
|
||||
struct amf_node {
|
||||
@ -267,8 +267,8 @@ struct amf_healthcheck {
|
||||
int active;
|
||||
SaAmfHealthcheckInvocationT invocationType;
|
||||
SaAmfRecommendedRecoveryT recommendedRecovery;
|
||||
poll_timer_handle timer_handle_duration;
|
||||
poll_timer_handle timer_handle_period;
|
||||
openais_timer_handle timer_handle_duration;
|
||||
openais_timer_handle timer_handle_period;
|
||||
};
|
||||
|
||||
struct amf_si {
|
||||
|
@ -71,7 +71,6 @@
|
||||
|
||||
#include "print.h"
|
||||
#include "amf.h"
|
||||
#include "aispoll.h"
|
||||
#include "util.h"
|
||||
#include "main.h"
|
||||
|
||||
@ -99,7 +98,7 @@ static void timer_function_cluster_startup_tmo (void *_cluster)
|
||||
}
|
||||
|
||||
/* wait a while before assigning workload */
|
||||
poll_timer_add (aisexec_poll_handle,
|
||||
openais_timer_add (
|
||||
cluster->saAmfClusterStartupTimeout,
|
||||
cluster,
|
||||
timer_function_cluster_assign_workload_tmo,
|
||||
@ -109,7 +108,7 @@ static void timer_function_cluster_startup_tmo (void *_cluster)
|
||||
void amf_cluster_start (struct amf_cluster *cluster)
|
||||
{
|
||||
/* wait a while before starting applications */
|
||||
poll_timer_add (aisexec_poll_handle,
|
||||
openais_timer_add (
|
||||
cluster->saAmfClusterStartupTimeout,
|
||||
cluster,
|
||||
timer_function_cluster_startup_tmo,
|
||||
|
@ -135,7 +135,6 @@
|
||||
#include "../include/ipc_gen.h"
|
||||
#include "../include/ipc_amf.h"
|
||||
#include "totempg.h"
|
||||
#include "aispoll.h"
|
||||
#include "main.h"
|
||||
#include "ipc.h"
|
||||
#include "service.h"
|
||||
@ -832,11 +831,9 @@ static void healthcheck_deactivate (
|
||||
dprintf ("deactivating healthcheck for component %s\n",
|
||||
getSaNameT (&healthcheck_active->comp->name));
|
||||
|
||||
poll_timer_delete (aisexec_poll_handle,
|
||||
healthcheck_active->timer_handle_period);
|
||||
openais_timer_delete (healthcheck_active->timer_handle_period);
|
||||
|
||||
poll_timer_delete (aisexec_poll_handle,
|
||||
healthcheck_active->timer_handle_duration);
|
||||
openais_timer_delete (healthcheck_active->timer_handle_duration);
|
||||
|
||||
invocation_destroy_by_data ((void *)healthcheck_active);
|
||||
healthcheck_active->active = 0;
|
||||
@ -855,7 +852,7 @@ static void timer_function_healthcheck_next_fn (void *_healthcheck)
|
||||
lib_healthcheck_request (healthcheck);
|
||||
|
||||
/* start duration timer for response */
|
||||
poll_timer_add (aisexec_poll_handle,
|
||||
openais_timer_add (
|
||||
healthcheck->saAmfHealthcheckMaxDuration,
|
||||
(void *)healthcheck,
|
||||
timer_function_healthcheck_tmo,
|
||||
@ -1148,14 +1145,14 @@ SaAisErrorT amf_comp_healthcheck_start (
|
||||
|
||||
if (invocationType == SA_AMF_HEALTHCHECK_AMF_INVOKED) {
|
||||
/* start timer to execute first healthcheck request */
|
||||
poll_timer_add (aisexec_poll_handle,
|
||||
healthcheck->saAmfHealthcheckPeriod,
|
||||
(void *)healthcheck,
|
||||
timer_function_healthcheck_next_fn,
|
||||
&healthcheck->timer_handle_period);
|
||||
openais_timer_add (
|
||||
healthcheck->saAmfHealthcheckPeriod,
|
||||
(void *)healthcheck,
|
||||
timer_function_healthcheck_next_fn,
|
||||
&healthcheck->timer_handle_period);
|
||||
} else if (invocationType == SA_AMF_HEALTHCHECK_COMPONENT_INVOKED) {
|
||||
/* start supervision timer */
|
||||
poll_timer_add (aisexec_poll_handle,
|
||||
openais_timer_add (
|
||||
healthcheck->saAmfHealthcheckPeriod,
|
||||
(void *)healthcheck,
|
||||
timer_function_healthcheck_tmo,
|
||||
@ -1283,16 +1280,15 @@ int amf_comp_response_1 (
|
||||
|
||||
if (healthcheck->invocationType == SA_AMF_HEALTHCHECK_AMF_INVOKED) {
|
||||
/* the response was on time, delete supervision timer */
|
||||
poll_timer_delete (aisexec_poll_handle,
|
||||
healthcheck->timer_handle_duration);
|
||||
openais_timer_delete (healthcheck->timer_handle_duration);
|
||||
healthcheck->timer_handle_duration = 0;
|
||||
|
||||
/* start timer to execute next healthcheck request */
|
||||
poll_timer_add (aisexec_poll_handle,
|
||||
healthcheck->saAmfHealthcheckPeriod,
|
||||
(void *)healthcheck,
|
||||
timer_function_healthcheck_next_fn,
|
||||
&healthcheck->timer_handle_period);
|
||||
openais_timer_add (
|
||||
healthcheck->saAmfHealthcheckPeriod,
|
||||
(void *)healthcheck,
|
||||
timer_function_healthcheck_next_fn,
|
||||
&healthcheck->timer_handle_period);
|
||||
*retval = SA_AIS_OK;
|
||||
} else {
|
||||
*retval = SA_AIS_ERR_INVALID_PARAM;
|
||||
@ -1495,9 +1491,8 @@ SaAisErrorT amf_comp_healthcheck_confirm (
|
||||
} else if (healthcheck->active) {
|
||||
if (healthcheckResult == SA_AIS_OK) {
|
||||
/* the response was on time, restart the supervision timer */
|
||||
poll_timer_delete (aisexec_poll_handle,
|
||||
healthcheck->timer_handle_period);
|
||||
poll_timer_add (aisexec_poll_handle,
|
||||
openais_timer_delete (healthcheck->timer_handle_period);
|
||||
openais_timer_add (
|
||||
healthcheck->saAmfHealthcheckPeriod,
|
||||
(void *)healthcheck,
|
||||
timer_function_healthcheck_tmo,
|
||||
|
@ -410,7 +410,7 @@ extern void amf_sg_su_state_changed (
|
||||
TRACE1 ("All SUs in SG '%s' in service, assigning SIs\n", su->sg->name.value);
|
||||
amf_sg_assign_si (su->sg, 0);
|
||||
if (amf_cluster.timeout_handle) {
|
||||
poll_timer_delete (aisexec_poll_handle, amf_cluster.timeout_handle);
|
||||
openais_timer_delete (amf_cluster.timeout_handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,6 @@
|
||||
#include "../lcr/lcr_comp.h"
|
||||
#include "service.h"
|
||||
#include "totempg.h"
|
||||
#include "aispoll.h"
|
||||
#include "mempool.h"
|
||||
#include "util.h"
|
||||
#include "print.h"
|
||||
|
@ -55,7 +55,6 @@
|
||||
#include "../include/queue.h"
|
||||
#include "../include/hdb.h"
|
||||
#include "../lcr/lcr_comp.h"
|
||||
#include "aispoll.h"
|
||||
#include "service.h"
|
||||
#include "mempool.h"
|
||||
#include "tlist.h"
|
||||
|
@ -65,7 +65,6 @@
|
||||
#include "../include/list.h"
|
||||
#include "../include/queue.h"
|
||||
#include "../lcr/lcr_comp.h"
|
||||
#include "aispoll.h"
|
||||
#include "totempg.h"
|
||||
#include "main.h"
|
||||
#include "ipc.h"
|
||||
|
@ -55,7 +55,6 @@
|
||||
#include "../include/list.h"
|
||||
#include "../include/queue.h"
|
||||
#include "../lcr/lcr_comp.h"
|
||||
#include "aispoll.h"
|
||||
#include "totempg.h"
|
||||
#include "totemip.h"
|
||||
#include "main.h"
|
||||
|
@ -55,7 +55,6 @@
|
||||
#include "../include/list.h"
|
||||
#include "../include/queue.h"
|
||||
#include "../lcr/lcr_comp.h"
|
||||
#include "aispoll.h"
|
||||
#include "totempg.h"
|
||||
#include "main.h"
|
||||
#include "ipc.h"
|
||||
|
@ -55,7 +55,6 @@
|
||||
#include "../lcr/lcr_comp.h"
|
||||
#include "util.h"
|
||||
#include "service.h"
|
||||
#include "aispoll.h"
|
||||
#include "mempool.h"
|
||||
#include "main.h"
|
||||
#include "ipc.h"
|
||||
|
10
exec/ipc.c
10
exec/ipc.c
@ -237,14 +237,6 @@ static int dispatch_init_send_response (
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* pthread_kill interrupts poll so poll can reread its events descriptor
|
||||
* via sigusr1
|
||||
*/
|
||||
static void sigusr1_handler (int num) {
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a connection data structure
|
||||
*/
|
||||
@ -811,8 +803,6 @@ void openais_ipc_init (
|
||||
g_gid_valid = gid_valid;
|
||||
|
||||
my_ip = my_ip_in;
|
||||
|
||||
signal (SIGUSR1, sigusr1_handler);
|
||||
}
|
||||
|
||||
|
||||
|
@ -53,7 +53,6 @@
|
||||
#include "../include/list.h"
|
||||
#include "../include/queue.h"
|
||||
#include "../lcr/lcr_comp.h"
|
||||
#include "aispoll.h"
|
||||
#include "mempool.h"
|
||||
#include "util.h"
|
||||
#include "main.h"
|
||||
|
@ -384,6 +384,10 @@ int main (int argc, char **argv)
|
||||
|
||||
totemip_localhost(AF_INET, &this_non_loopback_ip);
|
||||
|
||||
signal (SIGINT, sigintr_handler);
|
||||
|
||||
signal (SIGUSR2, sigusr2_handler);
|
||||
|
||||
openais_timer_init (
|
||||
serialize_mutex_lock,
|
||||
serialize_mutex_unlock);
|
||||
@ -545,9 +549,6 @@ int main (int argc, char **argv)
|
||||
|
||||
aisexec_mempool_init ();
|
||||
|
||||
signal (SIGINT, sigintr_handler);
|
||||
signal (SIGUSR2, sigusr2_handler);
|
||||
|
||||
openais_ipc_init (
|
||||
serialize_mutex_lock,
|
||||
serialize_mutex_unlock,
|
||||
|
@ -53,7 +53,6 @@
|
||||
#include "../include/queue.h"
|
||||
#include "../lcr/lcr_comp.h"
|
||||
#include "service.h"
|
||||
#include "aispoll.h"
|
||||
#include "mempool.h"
|
||||
#include "util.h"
|
||||
#include "main.h"
|
||||
|
@ -127,6 +127,9 @@ retry_poll:
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void sigusr1_handler (int num) {
|
||||
}
|
||||
|
||||
int openais_timer_init (
|
||||
void (*serialize_lock_fn) (void),
|
||||
void (*serialize_unlock_fn) (void))
|
||||
@ -138,6 +141,8 @@ int openais_timer_init (
|
||||
|
||||
timerlist_init (&timers_timerlist);
|
||||
|
||||
signal (SIGUSR1, sigusr1_handler);
|
||||
|
||||
pthread_mutex_lock (&timer_mutex);
|
||||
pthread_attr_init (&thread_attr);
|
||||
pthread_attr_setstacksize (&thread_attr, 8192);
|
||||
@ -169,7 +174,6 @@ int openais_timer_add (
|
||||
|
||||
pthread_kill (thread, SIGUSR1);
|
||||
|
||||
|
||||
return (res);
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,8 @@
|
||||
|
||||
#include "tlist.h"
|
||||
|
||||
typedef void * openais_timer_handle;
|
||||
|
||||
extern void openais_timer_init (
|
||||
void (*serialize_lock) (void),
|
||||
void (*serialize_unlock) (void));
|
||||
|
@ -40,7 +40,6 @@
|
||||
|
||||
#include "../include/saAis.h"
|
||||
#include "../include/list.h"
|
||||
#include "aispoll.h"
|
||||
#include "util.h"
|
||||
#include "print.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user