Commit 560f8ab6 authored by Timothy Stack's avatar Timothy Stack

Add a "-s" option to the sync action that sends a SNAPSHOT event to

all of the active link trace agents.  Update the manpage.
parent cd5fe1a6
.\"
.\" EMULAB-COPYRIGHT
.\" Copyright (c) 2004, 2005 University of Utah and the Flux Group.
.\" Copyright (c) 2004, 2005, 2006 University of Utah and the Flux Group.
.\" All rights reserved.
.\"
.TH LOGHOLE 1 "June 16, 2005" "Emulab" "Emulab Commands Manual"
......@@ -18,7 +18,7 @@ loghole \- Log management tool for experiments.
.P
.BI loghole
.BI sync
[\fB-n\fR]
[\fB-nPs\fR]
[\fB-r \fIremotedir\fR]
[\fB-l \fIlocaldir\fR]
[\fInode1 node2 ...\fR]
......@@ -66,7 +66,9 @@ loghole \- Log management tool for experiments.
The
.B loghole
utility downloads log files from certain directories on the experimental nodes
(e.g. "/local/logs") to the Emulab users machine. After downloading, it can
(e.g. "/local/logs") to the Emulab
.I users
machine. After downloading, it can
also be used to produce and manage archives of the log files. Using this
utility to manage an experiment's log files is encouraged because it will
transfer the logs in a network-friendly manner and is already integrated with
......@@ -209,8 +211,21 @@ log directory on the Emulab users machine. The action will iterate through
each node in the experiment and perform an rsync(1) on the loghole directories
for that node. Currently, the default set of directories that will be synced are "/var/emulab/logs"
and "/local/logs". In addition, if any of the network links in the experiment
are being traced, the utility will create a directory for each link and setup
symbolic links to the pcap(3) files retrieved from the delay nodes.
are being traced,
.B loghole
will perform the following extra steps:
.TP
1.
Create a directory for each link.
.TP
2.
Setup symbolic links to the pcap(3) files retrieved from the delay nodes.
.TP
3.
Run the pre-shaped pcap(3) files (e.g. .recv.0) through tcptrace(1) to generate
graphs viewable with xplot(1). Note that the processing will only be done for
pcap files that were generated by a SNAPSHOT event sent to the tracemon agent.
The "-s" option is provided to automatically send this event for each agent.
.P
Optional arguments:
.TP
......@@ -226,6 +241,15 @@ experiment's log directory.
Flag that indicates that the standard logholes (i.e. "/var/emulab/logs",
"/local/logs") should not be downloaded.
.TP
\fB-P\fR, \fB--no-post
Do not do any additional post-processing of the log files. Currently, the only
post-processing is done on the pcap files generated by the link trace agents.
.TP
\fB-s\fR, \fB--snapshot
Send a SNAPSHOT event to the link trace agents before syncing the logfiles.
This is mostly a convenience so you do not have to remember to send the event
before gathering the files.
.TP
.I node1 ...
Specify a subset of virtual or physical nodes that should be synchronized,
otherwise all of the nodes will be synchronized.
......@@ -439,6 +463,13 @@ The log directory for a traced LAN or link. The symbolic links in these
directories refer to the pcap(3) files for a node connected to this LAN or
link.
.TP
/proj/\fIpid\fR/exp/\fIeid\fR/logs/\fIlink\fR/__all.recv.0
The pcap(3) file that contains a merge of all the pre-shaped packets captured
by the link trace agents on this LAN or link.
.TP
/proj/\fIpid\fR/exp/\fIeid\fR/logs/\fIlink\fR/*.xpl
The output of "tcptrace -G" on the __all.recv.0 file.
.TP
/local/logs
One of the log directories on experimental nodes that is automatically sync'd.
Users should place any logs/data they want transferred back in this directory.
......@@ -448,7 +479,8 @@ Another log directory on experimental nodes that is automatically sync'd. This
directory usually holds logs generated by the Emulab software running on the
node.
.SH SEE ALSO
event-sched(8), tevc(1), zip(1), rsync(1), pcap(3)
event-sched(8), tevc(1), zip(1), rsync(1), pcap(3), mergecap(1), tcptrace(1),
xplot(1)
.SH AUTHOR
The Emulab project at the University of Utah.
.SH NOTES
......
......@@ -30,6 +30,8 @@ if TBPATH not in sys.path:
sys.path.append(TBPATH)
pass
from tbevent import *
PACKAGE_VERSION = 0.1
# Default server
......@@ -255,7 +257,7 @@ def usage():
# Print the usage statement for the "sync" action.
#
def sync_usage():
print "Usage: loghole sync [-n] [-r remotedir] [-l localdir] [node1 ...]"
print "Usage: loghole sync [-nPs] [-r remotedir] [-l localdir] [node1 ...]"
print
print "Synchronize the experiment's log holes with a local directory."
print
......@@ -273,6 +275,8 @@ def sync_usage():
print " be downloaded."
print " -P, --no-post"
print " Do not do any additional post processing."
print " -s, --snapshot"
print " Send a SNAPSHOT event to any link trace agents."
print " node1 ... The names of the virtual or physical nodes that "
print " should be synced. The default behavior is to sync "
print " all of the nodes in an experiment."
......@@ -1027,6 +1031,51 @@ def print_job_status(hosts, jobs, hoststatus, hoststart):
return
##
# Trace preprocessing.
#
# @param traces Sequence of dictionaries describing the active link tracers.
#
def trace_pre(traces):
at = address_tuple()
at.eventtype = "SNAPSHOT"
at.expt = "%s/%s" % (PID, EID)
at.scheduler = 1
tv = timeval()
tv.tv_sec = int(time.time())
notified = {}
ec = EventClient(server="event-server",
keyfile=os.path.join("/proj", PID, "exp", EID,
"tbdata", "eventkey"))
for trace in traces:
if trace["trace_type"] == "monitor":
continue
lvn = trace["linkvname"]
if lvn not in notified:
at.objname = "%s-tracemon" % (lvn,)
en = ec.create_notification(at)
ec.schedule(en, tv)
notified[lvn] = 1
pass
pass
if len(notified) > 0:
time.sleep(1)
pass
return
##
# Trace post processing
#
# @param link2trace Dictionary containing the link names that map to a sequence
# of dictionaries containing individual trace information.
#
def trace_post(link2trace):
lpc = 1
for linkvname in link2trace.keys():
......@@ -1049,9 +1098,19 @@ def trace_post(link2trace):
print_status(".")
os.system("mergecap -w %s %s" % (dst, " ".join(args[ext])))
print_status(".")
if ext != ".0":
if not os.path.exists(ext[1:]):
os.mkdir(ext[1:])
pass
os.chdir(ext[1:])
dst = os.path.join(os.path.pardir, dst)
pass
os.system("tcptrace -G %s > .tcptrace.out" % (dst,))
print_status("\r")
if ext != ".0":
os.chdir(os.path.pardir)
pass
pass
print_status("\r")
os.chdir(os.path.pardir)
lpc += 1
pass
......@@ -1077,11 +1136,12 @@ def do_sync(args, mode="sync", must_be_active=1):
logdir = os.path.join(EXPDIR_FMT % { "PID" : PID, "EID" : EID }, "logs")
standard_logholes = True
snapshot_traces = False
post_process = True
extra_logholes = []
try:
opts, node_list = getopt.getopt(args, "nl:r:P", [
opts, node_list = getopt.getopt(args, "nl:r:Ps", [
"no-standard", "local=", "remote=",
])
for opt, val in opts:
......@@ -1101,6 +1161,9 @@ def do_sync(args, mode="sync", must_be_active=1):
elif opt in ("-r", "--remote"):
extra_logholes.append(val)
pass
elif opt in ("-s", "--snapshot"):
snapshot_traces = True
pass
pass
pass
except getopt.error, e:
......@@ -1183,6 +1246,10 @@ def do_sync(args, mode="sync", must_be_active=1):
physical = physical["value"]
traces = traces["value"]
ssh_data = ssh_data["value"]
if snapshot_traces:
trace_pre(traces)
pass
hosts = [(x["node"], x["name"]) for x in physical.values()
if ((x["erole"] == "virthost" or
......
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