mirror of
https://git.proxmox.com/git/mirror_corosync
synced 2025-08-05 11:20:26 +00:00
Add notification when totem has completed initialization.
This triggers the initialization of the service engines which may need totem for initialization. git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2372 fd59a12c-fef9-0310-b244-a6a79926bd2f
This commit is contained in:
parent
f9f663f459
commit
69928e301a
27
exec/main.c
27
exec/main.c
@ -716,6 +716,20 @@ static void corosync_setscheduler (void)
|
||||
#endif
|
||||
}
|
||||
|
||||
void main_service_ready (void)
|
||||
{
|
||||
int res;
|
||||
/*
|
||||
* This must occur after totempg is initialized because "this_ip" must be set
|
||||
*/
|
||||
res = corosync_service_defaults_link_and_init (api);
|
||||
if (res == -1) {
|
||||
log_printf (LOGSYS_LEVEL_ERROR, "Could not initialize default services\n");
|
||||
corosync_exit_error (AIS_DONE_INIT_SERVICES);
|
||||
}
|
||||
evil_init (api);
|
||||
}
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
const char *error_string;
|
||||
@ -973,6 +987,9 @@ int main (int argc, char **argv)
|
||||
corosync_poll_handle,
|
||||
&totem_config);
|
||||
|
||||
totempg_service_ready_register (
|
||||
main_service_ready);
|
||||
|
||||
totempg_groups_initialize (
|
||||
&corosync_group_handle,
|
||||
deliver_fn,
|
||||
@ -983,16 +1000,6 @@ int main (int argc, char **argv)
|
||||
&corosync_group,
|
||||
1);
|
||||
|
||||
/*
|
||||
* This must occur after totempg is initialized because "this_ip" must be set
|
||||
*/
|
||||
res = corosync_service_defaults_link_and_init (api);
|
||||
if (res == -1) {
|
||||
log_printf (LOGSYS_LEVEL_ERROR, "Could not initialize default services\n");
|
||||
corosync_exit_error (AIS_DONE_INIT_SERVICES);
|
||||
}
|
||||
evil_init (api);
|
||||
|
||||
if (minimum_sync_mode == CS_SYNC_V2) {
|
||||
log_printf (LOGSYS_LEVEL_NOTICE, "Compatibility mode set to none. Using V2 of the synchronization engine.\n");
|
||||
sync_v2_init (
|
||||
|
@ -234,3 +234,11 @@ extern int totemmrp_ring_reenable (void)
|
||||
|
||||
return (res);
|
||||
}
|
||||
|
||||
extern void totemmrp_service_ready_register (
|
||||
void (*totem_service_ready) (void))
|
||||
{
|
||||
totemsrp_service_ready_register (
|
||||
totemsrp_context,
|
||||
totem_service_ready);
|
||||
}
|
||||
|
@ -112,4 +112,7 @@ extern int totemmrp_crypto_set (unsigned int);
|
||||
|
||||
extern int totemmrp_ring_reenable (void);
|
||||
|
||||
extern void totemmrp_service_ready_register (
|
||||
void (*totem_service_ready) (void));
|
||||
|
||||
#endif /* TOTEMMRP_H_DEFINED */
|
||||
|
@ -1343,3 +1343,9 @@ int totempg_my_family_get (void)
|
||||
{
|
||||
return (totemmrp_my_family_get());
|
||||
}
|
||||
extern void totempg_service_ready_register (
|
||||
void (*totem_service_ready) (void))
|
||||
{
|
||||
totemmrp_service_ready_register (totem_service_ready);
|
||||
}
|
||||
|
||||
|
@ -1536,7 +1536,6 @@ int totemrrp_initialize (
|
||||
deliver_fn_context->instance = instance;
|
||||
deliver_fn_context->context = context;
|
||||
deliver_fn_context->iface_no = i;
|
||||
printf ("deliver fn context %p\n", deliver_fn_context);
|
||||
|
||||
totemnet_initialize (
|
||||
poll_handle,
|
||||
|
@ -470,6 +470,8 @@ struct totemsrp_instance {
|
||||
const unsigned int *joined_list, size_t joined_list_entries,
|
||||
const struct memb_ring_id *ring_id);
|
||||
|
||||
void (*totemsrp_service_ready_fn) (void);
|
||||
|
||||
int global_seqno;
|
||||
|
||||
int my_token_held;
|
||||
@ -917,7 +919,7 @@ int totemsrp_ifaces_get (
|
||||
unsigned int *iface_count)
|
||||
{
|
||||
struct totemsrp_instance *instance = (struct totemsrp_instance *)srp_context;
|
||||
int res;
|
||||
int res = 0;
|
||||
unsigned int found = 0;
|
||||
unsigned int i;
|
||||
|
||||
@ -4246,6 +4248,9 @@ void main_iface_change_fn (
|
||||
"Created or loaded sequence id %lld.%s for this ring.\n",
|
||||
instance->my_ring_id.seq,
|
||||
totemip_print (&instance->my_ring_id.rep));
|
||||
if (instance->totemsrp_service_ready_fn) {
|
||||
instance->totemsrp_service_ready_fn ();
|
||||
}
|
||||
|
||||
}
|
||||
if (instance->iface_changes >= instance->totem_config->interface_count) {
|
||||
@ -4256,3 +4261,12 @@ void main_iface_change_fn (
|
||||
void totemsrp_net_mtu_adjust (struct totem_config *totem_config) {
|
||||
totem_config->net_mtu -= sizeof (struct mcast);
|
||||
}
|
||||
|
||||
void totemsrp_service_ready_register (
|
||||
void *context,
|
||||
void (*totem_service_ready) (void))
|
||||
{
|
||||
struct totemsrp_instance *instance = (struct totemsrp_instance *)context;
|
||||
|
||||
instance->totemsrp_service_ready_fn = totem_service_ready;
|
||||
}
|
||||
|
@ -115,4 +115,8 @@ extern int totemsrp_crypto_set (
|
||||
extern int totemsrp_ring_reenable (
|
||||
void *srp_context);
|
||||
|
||||
void totemsrp_service_ready_register (
|
||||
void *srp_context,
|
||||
void (*totem_service_ready) (void));
|
||||
|
||||
#endif /* TOTEMSRP_H_DEFINED */
|
||||
|
@ -153,6 +153,9 @@ extern int totempg_crypto_set (unsigned int type);
|
||||
|
||||
extern int totempg_ring_reenable (void);
|
||||
|
||||
extern void totempg_service_ready_register (
|
||||
void (*totem_service_ready) (void));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user