Commit 359118f0 authored by Leigh Stoller's avatar Leigh Stoller

A couple of little tweaks to allow template run to fire off a snapshot

of the logs to the archive.
parent 5e8863b9
......@@ -546,6 +546,7 @@ int sends_complete(struct agent *agent, const char *evtype)
static char *simulator_completes[] = {
TBDB_EVENTTYPE_REPORT,
TBDB_EVENTTYPE_MODIFY,
TBDB_EVENTTYPE_SNAPSHOT,
NULL
};
......
......@@ -381,6 +381,26 @@ static int do_reset(simulator_agent_t sa, char *args)
return retval;
}
static int do_snapshot(simulator_agent_t sa, char *args)
{
char *loghole_args;
int retval = 0;
assert(sa != NULL);
assert(args != NULL);
if (event_arg_get(args, "LOGHOLE_ARGS", &loghole_args) <= 0) {
loghole_args = "";
}
if (systemf("loghole --port=%d sync %s",
DEFAULT_RPC_PORT, loghole_args) != 0) {
error("failed to sync log holes\n");
}
return retval;
}
static int strreltime(char *buf, size_t buflen, time_t secs)
{
int hours, mins, retval = 0;
......@@ -503,12 +523,16 @@ static void *simulator_agent_looper(void *arg)
else if (strcmp(evtype, TBDB_EVENTTYPE_RESET) == 0) {
do_reset(sa, argsbuf);
}
else if (strcmp(evtype, TBDB_EVENTTYPE_SNAPSHOT) == 0){
do_snapshot(sa, argsbuf);
}
else {
error("cannot handle SIMULATOR event %s.",
evtype);
}
if (strcmp(evtype, TBDB_EVENTTYPE_RESET) == 0 ||
strcmp(evtype, TBDB_EVENTTYPE_REPORT) == 0 ||
strcmp(evtype, TBDB_EVENTTYPE_SNAPSHOT) == 0 ||
strcmp(evtype, TBDB_EVENTTYPE_MODIFY) == 0) {
event_do(handle,
EA_Experiment, pideid,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment