Commit 8fd0dc9b authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

Add completion event to the delay agent. You can now add the -w option

to tevc to wait for the reset to complete:

	tevc -w -e testbed/TT now link0 reset
or
	tevc -w -e testbed/TT now __all_lans reset

where __all_lans in another internally created event group.
parent 53c3944c
......@@ -428,8 +428,11 @@ void
reset_callback(event_handle_t handle,
event_notification_t notification, void *data)
{
char buf[BUFSIZ];
char *prog = "delaysetup";
char buf[BUFSIZ];
char objname[TBDB_FLEN_EVOBJNAME];
char *prog = "delaysetup";
unsigned long token = ~0;
int errcode = 0;
info("Got a RESET event!\n");
......@@ -437,5 +440,20 @@ reset_callback(event_handle_t handle,
sprintf(buf, "%s -r -j %s", prog, myvnode);
else
sprintf(buf, "%s -r", prog);
system(buf);
errcode = system(buf);
event_notification_get_int32(handle, notification,
"TOKEN", (int32_t *)&token);
event_notification_get_objname(handle, notification,
objname, sizeof(objname));
/* ... notify the scheduler of the completion. */
event_do(handle,
EA_Experiment, myexp,
EA_Type, TBDB_OBJECTTYPE_LINK,
EA_Name, objname,
EA_Event, TBDB_EVENTTYPE_COMPLETE,
EA_ArgInteger, "ERROR", errcode,
EA_ArgInteger, "CTOKEN", token,
EA_TAG_DONE);
}
......@@ -573,6 +573,11 @@ int sends_complete(struct agent *agent, const char *evtype)
NULL
};
static char *link_completes[] = {
TBDB_EVENTTYPE_RESET,
NULL
};
static char *node_completes[] = {
TBDB_EVENTTYPE_REBOOT,
TBDB_EVENTTYPE_RELOAD,
......@@ -589,7 +594,7 @@ int sends_complete(struct agent *agent, const char *evtype)
char *objtype;
char **evtypes;
} objtype2complete[] = {
{ TBDB_OBJECTTYPE_LINK, NULL },
{ TBDB_OBJECTTYPE_LINK, link_completes },
{ TBDB_OBJECTTYPE_TRAFGEN, NULL },
{ TBDB_OBJECTTYPE_TIME, NULL },
{ TBDB_OBJECTTYPE_PROGRAM, run_completes },
......
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