Commit d59ad976 authored by Jonathon Duerig's avatar Jonathon Duerig

Merge branch 'master' of git-public.flux.utah.edu:/flux/git/emulab-devel

parents 274ecd5e 8f3eae23
......@@ -584,8 +584,8 @@ bool populate_links(DOMElement *root, tb_pgraph &pg, tb_sgraph &sg,
tb_plink *phys_link =
new tb_plink(componentId.c_str(),
tb_plink::PLINK_NORMAL, str_first_type.c_str(),
srcMac.c_str(), dstMac.c_str(),
shortNames[src_iface], shortNames[dst_iface]);
src_pnode->name, srcMac.c_str(), shortNames[src_iface],
dst_pnode->name, dstMac.c_str(), shortNames[dst_iface]);
phys_link->delay_info.bandwidth = bandwidth;
phys_link->delay_info.delay = latency;
......
......@@ -269,8 +269,8 @@ int parse_ptop(tb_pgraph &pg, tb_sgraph &sg, istream& input)
for (int cur = 0;cur<num;++cur) {
pedge pe = (add_edge(srcv,dstv,pg)).first;
tb_plink *pl = new
tb_plink(name,tb_plink::PLINK_NORMAL,link_type,srcmac,dstmac,
srciface,dstiface);
tb_plink(name,tb_plink::PLINK_NORMAL,link_type,srcnode->name,srcmac,
srciface,dstnode->name,dstmac,dstiface);
put(pedge_pmap,pe,pl);
pl->delay_info.bandwidth = ibw;
pl->delay_info.delay = idelay;
......
......@@ -407,8 +407,9 @@ bool populate_links(DOMElement *root, tb_pgraph &pg, tb_sgraph &sg) {
// other stuff if I remove them... bummer!
tb_plink *phys_link =
new tb_plink(name.c(), tb_plink::PLINK_NORMAL, str_first_type,
"(null)", "(null)", src_iface.c(), dst_iface.c());
src_pnode->name, "(null)", src_iface.c(),
dst_pnode->name, "(null)", dst_iface.c());
phys_link->delay_info.bandwidth = bandwidth.i();
phys_link->delay_info.delay = latency.i();
phys_link->delay_info.loss = packet_loss.d();
......
......@@ -360,10 +360,11 @@ public:
typedef enum {PLINK_NORMAL,PLINK_INTERSWITCH,PLINK_LAN} plinkType;
typedef hash_set<fstring> type_set;
tb_plink(fstring _name, plinkType _is_type, fstring _type, fstring _srcmac, fstring
_dstmac, fstring _srciface, fstring _dstiface)
tb_plink(fstring _name, plinkType _is_type, fstring _type, fstring _srcnode, fstring _srcmac,
fstring _srciface, fstring _dstnode, fstring _dstmac, fstring _dstiface)
: name(_name), srcmac(_srcmac), dstmac(_dstmac), is_type(_is_type),
srciface(_srciface), dstiface(_dstiface),
srcnode(_srcnode), dstnode(_dstnode),
delay_info(), bw_used(0), emulated(0), nonemulated(0),
penalty(0.0), fixends(false), current_endpoints(), current_count(0),
vedge_counts() {
......@@ -371,6 +372,7 @@ public:
}
fstring name; // the name
fstring srcnode,dstnode; // source and destination node names
fstring srcmac,dstmac; // source and destination MAC addresses.
fstring srciface, dstiface; // source and destination interface names
......
......@@ -60,7 +60,7 @@ extern tb_sgraph SG; // switch fabric
void score_link(pedge pe,vedge ve,tb_pnode *src_pnode,tb_pnode *dst_pnode);
void unscore_link(pedge pe,vedge ve,tb_pnode *src_pnode,tb_pnode *dst_pnode);
bool find_best_link(pvertex pv,pvertex switch_pv,tb_vlink *vlink,
pedge &out_edge, bool flipped, bool check_src_iface,
pedge &out_edge, bool check_src_iface,
bool check_dst_iface);
int find_interswitch_path(pvertex src_pv,pvertex dest_pv,
int bandwidth,pedge_path &out_path,
......@@ -250,13 +250,25 @@ float find_link_resolutions(resolution_vector &resolutions, pvertex pv,
pedge pe;
// Direct link (have to check both interfaces if they are fixed)
if (find_best_link(dest_pv,pv,vlink,pe,flipped,true,true)) {
if (find_best_link(dest_pv,pv,vlink,pe,true,true)) {
tb_link_info info(tb_link_info::LINK_DIRECT);
info.plinks.push_back(pe);
resolutions.push_back(info);
total_weight += LINK_RESOLVE_DIRECT;
SDEBUG(cerr << " added a direct_link " << pe << endl);
}
/*
* IMPORTANT NOTE ABOUT find_best_link -
*
* We have to tell it whether it is supposed to check the source of the
* vlink, the dest of the vlink, or both, for fixed interfaces. Of course, we
* only want to check the 'node' side, not the switch side, of interswitch
* and intraswitch paths. Of course, which end we're looking at depends on
* the order we're traversing the vlink - the flipped variable. This is why
* you see 'flipped' and '!flipped' passed to find_best_link() below.
*/
// Intraswitch link
pedge first,second;
for (pvertex_set::iterator switch_it = pnode->switches.begin();
......@@ -291,9 +303,8 @@ float find_link_resolutions(resolution_vector &resolutions, pvertex pv,
if (first_link) {
SDEBUG(cerr << " intraswitch: finding first link" << endl;)
// Check only whether the source interface is fixed - this is the
// first link in a multi-hop path
if (!find_best_link(pv,*switch_it,vlink,first,flipped,true,false)) {
// See note above
if (!find_best_link(pv,*switch_it,vlink,first,!flipped,flipped)) {
SDEBUG(cerr << " intraswitch failed - no link first" <<
endl;)
// No link to this switch
......@@ -302,11 +313,9 @@ float find_link_resolutions(resolution_vector &resolutions, pvertex pv,
}
if (second_link) {
// Check only whether the dest interface is fixed - this is the
// last link in a multi-hop path
SDEBUG(cerr << " intraswitch: finding second link (" << ")" << endl;)
if (!find_best_link(dest_pv,*switch_it,vlink,second,!flipped,
false,true)) {
// See note above
if (!find_best_link(dest_pv,*switch_it,vlink,second,flipped,!flipped)) {
// No link to this switch
SDEBUG(cerr << " intraswitch failed - no link second" <<
endl;)
......@@ -375,10 +384,8 @@ float find_link_resolutions(resolution_vector &resolutions, pvertex pv,
// Get link objects
if (first_link) {
// Check only whether the source interface is fixed - this is the
// first link in a multi-hop path
if (!find_best_link(pv,*source_switch_it,vlink,first,flipped,
true,false)) {
// See note above
if (!find_best_link(pv,*source_switch_it,vlink,first,!flipped,flipped)) {
// No link to this switch
SDEBUG(cerr << " interswitch failed - no first link"
<< endl;)
......@@ -387,11 +394,9 @@ float find_link_resolutions(resolution_vector &resolutions, pvertex pv,
}
if (second_link) {
// Check only whether the dest interface is fixed - this is the
// last link in a multi-hop path
if (!find_best_link(dest_pv,*dest_switch_it,vlink,second,!flipped,
false,true)) {
// No link to tshis switch
// See note above
if (!find_best_link(dest_pv,*dest_switch_it,vlink,second,flipped,!flipped)) {
// No link to this switch
SDEBUG(cerr << " interswitch failed - no second link" << endl;)
continue;
}
......@@ -1483,8 +1488,19 @@ int add_node(vvertex vv,pvertex pv, bool deterministic, bool is_fixed, bool skip
return 0;
}
/*
* Find the best link between two physical nodes, making sure it matches the
* requirements of the given vlink. Returns results in the out_edge parameter
* NOTE: assumes the caller has done enough bookkeeping to know whether the
* source and dest interfaces need to be checked for fixed interfaces - that
* is: check_src_iface should be set if:
* this is a direct link OR
* we're mapping the end of an inter or intra switch link that connects to
* the 'source' vnode in the vlink structure
* Similar rules apply to check_dst_iface
*/
bool find_best_link(pvertex pv,pvertex switch_pv,tb_vlink *vlink,
pedge &out_edge, bool flipped, bool check_src_iface,
pedge &out_edge, bool check_src_iface,
bool check_dst_iface)
{
pvertex dest_pv;
......@@ -1507,58 +1523,62 @@ bool find_best_link(pvertex pv,pvertex switch_pv,tb_vlink *vlink,
continue;
}
// XXX: Not 100% sure it's better to do this inside find_best_link rather
// than in the caller
if (flipped) {
// If the endpoints are flipped, then we need to flip our notion of
// which ones need to be compared.
bool tmp = check_src_iface;
check_src_iface = check_dst_iface;
check_dst_iface = tmp;
SDEBUG(cerr << " find_best_link: flipping interface comparisons" << endl;)
}
SDEBUG(cerr << " find_best_link: fix_src_iface = " <<
vlink->fix_src_iface << " check_src_iface = " << check_src_iface
<< " fix_dst_iface = " << vlink->fix_dst_iface
<< " check_dst_iface = " << check_dst_iface
<< " flipped = " << flipped << endl);
<< " check_dst_iface = " << check_dst_iface << endl;)
// Whether we check the 'source' or 'destination' on the vlink against
// the phyisical link's source interface depends on whether the
// interface order in the in the pedge matches the interface order in
// the vlink
bool plink_order_reversed;
tb_vnode *src_vnode = get(vvertex_pmap,vlink->src);
tb_pnode *src_pnode = get(pvertex_pmap,src_vnode->assignment);
if (src_pnode->name != plink->srcnode) {
SDEBUG(cerr << " find_best_link: plink and vlink in " <<
"different order (" << src_pnode->name << " != " <<
plink->srcnode << ")" << endl;)
plink_order_reversed = true;
} else {
SDEBUG(cerr << " find_best_link: plink and vlink in " <<
"same order (" << src_pnode->name << " == " <<
plink->srcnode << ")" << endl;)
plink_order_reversed = false;
}
// If the vlink has a fixed source interface, and it doesn't match
// this plink, skip it
if (vlink->fix_src_iface && check_src_iface) {
// Whether we check the 'source' or 'destination' on the vlink against
// the phyisical link's source interface depends on whether we're
// traversing the link if forward or reverse (flipped) order
// fstring compare_iface = vlink->src_iface;
fstring compare_iface = (flipped? vlink->dst_iface : vlink->src_iface);
if (plink->srciface != compare_iface) {
// The interface name we compare to on the plink depends on wether it
// goes in the same 'direction' as the vlink
fstring compare_iface = (plink_order_reversed? plink->dstiface : plink->srciface);
if (vlink->src_iface != compare_iface) {
SDEBUG(cerr << " find_best_link (" << vlink->name <<
"): Fix source: " << plink->srciface << " != " <<
"): Fix source: " << vlink->src_iface << " != " <<
compare_iface << endl);
continue;
} else {
SDEBUG(cerr << " find_best_link (" << vlink->name <<
"): Fix source: " << plink->srciface << " == " <<
"): Fix source: " << vlink->src_iface << " == " <<
compare_iface << endl);
}
}
// Same for destination
// Yes, this really is srciface
// XXX: This only works because we always have the node as the 'source'
// of a plink! Shouldn't depend on this!
if (vlink->fix_dst_iface && check_dst_iface) {
// fstring compare_iface = vlink->dst_iface;
fstring compare_iface = (flipped? vlink->src_iface : vlink->dst_iface);
if (plink->srciface != compare_iface) {
// The interface name we compare to on the plink depends on wether it
// goes in the same 'direction' as the vlink
fstring compare_iface = (plink_order_reversed? plink->srciface : plink->dstiface);
if (vlink->dst_iface != compare_iface) {
SDEBUG(cerr << " find_best_link (" << vlink->name <<
"): Fix dst: " << plink->srciface << " != " <<
"): Fix dst: " << vlink->dst_iface << " != " <<
compare_iface << endl);
continue;
} else {
SDEBUG(cerr << " find_best_link (" << vlink->name <<
"): Fix dst: " << plink->srciface << " == " <<
"): Fix dst: " << vlink->dst_iface << " == " <<
compare_iface << endl);
}
}
......
......@@ -51,6 +51,7 @@ use libdb;
use libtestbed;
use User;
use Project;
use OSinfo;
use Image;
use Node;
......
......@@ -52,6 +52,7 @@ use libtestbed;
use User;
use Project;
use Image;
use OSinfo;
use Node;
# Protos
......
......@@ -274,22 +274,22 @@ sub TB_NODEACCESS_LOADIMAGE() { 3; }
sub TB_NODEACCESS_REBOOT() { 4; }
sub TB_NODEACCESS_POWERCYCLE() { 5; }
sub TB_NODEACCESS_MODIFYVLANS() { 6; }
sub TB_NODEACCESS_MIN() { TB_NODEACCESS_READINFO; }
sub TB_NODEACCESS_MAX() { TB_NODEACCESS_MODIFYVLANS; }
sub TB_NODEACCESS_MIN() { TB_NODEACCESS_READINFO(); }
sub TB_NODEACCESS_MAX() { TB_NODEACCESS_MODIFYVLANS(); }
# User Info (modinfo web page, etc).
sub TB_USERINFO_READINFO() { 1; }
sub TB_USERINFO_MODIFYINFO() { 2; }
sub TB_USERINFO_MIN() { TB_USERINFO_READINFO; }
sub TB_USERINFO_MAX() { TB_USERINFO_MODIFYINFO; }
sub TB_USERINFO_MIN() { TB_USERINFO_READINFO(); }
sub TB_USERINFO_MAX() { TB_USERINFO_MODIFYINFO(); }
# Experiments.
sub TB_EXPT_READINFO() { 1; }
sub TB_EXPT_MODIFY() { 2; }
sub TB_EXPT_DESTROY() { 3; }
sub TB_EXPT_UPDATE() { 4; }
sub TB_EXPT_MIN() { TB_EXPT_READINFO; }
sub TB_EXPT_MAX() { TB_EXPT_UPDATE; }
sub TB_EXPT_MIN() { TB_EXPT_READINFO(); }
sub TB_EXPT_MAX() { TB_EXPT_UPDATE(); }
# Projects.
sub TB_PROJECT_READINFO() { 1; }
......@@ -306,15 +306,15 @@ sub TB_PROJECT_DELOSID() { 11; }
sub TB_PROJECT_MAKEIMAGEID() { 12; }
sub TB_PROJECT_DELIMAGEID() { 13; }
sub TB_PROJECT_CREATEEXPT() { 14; }
sub TB_PROJECT_MIN() { TB_PROJECT_READINFO; }
sub TB_PROJECT_MAX() { TB_PROJECT_CREATEEXPT; }
sub TB_PROJECT_MIN() { TB_PROJECT_READINFO(); }
sub TB_PROJECT_MAX() { TB_PROJECT_CREATEEXPT(); }
# OSIDs
sub TB_OSID_READINFO() { 1; }
sub TB_OSID_CREATE() { 2; }
sub TB_OSID_DESTROY() { 3; }
sub TB_OSID_MIN() { TB_OSID_READINFO; }
sub TB_OSID_MAX() { TB_OSID_DESTROY; }
sub TB_OSID_MIN() { TB_OSID_READINFO(); }
sub TB_OSID_MAX() { TB_OSID_DESTROY(); }
sub TB_OSID_OSIDLEN() { 35; }
sub TB_OSID_OSNAMELEN() { 20; }
sub TB_OSID_VERSLEN() { 12; }
......@@ -337,15 +337,15 @@ sub TB_IMAGEID_MODIFYINFO() { 2; }
sub TB_IMAGEID_CREATE() { 3; }
sub TB_IMAGEID_DESTROY() { 4; }
sub TB_IMAGEID_ACCESS() { 5; }
sub TB_IMAGEID_MIN() { TB_IMAGEID_READINFO; }
sub TB_IMAGEID_MAX() { TB_IMAGEID_ACCESS; }
sub TB_IMAGEID_MIN() { TB_IMAGEID_READINFO(); }
sub TB_IMAGEID_MAX() { TB_IMAGEID_ACCESS(); }
sub TB_IMAGEID_IMAGEIDLEN() { 45; }
sub TB_IMAGEID_IMAGENAMELEN() { 30; }
# Node Log Types
sub TB_NODELOGTYPE_MISC { "misc"; }
sub TB_NODELOGTYPES() { ( TB_NODELOGTYPE_MISC ) ; }
sub TB_DEFAULT_NODELOGTYPE() { TB_NODELOGTYPE_MISC; }
sub TB_NODELOGTYPES() { ( TB_NODELOGTYPE_MISC() ) ; }
sub TB_DEFAULT_NODELOGTYPE() { TB_NODELOGTYPE_MISC(); }
# Node History Stuff.
sub TB_NODEHISTORY_OP_FREE { "free"; }
......@@ -355,7 +355,7 @@ sub TB_NODEHISTORY_OP_MOVE { "move"; }
# Reload Types.
sub TB_RELOADTYPE_NETDISK() { "netdisk"; }
sub TB_RELOADTYPE_FRISBEE() { "frisbee"; }
sub TB_DEFAULT_RELOADTYPE() { TB_RELOADTYPE_FRISBEE; }
sub TB_DEFAULT_RELOADTYPE() { TB_RELOADTYPE_FRISBEE(); }
# Experiment priorities.
sub TB_EXPTPRIORITY_LOW() { 0; }
......@@ -532,7 +532,7 @@ sub TBDB_SECLEVEL_ORANGE() { 3; }
sub TBDB_SECLEVEL_RED() { 4; }
# This is the level at which we get extremely cautious when swapping out
sub TBDB_SECLEVEL_ZAPDISK() { TBDB_SECLEVEL_YELLOW; }
sub TBDB_SECLEVEL_ZAPDISK() { TBDB_SECLEVEL_YELLOW(); }
#
# A hash of all tables that contain information about physical nodes - the
......
......@@ -186,11 +186,11 @@ sub mysystem($)
{
my ($command) = @_;
my $cwd;
chomp($cwd = `/bin/pwd`);
print STDERR "Running '$command' in $cwd\n"
if (0);
if (0) {
my $cwd;
chomp($cwd = `/bin/pwd`);
print STDERR "Running '$command' in $cwd\n";
}
return system($command);
}
......@@ -1437,7 +1437,7 @@ sub GetProject($)
my $project = Project->Lookup($self->pid_idx());
if (! defined($project)) {
print("*** WARNING: Could not lookup project object for $self!", 1);
print("*** WARNING: Could not lookup project object for $self!\n");
return undef;
}
return $project;
......
......@@ -416,8 +416,16 @@ sub Create($$$$)
my $hostname = $argref->{'hostname'};
my $external = $argref->{'external_node_id'};
my $IP = $argref->{'IP'};
if (!DBQueryWarn("replace into widearea_nodeinfo ".
# Hmm, wanodecreate already does this.
my $wa_result =
DBQueryWarn("select node_id from widearea_nodeinfo ".
"where node_id='$node_id'");
goto bad
if (!$wa_result);
if ($wa_result->numrows == 0 &&
!DBQueryWarn("replace into widearea_nodeinfo ".
" (node_id, contact_uid, contact_idx, hostname," .
" external_node_id, IP) ".
" values ('$node_id', 'nobody', '0', ".
......@@ -1667,9 +1675,9 @@ sub SetEventState($$)
# be used when creating the new node(s). A list of the node names is
# returned.
#
sub CreateVnodes($$)
sub CreateVnodes($$$)
{
my ($rptr, $options) = @_;
my ($class, $rptr, $options) = @_;
my @created = ();
my @tocreate = ();
require Interface;
......
......@@ -139,7 +139,7 @@ client-install: client
fi
$(INSTALL_PROGRAM) $(DAEMON) $(DESTDIR)$(CLIENT_BINDIR)/$(DAEMON)
$(INSTALL_PROGRAM) $(LTEVENT) $(DESTDIR)$(CLIENT_BINDIR)/$(LTEVENT)
$(INSTALL_PROGRAM) $(SCRIPT) $(DESTDIR)$(CLIENT_BINDIR)/$(SCRIPT)
$(INSTALL_PROGRAM) $(SRCDIR)/$(SCRIPT) $(DESTDIR)$(CLIENT_BINDIR)/$(SCRIPT)
$(INSTALL_PROGRAM) $(SCRIPT_ELAB) $(DESTDIR)$(CLIENT_BINDIR)/$(SCRIPT_ELAB)
$(INSTALL_PROGRAM) $(SCRIPT_RUN) $(DESTDIR)$(CLIENT_BINDIR)/$(SCRIPT_RUN)
$(MAKE) -C iperf client-install
......
#!/usr/bin/perl -w -T
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
# Copyright (c) 2000-2010 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -2493,6 +2493,7 @@ sub sim_event {
system($PATH_TEVC,
"-e", "$proj_id/$exp_id",
"-k", $PATH_KEYFILE,
"now",
$simname,
"$event",
......@@ -2511,6 +2512,7 @@ sub sim_event2 {
system($PATH_TEVC,
"-e", "$proj_id/$exp_id",
"-k", $PATH_KEYFILE,
"now",
$simname,
"$event",
......
......@@ -3,7 +3,7 @@
# Start the network....
#
udhcpc_opts="-q"
udhcpc_opts="-q -O staticroutes"
if [ -f /etc/emulab/paths.sh ]; then
. /etc/emulab/paths.sh
......@@ -22,6 +22,7 @@ parse_cached_pxe_lease() {
local routers=""
local nameservers=""
local hostname=""
local classless_routes=""
local mac=""
local iface=""
local ifcfg_opts=""
......@@ -35,6 +36,8 @@ parse_cached_pxe_lease() {
case $key in
OPT_BROADCAST_ADDRESS)
broadcast="$value"; ;;
OPT_CLASSLESS_ROUTES)
classless_routes="$value"; ;;
OPT_SUBNET_MASK)
netmask="$value"; ;;
OPT_HOST_NAME)
......@@ -89,6 +92,16 @@ parse_cached_pxe_lease() {
echo "adding default route via $gw"
/sbin/route add default gw $gw dev $iface
done
if [ -n "$classless_routes" ]; then
echo "creating static routes"
for route in $classless_routes; do
dest=${route%%:*}
gw=${route##*:}
/sbin/route add -net $dest gw $gw
done
fi
echo -n > /etc/resolv.conf
if [ -n "$domain" ]; then
......
......@@ -47,6 +47,14 @@ case "$1" in
done
fi
if [ -n "$staticroutes" ] ; then
echo "creating static routes"
echo $staticroutes | while read dest router; do
route add -net $dest gw $router
done
fi
echo -n > $RESOLV_CONF
[ -n "$domain" ] && echo search $domain >> $RESOLV_CONF
for i in $dns ; do
......
......@@ -2268,7 +2268,7 @@ sub SliverWorkAux($$$$$$$)
#
if ($node->isvirtnode()) {
$vnode = $node;
$node = GeniUtil::LookupNode($nodesliver->resource_id());
$node = GeniUtil::LookupNode($vnode->phys_nodeid());
if (!defined($node)) {
$message = "Could not find node object for $nodesliver";
goto bad;
......
......@@ -49,6 +49,7 @@ require GeniCertificate;
require GeniAuthority;
require GeniSlice;
require GeniUser;
require GeniComponent;
my $authority = GeniAuthority->Lookup($uuid);
if (!defined($authority)) {
......
......@@ -232,11 +232,7 @@ if (!defined($certificate)) {
" Could not get uuid from $EMULAB_PEMFILE\n");
}
$ENV{'MYUUID'} = $certificate->uuid();
# The URN could also come from the certificate, and that might be preferable
# in some ways (if anybody is doing something silly like authenticating
# with somebody else's certificate). But that would require everybody to
# upgrade to URNs in their certificates, so we can't assume it yet.
$ENV{'MYURN'} = "urn:publicid:IDN+@OURDOMAIN@+authority+$MODULE";
$ENV{'MYURN'} = $certificate->urn();
#
# Create and set our RPC context for any calls we end up making.
......
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2009 University of Utah and the Flux Group.
# Copyright (c) 2000-2010 University of Utah and the Flux Group.
# All rights reserved.
#
use English;
......@@ -1713,7 +1713,7 @@ foreach my $pnode (sort(keys(%virtnodes))) {
#
# Call into library. Be sure to pass impotent mode along.
#
if (Node::CreateVnodes(\@plist,
if (Node->CreateVnodes(\@plist,
{"pid" => "$pid", "eid" => "$eid",
"count" => $numvs,
"vtype" => $vtype,
......
#!/usr/bin/perl -wT
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
# Copyright (c) 2000-2010 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -27,7 +27,6 @@ sub usage()
sub dosomething($$);
sub isexpdone($);
sub TBBatchUnLockExp($$;$);
my $optlist = "d";
......@@ -47,6 +46,17 @@ if ($UID) {
" Only root can run this script!\n");
}
#
# Turn off line buffering on output
#
$| = 1;
#
# Untaint the path
#
$ENV{'PATH'} = "/bin:/usr/bin:";
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
#
# Testbed Support libraries
#
......@@ -94,17 +104,6 @@ my $user_name = "Testbed Operations";
my $user_email = "$TBOPS";
my $template;
#
# Turn off line buffering on output
#
$| = 1;
#
# Untaint the path
#
$ENV{'PATH'} = "/bin:/usr/bin:";
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
#
# Parse command arguments. Once we return from getopts, all that should be
# left are the required arguments.
......
#!/usr/bin/perl -wT
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
......
......@@ -165,7 +165,7 @@ my $infodir = $experiment->InfoDir();
# Sanity check.
if (! (-e $workdir && -e $userdir)) {
die("*** $0:\n".
" Missing a critical directory!\n");
" $pid/$eid is missing a critical directory!\n");
}
if (! -e $infodir) {
if (! -e "$TB/expinfo/$pid") {
......
......@@ -4911,7 +4911,7 @@ sub AllocVirtNodes($)
if ($virtnode->_isdynamic()) {
# Always use the base type ... node type system sucks.
my $basetype = $virtnode->_typeinfo->type();
my $basetype = $virtnode->_typeinfo()->type();
#
# We might be expecting to allocate a shared vnode on
......@@ -4927,7 +4927,7 @@ sub AllocVirtNodes($)
#
# Call into library. Be sure to pass impotent mode along.
#
if (Node::CreateVnodes(\@plist,
if (Node->CreateVnodes(\@plist,
{"pid" => "$pid",
"eid" => "$eid",
"count" => $numvs,
......
#!/usr/bin/perl -wT
#
# EMULAB-COPYRIGHT
# Copyright (c) 2005, 2006, 2007 University of Utah and the Flux Group.
# Copyright (c) 2005-2010 University of Utah and the Flux Group.
# All rights reserved.
#
use English;
......@@ -69,6 +69,8 @@ use libaudit;
use libdb;
use libtestbed;
use User;
use Group;
use Project;
# Protos
sub fatal($);
......
......@@ -83,6 +83,14 @@ if ($opt{a}) {
'ifOutOctets', 'ifOutUcastPkts', 'ifOutNUcastPkts');
}
#
# Warn about OIDs that do not return numeric values.
# Most likely these are ones that are unimplemented.
# It will only warn once per device per OID, but even that might get tedious
# so warnings can be turned off entirely here.
#
my $badoidwarnings = 1;
my ($pid, $eid);
if (!$opt{p} && !$opt{s}) {
if (@ARGV < 2) {
......@@ -275,6 +283,7 @@ my %portMap = mapPortsToDevices(@ports);
my @stats;
DEVICE: foreach my $name (keys %portMap) {
my @ports = @{$portMap{$name}};
my %oidwarned = ();
#
# Connect to the switch and get the data we want off of it
......@@ -336,6 +345,21 @@ DEVICE: foreach my $name (keys %portMap) {
"node_id='$switch_id' and card=$switch_card and ".
"port=$switch_port");
#
# Make sure returned values are integers. If not, warn (just
# once per device) and set to zero.
#
for (my $i = 0; $i < @oids; $i++) {
if ($result->[$i] !~ /^(\d+)$/) {
if ($badoidwarnings && !$oidwarned{$oids[$i]}) {
warn("WARNING: invalid value '" , $result->[$i],
"' for OID '", $oids[$i], "'\n");
$oidwarned{$oids[$i]} = 1;
}
$result->[$i] = 0;
}
}
my $oldresult = [@$result];
#
......
......@@ -9,6 +9,7 @@
use English;
use Getopt::Std;
use Math::BigInt;
use List::Util 'shuffle';
use lib "@prefix@/lib";
use libdb qw(TBGetSiteVar);
......@@ -34,7 +35,7 @@ sub usage()
{
print("Usage: ptopgen [-v] [-s switch] [-p pid [-e eid]] [-m factor] " .
"[-n c/e] [-x] [-g (0.1 | 2)] [-c component-name]".