Commit f6d81289 authored by Leigh Stoller's avatar Leigh Stoller

Changes from Pat Gunn at CMU: allow "at swapout" as a valid time for

an event and to actually fire those events during experiment swapout.
parent e6b2931d
......@@ -89,11 +89,13 @@ static pid_t emcd_pid = -1;
static pid_t vmcd_pid = -1;
static pid_t rmcd_pid = -1;
static struct agent ns_sequence_agent;
static struct agent ns_sequence_agent; /* Used for list of things to do right after swapin */
static timeline_agent_t ns_sequence;
static struct agent ns_teardown_agent;
static struct agent ns_teardown_agent; /* Used during experiment teardown */
static timeline_agent_t ns_teardown;
static struct agent ns_timeline_agent;
static struct agent ns_swapout_agent; /* Used during experiment swapout */
static timeline_agent_t ns_swapout;
static struct agent ns_timeline_agent; /* Used for timeline in the experiment */
static timeline_agent_t ns_timeline;
static void sigpass(int sig)
......@@ -363,6 +365,7 @@ main(int argc, char *argv[])
fatal("could not register with event system");
}
/* Make a (not yet populated) list of things to do after initial swapin */
ns_sequence = create_timeline_agent(TA_SEQUENCE);
ns_sequence->ta_local_agent.la_link.ln_Name = ns_sequence_agent.name;
ns_sequence->ta_local_agent.la_handle = handle;
......@@ -376,7 +379,8 @@ main(int argc, char *argv[])
ns_sequence_agent.handler = &ns_sequence->ta_local_agent;
lnAddTail(&sequences, &ns_sequence->ta_local_agent.la_link);
lnAddTail(&agents, &ns_sequence_agent.link);
/* Make a (not yet populated) list of things to do during teardown */
ns_teardown = create_timeline_agent(TA_SEQUENCE);
ns_teardown->ta_local_agent.la_link.ln_Name = ns_teardown_agent.name;
ns_teardown->ta_local_agent.la_handle = handle;
......@@ -390,7 +394,23 @@ main(int argc, char *argv[])
ns_teardown_agent.handler = &ns_teardown->ta_local_agent;
lnAddTail(&sequences, &ns_teardown->ta_local_agent.la_link);
lnAddTail(&agents, &ns_teardown_agent.link);
/* Make a (not yet populated) list of things to do during swapout, "at swapout" events go into here */
ns_swapout = create_timeline_agent(TA_SEQUENCE);
ns_swapout->ta_local_agent.la_link.ln_Name = ns_swapout_agent.name;
ns_swapout->ta_local_agent.la_handle = handle;
ns_swapout->ta_local_agent.la_agent = &ns_swapout_agent;
ns_swapout_agent.link.ln_Name = ns_swapout_agent.name;
strcpy(ns_swapout_agent.name, "__ns_swapout");
strcpy(ns_swapout_agent.nodeid, "*");
strcpy(ns_swapout_agent.vnode, "*");
strcpy(ns_swapout_agent.objtype, TBDB_OBJECTTYPE_SEQUENCE);
strcpy(ns_swapout_agent.ipaddr, "*");
ns_swapout_agent.handler = &ns_swapout->ta_local_agent;
lnAddTail(&sequences, &ns_swapout->ta_local_agent.la_link);
lnAddTail(&agents, &ns_swapout_agent.link);
/* Make a (not yet populated) timeline for the experiment. "at" events go into here */
ns_timeline = create_timeline_agent(TA_TIMELINE);
ns_timeline->ta_local_agent.la_link.ln_Name = ns_timeline_agent.name;
ns_timeline->ta_local_agent.la_handle = handle;
......@@ -904,9 +924,14 @@ dequeue(event_handle_t handle)
struct timeval now;
char time_buf_1[24], time_buf_2[24];
// XXX
// info("event-sched.c: in dequeue(), about to enter event loop\n");
// XXX
while (1) {
// info("event-sched.c: Event loop loops\n");
if (sched_event_dequeue(&next_event, 1) < 0)
break;
// info("event-sched.c: Dequeued another event\n");
/* Fire event. */
if (debug)
......@@ -951,6 +976,9 @@ dequeue(event_handle_t handle)
sched_event_free(handle, &next_event);
}
// XXX
// info("event-sched.c: in dequeue(), just left event loop\n");
// XXX
}
int
......@@ -1017,7 +1045,8 @@ AddAgent(event_handle_t handle,
char *vname, char *vnode, char *nodeid, char *ipaddr, char *type)
{
struct agent *agentp;
info("D:\t\tAddAgent asked to add agent %s\n", vname);
if ((agentp = calloc(sizeof(struct agent), 1)) == NULL) {
error("AddAgent: Out of memory\n");
return -1;
......@@ -1210,7 +1239,7 @@ AddGroup(event_handle_t handle, char *groupname, char *agentname)
int
AddEvent(event_handle_t handle, address_tuple_t tuple,
char *exidx, char *ftime, char *objname, char *exargs,
char *objtype, char *evttype, char *parent)
char *objtype, char *evttype, char *parent, char *triggertype)
{
timeline_agent_t ta = NULL;
sched_event_t event;
......@@ -1218,6 +1247,7 @@ AddEvent(event_handle_t handle, address_tuple_t tuple,
struct agent *agentp = NULL;
struct timeval time;
info("D: AddEvent asked to add event %s\n", objname);
if (strcmp(objtype, TBDB_OBJECTTYPE_TIME) == 0) {
return 0;
}
......@@ -1226,8 +1256,16 @@ AddEvent(event_handle_t handle, address_tuple_t tuple,
error("AddEvent: Could not map event index %s\n", exidx);
return -1;
}
if (parent && strlen(parent) > 0) {
info("AddEvent called with event of triggertype %s\n", triggertype);
if (strcmp(triggertype, "SWAPOUT")==0) { /* If it is of triggertype SWAPOUT,
Divert to the ns_swapout sequence
XXX I am not certain anything else in this function
apart from timeline_agent_append() is needed, but
let's assume it is.
*/
ta = ns_swapout;
}
else if (parent && strlen(parent) > 0) { /* If the event has a parent, we inherit its timeline-agent */
if (((ta = (timeline_agent_t)lnFindName(&timelines,
parent)) == NULL) &&
((ta = (timeline_agent_t)lnFindName(&sequences,
......@@ -1237,7 +1275,7 @@ AddEvent(event_handle_t handle, address_tuple_t tuple,
}
}
else {
ta = ns_timeline;
ta = ns_timeline; /* It's on the main timeline? */
}
tuple->host = agentp->ipaddr;
......@@ -1263,6 +1301,7 @@ AddEvent(event_handle_t handle, address_tuple_t tuple,
event_notification_insert_hmac(handle, event.notification);
/* convert the event into a timeval */
time.tv_sec = (int)firetime;
time.tv_usec = (int)((firetime - (floor(firetime))) * 1000000);
if (time.tv_usec >= 1000000) {
......@@ -1380,6 +1419,9 @@ get_static_events(event_handle_t handle)
}
event.agent.s = primary_simulator_agent->sa_local_agent.la_agent;
// XXX
info("Automatically scheduling the beginning and end of time\n");
// XXX
if (event.agent.s != NULL) {
// XXX emulab-ops experiments might not have a simulator agent
......@@ -1426,6 +1468,28 @@ get_static_events(event_handle_t handle)
sched_event_prepare(handle, &event);
timeline_agent_append(ns_teardown, &event);
/* Log when swapout events have officially started. */
event.notification = event_notification_create(
handle,
EA_Experiment, pideid,
EA_Type, TBDB_OBJECTTYPE_SIMULATOR,
EA_Event, TBDB_EVENTTYPE_LOG,
EA_Name, event.agent.s->name,
EA_Arguments, "Swapout started",
EA_TAG_DONE);
event.time.tv_sec = 0;
event.time.tv_usec = 0;
event.length = 1;
event.flags = SEF_SINGLE_HANDLER;
event_notification_put_int32(handle,
event.notification,
"TOKEN",
next_token);
next_token += 1;
sched_event_prepare(handle, &event);
timeline_agent_append(ns_swapout, &event);
}
/*
......@@ -1485,7 +1549,9 @@ get_static_events(event_handle_t handle)
EA_Name, ns_sequence_agent.name,
EA_TAG_DONE);
}
// XXX
// info("Returning from get_static_events()\n");
// XXX
return 0;
}
......
......@@ -146,6 +146,9 @@ sched_event_dequeue(sched_event_t *event, int wait)
assert(initialized);
// XXX
// info("queue.c: sched_event_dequeue() called\n");
// XXX
if (event == NULL) {
error("invalid event pointer\n");
return 0;
......@@ -173,6 +176,7 @@ sched_event_dequeue(sched_event_t *event, int wait)
* woken up early if a new event comes in, so must recheck each
* time. This allows newer events to sneak in, obviously.
*/
// info("queue.c: sched_event_dequeue(): Waiting for an event\n");
while (1) {
struct timespec fireme;
int err;
......
......@@ -181,6 +181,7 @@ RPC_invoke(char *method,
int retval = 0;
va_list args;
ULXR_COUT << "Beginning call to " << method << "\n";
RPC_connect(&rcp);
va_start(args, tag);
......@@ -214,6 +215,7 @@ RPC_invoke(char *method,
RPC_disconnect(&rcp);
ULXR_COUT << "Finished with call to " << method << "\n";
return retval;
}
......@@ -228,6 +230,7 @@ RPC_invoke(char *pid, char *eid, char *method, emulab::EmulabResponse *er)
assert(method != NULL);
assert(er != NULL);
ULXR_COUT << "Beginning call to " << method << "\n";
RPC_connect(&rcp);
try
......@@ -261,6 +264,7 @@ RPC_invoke(char *pid, char *eid, char *method, emulab::EmulabResponse *er)
}
RPC_disconnect(&rcp);
ULXR_COUT << "Finished with call to " << method << "\n";
return retval;
}
......@@ -591,7 +595,7 @@ RPC_agentlist(event_handle_t handle, char *pid, char *eid)
ipaddr = (char *) tmp.getString().c_str();
tmp = agent.getItem(4);
type = (char *) tmp.getString().c_str();
info("D: adding agent %s\n", vname);
if (AddAgent(handle, vname, vnode, nodeid, ipaddr, type) < 0) {
return -1;
}
......@@ -618,8 +622,10 @@ RPC_grouplist(event_handle_t handle, char *pid, char *eid)
tmp = group.getItem(0);
groupname = (char *) tmp.getString().c_str();
info("D: \tIn GroupList() parsed name %s\n", groupname);
tmp = group.getItem(1);
agentname = (char *) tmp.getString().c_str();
info("D: \tIn GroupList() parsed agent %s\n", agentname);
if (AddGroup(handle, groupname, agentname) != 0) {
return -1;
......@@ -631,18 +637,28 @@ RPC_grouplist(event_handle_t handle, char *pid, char *eid)
int
RPC_eventlist(char *pid, char *eid,
event_handle_t handle, address_tuple_t tuple)
{
{ /* This function requests all the static events from boss using an RPC call, packing them into its
* own data structures. */
emulab::EmulabResponse er;
int i, foo = RPC_invoke(pid, eid, "experiment.event_eventlist", &er);
// XXX
// info("rpc.cc:RPC_eventlist(): Just called RPC_invoke()\n");
// XXX
if (foo)
return foo;
// XXX
// info("rpc.cc:RPC_eventlist(): calling getValue()\n");
// XXX
ulxr::Array events = (ulxr::Array)er.getValue();
// XXX
// info("rpc.cc:RPC_eventlist(): Interating over invoke results\n");
// XXX
for (i = 0; i < events.size(); i++) {
char *exidx, *extime, *objname, *objtype, *evttype, *exargs;
char *parent;
char *parent, *triggertype;
ulxr::RpcString tmp;
ulxr::Array event = (ulxr::Array)events.getItem(i);
......@@ -660,10 +676,14 @@ RPC_eventlist(char *pid, char *eid,
exargs = (char *) tmp.getString().c_str();
tmp = event.getItem(6);
parent = (char *) tmp.getString().c_str();
tmp = event.getItem(7);
triggertype = (char *) tmp.getString().c_str();
// XXX
// info("rpc.cc:RPC_eventlist(): Adding an event\n");
// XXX
if (AddEvent(handle, tuple, exidx,
extime, objname, exargs, objtype, evttype,
parent) < 0) {
parent, triggertype) < 0) {
return -1;
}
}
......
......@@ -86,7 +86,7 @@ extern int AddGroup(event_handle_t handle, char *groupname, char *agentname);
extern int AddEvent(event_handle_t handle, address_tuple_t tuple,
char *exidx, char *ftime, char *objname, char *exargs,
char *objtype, char *evttype, char *parent);
char *objtype, char *evttype, char *parent, char *triggertype);
extern int AddRobot(event_handle_t handle,
struct agent *agent,
......
......@@ -233,10 +233,12 @@ int sequence_agent_handle_complete(event_handle_t handle,
ag = seq_se->agent.m[0];
else
ag = seq_se->agent.s;
//info("Am I failing here?\n");
event_notification_get_int32(handle,
seq_se->notification,
"TOKEN",
&token);
//info("End question\n");
}
if ((ag == NULL) || (ag != agent) || (ctoken != token)) {
......
......@@ -576,6 +576,17 @@ CREATE TABLE `event_objecttypes` (
PRIMARY KEY (`idx`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Table structure for table `event_triggertypes`
--
DROP TABLE IF EXISTS `event_triggertypes`;
CREATE TABLE `event_triggertypes` (
`idx` smallint(5) unsigned NOT NULL,
`type` tinytext NOT NULL,
PRIMARY KEY (`idx`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Table structure for table `eventlist`
--
......@@ -591,6 +602,7 @@ CREATE TABLE `eventlist` (
`vname` varchar(64) NOT NULL default '',
`objecttype` smallint(5) unsigned NOT NULL default '0',
`eventtype` smallint(5) unsigned NOT NULL default '0',
`triggertype` smallint(5) unsigned NOT NULL default '0',
`isgroup` tinyint(1) unsigned default '0',
`arguments` text,
`atstring` text,
......
......@@ -567,6 +567,8 @@ REPLACE INTO table_regex VALUES ('eventlist','objecttype','int','redirect','defa
REPLACE INTO table_regex VALUES ('eventlist','eventtype','int','redirect','default:tinyint',0,0,NULL);
REPLACE INTO table_regex VALUES ('eventlist','arguments','text','redirect','default:text',0,1024,NULL);
REPLACE INTO table_regex VALUES ('eventlist','atstring','text','redirect','default:text',0,1024,NULL);
REPLACE INTO table_regex VALUES ('eventlist','triggertype','int','redirect','default:tinyint',0,0,NULL);
REPLACE INTO table_regex VALUES ('experiments','eid','text','regex','^[a-zA-Z0-9][-a-zA-Z0-9]+$',2,19,'Must ensure not too long for the database. PID is 12, and the max is 32, so the user is not allowed to specify an EID more than 19, since other parts of the system may concatenate them together with a hyphen');
REPLACE INTO table_regex VALUES ('experiments','eid_idx','text','regex','^[\\d]+$',1,12,NULL);
REPLACE INTO table_regex VALUES ('experiments','multiplex_factor','int','redirect','default:tinyint',0,0,NULL);
......@@ -976,6 +978,7 @@ REPLACE INTO table_regex VALUES ('default','tinytext_utf8','text','regex','^(?:[
REPLACE INTO table_regex VALUES ('default','text_utf8','text','regex','^(?:[\\x20-\\x7E]|[\\xC2-\\xDF][\\x80-\\xBF]|\\xE0[\\xA0-\\xBF][\\x80-\\xBF]|[\\xE1-\\xEC\\xEE\\xEF][\\x80-\\xBF]{2}|\\xED[\\x80-\\x9F][\\x80-\\xBF])*$',0,65535,'adopted from http://www.w3.org/International/questions/qa-forms-utf-8.en.php');
REPLACE INTO table_regex VALUES ('default','fulltext_utf8','text','regex','^(?:[\\x09\\x0A\\x0D\\x20-\\x7E]|[\\xC2-\\xDF][\\x80-\\xBF]|\\xE0[\\xA0-\\xBF][\\x80-\\xBF]|[\\xE1-\\xEC\\xEE\\xEF][\\x80-\\xBF]{2}|\\xED[\\x80-\\x9F][\\x80-\\xBF])*$',0,65535,'adopted from http://www.w3.org/International/questions/qa-forms-utf-8.en.php');
--
-- Dumping data for table `testsuite_preentables`
--
......@@ -1065,3 +1068,5 @@ REPLACE INTO `emulab_pubs_month_map` VALUES (23,10.5,'Oct-Nov');
REPLACE INTO `emulab_pubs_month_map` VALUES (24,11.5,'Nov-Dec');
REPLACE INTO `emulab_pubs_month_map` VALUES (25,12.5,'Dec-Jan');
REPLACE INTO event_triggertypes VALUES(0,'TIMER');
REPLACE INTO event_triggertypes VALUES(2,'SWAPOUT');
#
# CMULab Patches
#
use strict;
use libdb;
sub DoUpdate($$$)
{
my ($dbhandle, $dbname, $version) = @_;
if (!DBSlotExists("eventlist", "triggertype")) {
DBQueryFatal("ALTER TABLE eventlist ADD COLUMN ".
" `triggertype` smallint(5) unsigned NOT NULL ".
" default '0' after eventtype");
}
DBQueryFatal("REPLACE INTO table_regex VALUES" .
" ('eventlist', 'triggertype', 'int', 'redirect',
'default:tinyint', 0,0,NULL)");
if (!DBTableExists("event_triggertypes")) {
DBQueryFatal("CREATE TABLE `event_triggertypes` (" .
" `idx` smallint(5) unsigned NOT NULL," .
" `type` tinytext NOT NULL," .
" PRIMARY KEY (`idx`)" .
") ENGINE=MyISAM DEFAULT CHARSET=latin1;");
}
DBQueryFatal("REPLACE INTO event_triggertypes VALUES" .
"(0,'TIMER')");
DBQueryFatal("REPLACE INTO event_triggertypes VALUES" .
"(2,'SWAPOUT')");
return 0;
}
1;
......@@ -127,7 +127,11 @@ $EXPDIR = PROJROOT() . "/$pid/exp/$eid";
# Deal with stop and replay.
#
if ($action eq "stop" || $action eq "replay") {
if (-e $PIDFILE) {
if (-e $PIDFILE) {
# Send any swapout events and wait, at most three seconds, for them to
# complete.
system("$TB/bin/tevc -w -t 3 -e ${pid}/${eid} now __ns_swapout run");
# Send any teardown events and wait, at most five seconds, for them to
# complete.
system("$TB/bin/tevc -w -t 5 -e ${pid}/${eid} now __ns_teardown run");
......
......@@ -435,7 +435,15 @@ sub GenDefsFile($)
print TCL "set eventtypes($type) $idx\n";
}
print TCL "\n";
print TCL "# Event Trigger Types\n";
$query_result =
DBQueryFatal("select idx,type from event_triggertypes");
while (my ($idx,$type) = $query_result->fetchrow_array()) {
print TCL "set triggertypes($type) $idx\n";
}
print TCL "\n";
print TCL "# Node Types and Classes\n";
my @alltypes = NodeType->AllTypes();
foreach my $typeinfo (@alltypes) {
......
......@@ -43,6 +43,7 @@ my $TESTMODE = @TESTMODE@;
my $parser = "$TB/lib/ns2ir/parse.tcl";
my $vlib = "$TB/lib/nsverify";
my $vparser = "$TB/libexec/nsverify/nstbparse";
my $debug = 0;
# Locals
my $tempdir = "/tmp/parse-$$";
......@@ -174,7 +175,8 @@ if (! $pid) {
$nsfile = $tempdir . "/" . $nsfile;
}
exec("nice -15 $parser @ARGV $nsfile");
# exec("nice -15 $parser @ARGV $nsfile");
exec("nice -15 $parser @ARGV $nsfile|tee $tempdir/output.txt");
die("Could not exec the parser!\n");
}
......@@ -195,13 +197,18 @@ if (($exit_status & 0xff) == SIGKILL) {
undef, undef, ($nsfile));
print STDERR "$msg\n";
if (-d $tempdir) {
system("/bin/rm -r $tempdir");
unless($debug) {
if (-d $tempdir) {
system("/bin/rm -r $tempdir");
}
}
exit(15);
}
if (-d $tempdir) {
system("/bin/rm -r $tempdir");
unless($debug) {
if (-d $tempdir) {
system("/bin/rm -r $tempdir");
}
}
exit($exit_status >> 8);
......@@ -77,7 +77,13 @@ EventSequence instproc updatedb {DB} {
$self instvar error_seq
foreach event $event_list {
$sim spitxml_data "eventlist" [list "vnode" "vname" "objecttype" "eventtype" "arguments" "atstring" "parent"] [list [lindex $event 0] [lindex $event 1] $objtypes([lindex $event 2]) $eventtypes([lindex $event 3]) [lindex $event 4] [lindex $event 5] $self ]
if {[string equal [lindex $event 0] "swapout"]} {
set event [lreplace $event 0 0 0]
set triggertype "SWAPOUT"
} else {
set triggertype "TIMER"
}
$sim spitxml_data "eventlist" [list "vnode" "vname" "objecttype" "eventtype" "triggertype" "arguments" "atstring" "parent"] [list [lindex $event 0] [lindex $event 1] $objtypes([lindex $event 2]) $eventtypes([lindex $event 3]) $triggertypes($triggertype) [lindex $event 4] [lindex $event 5] $self ]
}
$sim spitxml_data "virt_agents" [list "vnode" "vname" "objecttype" ] \
......
......@@ -391,6 +391,7 @@ Simulator instproc run {} {
var_import ::GLOBALS::delay_capacity
var_import ::TBCOMPAT::objtypes
var_import ::TBCOMPAT::eventtypes
var_import ::TBCOMPAT::triggertypes
var_import ::GLOBALS::modelnet_cores
var_import ::GLOBALS::modelnet_edges
var_import ::GLOBALS::elab_in_elab
......@@ -673,11 +674,18 @@ Simulator instproc run {} {
}
foreach event $event_list {
set fields [list "time" "vnode" "vname" "objecttype" "eventtype" "arguments" "atstring" ]
set values [list [lindex $event 0] [lindex $event 1] [lindex $event 2] $objtypes([lindex $event 3]) $eventtypes([lindex $event 4]) [lindex $event 5] [lindex $event 6]]
if {[llength $event] > 7} {
if {[string equal [lindex $event 0] "swapout"]} {
set event [lreplace $event 0 0 0]
set triggertype "SWAPOUT"
} else {
set triggertype "TIMER"
}
set fields [list "time" "vnode" "vname" "objecttype" "eventtype" "arguments" "atstring" "triggertype" ]
set values [list [lindex $event 0] [lindex $event 1] [lindex $event 2] $objtypes([lindex $event 3]) $eventtypes([lindex $event 4]) [lindex $event 5] [lindex $event 6] $triggertypes($triggertype)]
if {[llength $event] > 8} {
lappend fields "parent"
lappend values [lindex $event 7]
lappend values [lindex $event 8]
}
$self spitxml_data "eventlist" $fields $values
}
......@@ -741,6 +749,7 @@ Simulator instproc attach-agent {node agent} {
Simulator instproc agentinit {agent} {
var_import ::TBCOMPAT::objtypes
var_import ::TBCOMPAT::eventtypes
var_import ::TBCOMPAT::triggertypes
if {[$agent info class Application/Traffic/CBR]} {
$self spitxml_data "eventlist" [list "time" "vnode" "vname" "objecttype" "eventtype" "arguments" "atstring" "parent" ] [list "0" [$agent get_node] $agent $objtypes(TRAFGEN) $eventtypes(MODIFY) [$agent get_params] "" "__ns_sequence"]
......@@ -799,12 +808,18 @@ Simulator instproc at {time eventstring} {
return
}
set ptime [::GLOBALS::reltime-to-secs $time]
if {$ptime == -1} {
perror "Invalid time spec: $time"
return
if {[string equal $time "swapout"]} {
# "swapout" will be preserved as the time until we're at a point
# where we can shunt it into a code path where it changes the
# trigger type.
} else {
set ptime [::GLOBALS::reltime-to-secs $time]
if {$ptime == -1} {
perror "Invalid time spec: $time"
return
}
set time $ptime
}
set time $ptime
$self instvar event_list
$self instvar event_count
......
......@@ -103,6 +103,7 @@ namespace eval TBCOMPAT {
# A mapping of event objects and types.
variable objtypes
variable eventtypes
variable triggertypes
# Existing (reserved nodes).
variable reserved_list
......
......@@ -80,7 +80,13 @@ EventTimeline instproc updatedb {DB} {
$self instvar event_list
foreach event $event_list {
$sim spitxml_data "eventlist" [list "time" "vnode" "vname" "objecttype" "eventtype" "arguments" "atstring" "parent"] [list [lindex $event 0] [lindex $event 1] [lindex $event 2] $objtypes([lindex $event 3]) $eventtypes([lindex $event 4]) [lindex $event 5] [lindex $event 6] $self ]
if {[string equal [lindex $event 0] "swapout"]} {
set event [lreplace $event 0 0 0]
set triggertype "SWAPOUT"
} else {
set triggertype "TIMER"
}
$sim spitxml_data "eventlist" [list "time" "vnode" "vname" "objecttype" "eventtype" "triggertype" "arguments" "atstring" "parent"] [list [lindex $event 0] [lindex $event 1] [lindex $event 2] $objtypes([lindex $event 3]) $eventtypes([lindex $event 4]) $triggertypes($triggertype) [lindex $event 5] [lindex $event 6] $self ]
}
$sim spitxml_data "virt_agents" [list "vnode" "vname" "objecttype" ] \
......
......@@ -594,6 +594,13 @@ namespace eval GLOBALS {
while { $vname != {} } {
foreach event $event_list($vname) {
if {[string equal [lindex $event 0] "swapout"]} {
set event [lreplace $event 0 0 0]
set triggertype "SWAPOUT"
} else {
set triggertype "TIMER"
}
set fields [list "time" "vnode" "vname" "objecttype" "eventtype" "arguments" "atstring" "triggertype" ]
real_set time [lindex $event 0]
real_set otype [lindex $event 1]
......@@ -628,7 +635,7 @@ namespace eval GLOBALS {
real_set virt_agents_list($agt) {}
}
}
$sim spitxml_data "eventlist" [list "time" "vnode" "vname" "objecttype" "eventtype" "arguments" "atstring" ] [list $time $pnode [$vname set objname] $otype $etype $args $atstring]
$sim spitxml_data "eventlist" [list "time" "vnode" "vname" "objecttype" "eventtype" "triggertype" "arguments" "atstring" ] [list $time $pnode [$vname set objname] $otype $etype $triggertype $args $atstring]
}
real_set vname [array nextelement event_list $searchid]
......
......@@ -3117,20 +3117,22 @@ class experiment:
#
result = []
res = DBQuery("select ex.idx,ex.time,ex.vname,"
" ot.type,et.type,ex.arguments,ex.parent "
"from eventlist as ex "
"left join event_eventtypes as et on "
res = DBQuery("SELECT ex.idx,ex.time,ex.vname,"
"ot.type,et.type,ex.arguments,ex.parent,etr.type "
"FROM eventlist AS ex "
"LEFT JOIN event_triggertypes AS etr ON "
"ex.triggertype=etr.idx "
"LEFT JOIN event_eventtypes AS et ON "
" ex.eventtype=et.idx "
"left join event_objecttypes as ot on "
"LEFT JOIN event_objecttypes AS ot ON "
" ex.objecttype=ot.idx "
"where ex.pid=%s and ex.eid=%s and ot.type!='TIME' "
"order by ex.time,ex.idx ASC",
"WHERE ex.pid=%s AND ex.eid=%s AND ot.type!='TIME' "
"ORDER BY ex.time,ex.idx ASC",
(argdict["proj"], argdict["exp"]))
for event in res:
result.append((str(event[0]), str(event[1]), event[2],
event[3], event[4], event[5], event[6]));
event[3], event[4], event[5], event[6], event[7]));
pass
res = DBQuery("select n.phys_nodeid,i.IP from reserved as r "
......@@ -3193,7 +3195,7 @@ class experiment:
"",
"__ns_teardown"))
pass
return EmulabResponse(RESPONSE_SUCCESS, value=result)
def event_time_start(self, version, argdict):
......
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