Adds some log messages related to configure.

Also fixes a bug in the previous patch.
This commit is contained in:
Ondrej Zajicek 2010-02-06 22:57:51 +01:00
parent ebae4770c9
commit 76b53a4e20
3 changed files with 34 additions and 10 deletions

View file

@ -57,7 +57,7 @@ static jmp_buf conf_jmpbuf;
struct config *config, *new_config, *old_config, *future_config; struct config *config, *new_config, *old_config, *future_config;
static event *config_event; static event *config_event;
int shutting_down; int shutting_down, future_type;
bird_clock_t boot_time; bird_clock_t boot_time;
/** /**
@ -201,6 +201,7 @@ config_do_commit(struct config *c, int type)
config = new_config = c; config = new_config = c;
if (old_config) if (old_config)
old_config->obstacle_count++; old_config->obstacle_count++;
DBG("sysdep_commit\n"); DBG("sysdep_commit\n");
force_restart = sysdep_commit(c, old_config); force_restart = sysdep_commit(c, old_config);
DBG("global_commit\n"); DBG("global_commit\n");
@ -238,8 +239,8 @@ config_done(void *unused UNUSED)
break; break;
c = future_config; c = future_config;
future_config = NULL; future_config = NULL;
log(L_INFO "Switching to queued configuration..."); log(L_INFO "Reconfiguring to queued configuration");
if (!config_do_commit(c, RECONFIG_HARD)) if (!config_do_commit(c, future_type))
break; break;
} }
} }
@ -290,8 +291,13 @@ config_commit(struct config *c, int type)
else else
log(L_INFO "Queued new configuration"); log(L_INFO "Queued new configuration");
future_config = c; future_config = c;
future_type = type;
return CONF_QUEUED; return CONF_QUEUED;
} }
if (!shutting_down)
log(L_INFO "Reconfiguring");
if (config_do_commit(c, type)) if (config_do_commit(c, type))
{ {
config_done(NULL); config_done(NULL);

View file

@ -280,7 +280,7 @@ proto_reconfigure(struct proto *p, struct proto_config *oc, struct proto_config
if ((nc->protocol != oc->protocol) || if ((nc->protocol != oc->protocol) ||
(nc->disabled != oc->disabled) || (nc->disabled != oc->disabled) ||
(nc->table->table != oc->table->table) || (nc->table->table != oc->table->table) ||
(proto_get_router_id(nc) == proto_get_router_id(oc))) (proto_get_router_id(nc) != proto_get_router_id(oc)))
return 0; return 0;
int import_changed = (type != RECONFIG_SOFT) && ! filter_same(nc->in_filter, oc->in_filter); int import_changed = (type != RECONFIG_SOFT) && ! filter_same(nc->in_filter, oc->in_filter);
@ -312,10 +312,14 @@ proto_reconfigure(struct proto *p, struct proto_config *oc, struct proto_config
p->in_filter = nc->in_filter; p->in_filter = nc->in_filter;
p->out_filter = nc->out_filter; p->out_filter = nc->out_filter;
if (import_changed || export_changed)
log(L_INFO "Reloading protocol %s", p->name);
if (import_changed && ! p->reload_routes(p)) if (import_changed && ! p->reload_routes(p))
{ {
/* Now, the protocol is reconfigured. But route reload failed /* Now, the protocol is reconfigured. But route reload failed
and we have to do regular protocol restart. */ and we have to do regular protocol restart. */
log(L_INFO "Restarting protocol %s", p->name);
p->disabled = 1; p->disabled = 1;
proto_rethink_goal(p); proto_rethink_goal(p);
p->disabled = 0; p->disabled = 0;
@ -382,13 +386,20 @@ protos_commit(struct config *new, struct config *old, int force_reconfig, int ty
continue; continue;
/* Unsuccessful, we will restart it */ /* Unsuccessful, we will restart it */
DBG("\t%s: power cycling\n", oc->name); if (!p->disabled && !nc->disabled)
log(L_INFO "Restarting protocol %s", p->name);
else if (p->disabled && !nc->disabled)
log(L_INFO "Enabling protocol %s", p->name);
else if (!p->disabled && nc->disabled)
log(L_INFO "Disabling protocol %s", p->name);
PD(p, "Restarting"); PD(p, "Restarting");
p->cf_new = nc; p->cf_new = nc;
} }
else else
{ {
DBG("\t%s: deleting\n", oc->name); if (!shutting_down)
log(L_INFO "Removing protocol %s", p->name);
PD(p, "Unconfigured"); PD(p, "Unconfigured");
p->cf_new = NULL; p->cf_new = NULL;
} }
@ -401,7 +412,8 @@ protos_commit(struct config *new, struct config *old, int force_reconfig, int ty
WALK_LIST(nc, new->protos) WALK_LIST(nc, new->protos)
if (!nc->proto) if (!nc->proto)
{ {
DBG("\t%s: adding\n", nc->name); if (old_config) /* Not a first-time configuration */
log(L_INFO "Adding protocol %s", nc->name);
proto_init(nc); proto_init(nc);
} }
DBG("\tdone\n"); DBG("\tdone\n");
@ -878,9 +890,10 @@ proto_xxable(char *pattern, int xx)
cli_msg(-8, "%s: already disabled", p->name); cli_msg(-8, "%s: already disabled", p->name);
else else
{ {
cli_msg(-9, "%s: disabled", p->name); log(L_INFO "Disabling protocol %s", p->name);
p->disabled = 1; p->disabled = 1;
proto_rethink_goal(p); proto_rethink_goal(p);
cli_msg(-9, "%s: disabled", p->name);
} }
break; break;
@ -889,9 +902,10 @@ proto_xxable(char *pattern, int xx)
cli_msg(-10, "%s: already enabled", p->name); cli_msg(-10, "%s: already enabled", p->name);
else else
{ {
cli_msg(-11, "%s: enabled", p->name); log(L_INFO "Enabling protocol %s", p->name);
p->disabled = 0; p->disabled = 0;
proto_rethink_goal(p); proto_rethink_goal(p);
cli_msg(-11, "%s: enabled", p->name);
} }
break; break;
@ -900,6 +914,7 @@ proto_xxable(char *pattern, int xx)
cli_msg(-8, "%s: already disabled", p->name); cli_msg(-8, "%s: already disabled", p->name);
else else
{ {
log(L_INFO "Restarting protocol %s", p->name);
p->disabled = 1; p->disabled = 1;
proto_rethink_goal(p); proto_rethink_goal(p);
p->disabled = 0; p->disabled = 0;
@ -921,6 +936,8 @@ proto_xxable(char *pattern, int xx)
if (p->proto_state != PS_UP) if (p->proto_state != PS_UP)
break; break;
log(L_INFO "Reloading protocol %s", p->name);
/* re-importing routes */ /* re-importing routes */
if (xx != XX_RELOAD_OUT) if (xx != XX_RELOAD_OUT)
if (! (p->reload_routes && p->reload_routes(p))) if (! (p->reload_routes && p->reload_routes(p)))

View file

@ -314,7 +314,7 @@ void
sysdep_shutdown_done(void) sysdep_shutdown_done(void)
{ {
unlink(path_control_socket); unlink(path_control_socket);
log_msg(L_FATAL "System shutdown completed"); log_msg(L_FATAL "Shutdown completed");
exit(0); exit(0);
} }
@ -476,6 +476,7 @@ main(int argc, char **argv)
async_dump_flag = 1; async_dump_flag = 1;
#endif #endif
log(L_INFO "Started");
DBG("Entering I/O loop.\n"); DBG("Entering I/O loop.\n");
io_loop(); io_loop();