Commit 94e2a068 authored by Jonathon Duerig's avatar Jonathon Duerig

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

parents 7119112b 50f38954
......@@ -131,6 +131,7 @@ use vars qw(@ISA @EXPORT);
TBDB_STATS_FLAGS_MODSWAPOUT
TBDB_JAILIPBASE TBDB_JAILIPMASK
TBDB_FRISBEEMCBASEADDR
TBDB_RSRVROLE_NODE TBDB_RSRVROLE_VIRTHOST TBDB_RSRVROLE_DELAYNODE
TBDB_RSRVROLE_SIMHOST
......@@ -503,6 +504,9 @@ sub TBDB_STATS_FLAGS_MODSWAPOUT() { 0x40; }
sub TBDB_JAILIPBASE() { "@JAILIPBASE@"; }
sub TBDB_JAILIPMASK() { "@JAILIPMASK@"; }
# Frisbee.
sub TBDB_FRISBEEMCBASEADDR() { "@FRISEBEEMCASTADDR@:@FRISEBEEMCASTPORT@"; }
# Reserved node "roles"
sub TBDB_RSRVROLE_NODE() { "node"; }
sub TBDB_RSRVROLE_VIRTHOST() { "virthost"; }
......
......@@ -294,8 +294,8 @@ sub FeatureEnabled($$$$)
# A non existent feature is always disabled.
# Do not warn; not all sites will have the same set.
if (!defined($feature)) {
print STDERR
"*** Checking for non-existent Emulab Feature: $featurename\n"
print STDERR "*** WARNING: ".
"Checking for non-existent Emulab Feature: $featurename\n"
if ($MAINSITE || $debug);
return 0;
}
......
......@@ -146,7 +146,7 @@ sub ActiveImages($)
my @result = ();
my $query_result =
DBQueryWarn("select imageid from images where frisbee_pid!=0");
DBQueryWarn("select imageid from frisbee_blobs where frisbee_pid!=0");
return undef
if (!defined($query_result));
......
......@@ -1408,8 +1408,10 @@ sub TBNodeDiskloadOSID($)
my $mfs;
return 0
if ($node->NodeTypeAttribute("diskloadmfs_osid", \$mfs) != 0);
if ($node->NodeAttribute("diskloadmfs_osid", \$mfs) || !defined($mfs)) {
return 0
if ($node->NodeTypeAttribute("diskloadmfs_osid", \$mfs) != 0);
}
$mfs = TB_OSID_FREEBSD_MFS()
if (!defined($mfs));
......
......@@ -63,7 +63,7 @@ EmulabResponse::~EmulabResponse()
}
ServerProxy::ServerProxy(xmlrpc_c::clientXmlTransportPtr transport,
ServerProxy::ServerProxy(xmlrpc_c::clientXmlTransport *transport,
bool wbxml_mode,
const char *url)
{
......
......@@ -135,7 +135,7 @@ class ServerProxy
* @param wbxml_mode Indicate whether or not wbxml should be used.
* @param url The url to use.
*/
ServerProxy(xmlrpc_c::clientXmlTransportPtr transport,
ServerProxy(xmlrpc_c::clientXmlTransport *transport,
bool wbxml_mode = false,
const char *url = "");
......@@ -176,7 +176,7 @@ class ServerProxy
private:
xmlrpc_c::value call(xmlrpc_c::rpcPtr rpc);
xmlrpc_c::clientXmlTransportPtr transport;
xmlrpc_c::clientXmlTransport *transport;
std::string server_url;
};
......
......@@ -997,7 +997,7 @@ SetExpPath(const char *path)
}
int
AddUserEnv(char *name, char *path)
AddUserEnv(const char *name, const char *path)
{
int retval = 0;
FILE *file;
......@@ -1042,7 +1042,8 @@ AddUserEnv(char *name, char *path)
*/
int
AddAgent(event_handle_t handle,
char *vname, char *vnode, char *nodeid, char *ipaddr, char *type)
const char *vname, const char *vnode, const char *nodeid,
const char *ipaddr, const char *type)
{
struct agent *agentp;
......@@ -1173,7 +1174,7 @@ AddAgent(event_handle_t handle,
* Add an agent group to the list.
*/
int
AddGroup(event_handle_t handle, char *groupname, char *agentname)
AddGroup(event_handle_t handle, const char *groupname, const char *agentname)
{
struct agent *group = NULL, *agent;
int retval = 0;
......@@ -1238,8 +1239,9 @@ 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 *triggertype)
const char *exidx, const char *ftime, const char *objname,
const char *exargs, const char *objtype, const char *evttype,
const char *parent, const char *triggertype)
{
timeline_agent_t ta = NULL;
sched_event_t event;
......
......@@ -299,14 +299,15 @@ RPC_metadata(char *pid, char *eid)
int lpc;
for (lpc = 0; lpc < userenv.size(); lpc++) {
char *name, *value;
string name, value;
map<string, xmlrpc_c::value> ue;
ue = (xmlrpc_c::value_struct)userenv[lpc];
name = (char *)((string)(xmlrpc_c::value_string)ue["name"]).c_str();
value = (char *)((string)(xmlrpc_c::value_string)ue["value"]).c_str();
name = (xmlrpc_c::value_string)ue["name"];
value = (xmlrpc_c::value_string)ue["value"];
if ((retval = AddUserEnv(name, value)) != 0)
if ((retval = AddUserEnv(name.c_str(),
value.c_str())) != 0)
return retval;
}
}
......@@ -585,17 +586,18 @@ RPC_agentlist(event_handle_t handle, char *pid, char *eid)
((xmlrpc_c::value_array)er.getValue()).vectorValueValue();
for (i = 0; i < agents.size(); i++) {
char *vname, *vnode, *nodeid, *ipaddr, *type;
string vname, vnode, nodeid, ipaddr, type;
vector<xmlrpc_c::value>agent =
((xmlrpc_c::value_array)agents[i]).vectorValueValue();
vname = (char *)((string)(xmlrpc_c::value_string)agent[0]).c_str();
vnode = (char *)((string)(xmlrpc_c::value_string)agent[1]).c_str();
nodeid = (char *)((string)(xmlrpc_c::value_string)agent[2]).c_str();
ipaddr = (char *)((string)(xmlrpc_c::value_string)agent[3]).c_str();
type = (char *)((string)(xmlrpc_c::value_string)agent[4]).c_str();
info("D: adding agent %s\n", vname);
if (AddAgent(handle, vname, vnode, nodeid, ipaddr, type) < 0) {
vname = (xmlrpc_c::value_string)agent[0];
vnode = (xmlrpc_c::value_string)agent[1];
nodeid = (xmlrpc_c::value_string)agent[2];
ipaddr = (xmlrpc_c::value_string)agent[3];
type = (xmlrpc_c::value_string)agent[4];
info("D: adding agent %s\n", (char *)vname.c_str());
if (AddAgent(handle, vname.c_str(), vnode.c_str(),
nodeid.c_str(), ipaddr.c_str(), type.c_str()) < 0) {
return -1;
}
}
......@@ -616,16 +618,19 @@ RPC_grouplist(event_handle_t handle, char *pid, char *eid)
((xmlrpc_c::value_array)er.getValue()).vectorValueValue();
for (i = 0; i < groups.size(); i++) {
char *groupname, *agentname;
string groupname, agentname;
vector<xmlrpc_c::value> group =
((xmlrpc_c::value_array)groups[i]).vectorValueValue();
groupname = (char *)((string)(xmlrpc_c::value_string)group[0]).c_str();
info("D: \tIn GroupList() parsed name %s\n", groupname);
agentname = (char *)((string)(xmlrpc_c::value_string)group[1]).c_str();
info("D: \tIn GroupList() parsed agent %s\n", agentname);
groupname = (xmlrpc_c::value_string)group[0];
info("D: \tIn GroupList() parsed name %s\n",
(char *)groupname.c_str());
agentname = (xmlrpc_c::value_string)group[1];
info("D: \tIn GroupList() parsed agent %s\n",
(char *)agentname.c_str());
if (AddGroup(handle, groupname, agentname) != 0) {
if (AddGroup(handle, groupname.c_str(),
agentname.c_str()) != 0) {
return -1;
}
}
......@@ -656,25 +661,27 @@ RPC_eventlist(char *pid, char *eid,
// 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, *triggertype;
string exidx, extime, objname, objtype, evttype, exargs;
string parent, triggertype;
vector<xmlrpc_c::value> event =
((xmlrpc_c::value_array)events[i]).vectorValueValue();
exidx = (char *)((string)(xmlrpc_c::value_string)event[0]).c_str();
extime = (char *)((string)(xmlrpc_c::value_string)event[1]).c_str();
objname = (char *)((string)(xmlrpc_c::value_string)event[2]).c_str();
objtype = (char *)((string)(xmlrpc_c::value_string)event[3]).c_str();
evttype = (char *)((string)(xmlrpc_c::value_string)event[4]).c_str();
exargs = (char *)((string)(xmlrpc_c::value_string)event[5]).c_str();
parent = (char *)((string)(xmlrpc_c::value_string)event[6]).c_str();
triggertype = (char *)((string)(xmlrpc_c::value_string)event[7]).c_str();
exidx = (xmlrpc_c::value_string)event[0];
extime = (xmlrpc_c::value_string)event[1];
objname = (xmlrpc_c::value_string)event[2];
objtype = (xmlrpc_c::value_string)event[3];
evttype = (xmlrpc_c::value_string)event[4];
exargs = (xmlrpc_c::value_string)event[5];
parent = (xmlrpc_c::value_string)event[6];
triggertype = (xmlrpc_c::value_string)event[7];
// XXX
// info("rpc.cc:RPC_eventlist(): Adding an event\n");
// XXX
if (AddEvent(handle, tuple, exidx,
extime, objname, exargs, objtype, evttype,
parent, triggertype) < 0) {
if (AddEvent(handle, tuple, exidx.c_str(),
extime.c_str(), objname.c_str(),
exargs.c_str(), objtype.c_str(),
evttype.c_str(), parent.c_str(),
triggertype.c_str()) < 0) {
return -1;
}
}
......
......@@ -67,17 +67,19 @@ int RPC_eventlist(char *pid, char *eid,
event_handle_t handle, address_tuple_t tuple);
extern int SetExpPath(const char *path);
extern int AddUserEnv(char *name, char *value);
extern int AddUserEnv(const char *name, const char *value);
extern int AddAgent(event_handle_t handle,
char *vname, char *vnode, char *nodeid,
char *ipaddr, char *type);
const char *vname, const char *vnode, const char *nodeid,
const char *ipaddr, const char *type);
extern int AddGroup(event_handle_t handle, char *groupname, char *agentname);
extern int AddGroup(event_handle_t handle, const char *groupname,
const 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 *triggertype);
const char *exidx, const char *ftime, const char *objname,
const char *exargs, const char *objtype, const char *evttype,
const char *parent, const char *triggertype);
extern int AddRobot(event_handle_t handle,
struct agent *agent,
......
......@@ -57,6 +57,9 @@ my %msgs = ();
my $reload_time = 600;
my $last_reload = time;
# Handling of SECVIOLATIONS, eventually controlled by a sitevar
my $soft_secviolation = 1;
# Command line opts.
my $dbtag = "";
my $debug = 0;
......@@ -643,8 +646,19 @@ sub stateTransition($$) {
#
if ($oldstate eq TBDB_NODESTATE_SECVIOLATION &&
$newstate ne TBDB_NODESTATE_SECVIOLATION) {
notify("$node tried to leave SECVIOLATION (to $newstate)\n");
$newstate = TBDB_NODESTATE_SECVIOLATION;
#
# Allow transitions to SHUTDOWN.
# This allows someone to reboot a node in the SECVIOLATION state
# getting it back to MINIMAL/SHUTDOWN.
#
# XXX DEBUG ONLY!
#
if ($soft_secviolation && $newstate eq TBDB_NODESTATE_SHUTDOWN) {
notify("$node allowed to transition: SECVIOLATION => SHUTDOWN\n");
} else {
notify("$node tried to leave SECVIOLATION (to $newstate)\n");
$newstate = TBDB_NODESTATE_SECVIOLATION;
}
}
my $now = time();
......@@ -872,15 +886,19 @@ sub stateTransition($$) {
(/^EMAILNOTIFY$/) && do {
my $msg = "$node entered state $mode/$newstate from " .
"$mode/$oldstate";
my $dest = $REALTBOPS;
if ($newstate eq TBDB_NODESTATE_SECVIOLATION) {
$msg .= "\n\nNode $node has been powered off.\n" .
"You must address the cause of the violation ".
"and reset the eventstate before powering on.";
if ($soft_secviolation) {
$msg .= "\n\nNode $node was allowed to continue.\n";
$dest = $TBOPS;
} else {
$msg .= "\n\nNode $node has been powered off.\n" .
"You must address the cause of the violation ".
"and reset the eventstate before powering on.";
}
}
SENDMAIL($REALTBOPS,
"STATED: $node entered state $newstate",
$msg,
"Stated Daemon <".$TBOPS.">");
SENDMAIL($dest, "STATED: $node entered state $newstate",
$msg, "Stated Daemon <".$TBOPS.">");
next;
};
/^RELOADOLDMFS$/ && do {
......@@ -1192,6 +1210,13 @@ sub handleCommand($$;$$) {
$TBPOWERON => "on",
$TBPOWEROFF => "off");
my $func = $funcmap{$command};
if ($soft_secviolation && $func eq "off" && @nodes > 0 &&
$nodes{$nodes[0]}{state} eq TBDB_NODESTATE_SECVIOLATION) {
info("soft SECVIOLATION: NOT powering off $params\n");
next;
}
info("Sending power $func for nodes: $nodelist\n");
#
# Permissions were checked in order to send the message,
......
......@@ -308,12 +308,31 @@ if ($stopbed) {
}
$stopped = 1;
my $activeimages = Image->ActiveImages();
if (defined($activeimages)) {
my @activeimages = @{ $activeimages };
if (@activeimages) {
print "** Stopping running frisbee processes ...\n";
#
# XXX cannot just call Image->ActiveImages as the implementation
# changed and thus the code would not work when upgrading from a
# code base with the old implementation to one with the new.
#
my $table = "images";
if (!emdb::DBSlotExists("images", "frisbee_pid")) {
$table = "frisbee_blobs";
}
my $query_result =
emdb::DBQueryWarn("select imageid from $table where frisbee_pid!=0");
my @activeimages = ();
if ($query_result) {
while (my ($imageid) = $query_result->fetchrow_array()) {
my $image = Image->Lookup($imageid);
if (!defined($image)) {
print STDERR
"*** Could not find DB object for image $imageid\n";
next;
}
push(@activeimages, $image);
}
}
if (@activeimages > 0) {
print "** Stopping running frisbee processes ...\n";
foreach my $image (@activeimages) {
my $imageid = $image->imageid();
print "-> Killing frisbee for $image ...\n";
......
diff -ru linux-2.6.34/net/ipv4/Kconfig linux-2.6.34-emulab/net/ipv4/Kconfig
--- linux-2.6.34/net/ipv4/Kconfig 2008-08-29 09:50:50.000000000 -0600
+++ linux-2.6.34-emulab/net/ipv4/Kconfig 2008-08-29 09:53:39.000000000 -0600
@@ -627,3 +627,9 @@
If unsure, say N.
+#
+# Emulab special
+#
+config ICMP_PINGOFDEATH
+ bool "ICMP: ICMP Ping-of-Death (Emulab)"
+
diff -ru linux-2.6.34/net/ipv4/icmp.c linux-2.6.34-emulab/net/ipv4/icmp.c
--- linux-2.6.34/net/ipv4/icmp.c 2010-05-16 23:17:36.000000000 +0200
+++ linux-2.6.34-emulab/net/ipv4/icmp.c 2010-06-03 17:32:26.000000000 +0200
@@ -962,6 +962,67 @@
out:;
}
+#ifdef CONFIG_ICMP_PINGOFDEATH
+#include <linux/reboot.h>
+
+int sysctl_ipod_version = 2;
+int sysctl_ipod_enabled = 0;
+u32 sysctl_ipod_host = 0xffffffff;
+u32 sysctl_ipod_mask = 0xffffffff;
+char sysctl_ipod_key[32+1] = { "SETMETOSOMETHINGTHIRTYTWOBYTES!!" };
+#define IPOD_CHECK_KEY \
+ (sysctl_ipod_key[0] != 0)
+#define IPOD_VALID_KEY(d) \
+ (strncmp(sysctl_ipod_key, (char *)(d), strlen(sysctl_ipod_key)) == 0)
+
+static void icmp_ping_of_death(struct sk_buff *skb)
+{
+ struct icmphdr *icmph = icmp_hdr(skb);
+ struct iphdr *iph = ip_hdr(skb);
+ int doit = 0;
+
+#if 0
+ printk(KERN_INFO "IPOD: got type=6, code=%d, host=%u.%u.%u.%u\n", icmph->code, ntohs(iph->tot_len), NIPQUAD(iph->saddr));
+#endif
+
+ /*
+ * If IPOD not enabled or wrong ICMP code, ignore.
+ */
+ if (!sysctl_ipod_enabled || icmph->code != 6)
+ return;
+
+ /*
+ * First check the source address info.
+ * If host not set, ignore.
+ */
+ if (sysctl_ipod_host != 0xffffffff &&
+ (ntohl(iph->saddr) & sysctl_ipod_mask) == sysctl_ipod_host) {
+ /*
+ * Now check the key if enabled.
+ * If packet doesn't contain enough data or key
+ * is otherwise invalid, ignore.
+ */
+ if (IPOD_CHECK_KEY) {
+ if (pskb_may_pull(skb, sizeof(sysctl_ipod_key)-1) &&
+ IPOD_VALID_KEY(skb->data))
+ doit = 1;
+ } else {
+ doit = 1;
+ }
+ }
+
+ if (doit) {
+ sysctl_ipod_enabled = 0;
+ printk(KERN_CRIT "IPOD: reboot forced by %u.%u.%u.%u...\n",
+ NIPQUAD(iph->saddr));
+ emergency_restart();
+ } else {
+ printk(KERN_WARNING "IPOD: from %u.%u.%u.%u rejected\n",
+ NIPQUAD(iph->saddr));
+ }
+}
+#endif
+
static void icmp_discard(struct sk_buff *skb)
{
}
@@ -1085,10 +1146,18 @@
.handler = icmp_redirect,
.error = 1,
},
+#ifdef CONFIG_ICMP_PINGOFDEATH
+ /* PING_OF_DEATH (6) */
+ [6] = {
+ .handler = icmp_ping_of_death,
+ .error = 1,
+ },
+#else
[6] = {
.handler = icmp_discard,
.error = 1,
},
+#endif
[7] = {
.handler = icmp_discard,
.error = 1,
diff -ru linux-2.6.34/net/ipv4/Kconfig linux-2.6.34-emulab/net/ipv4/Kconfig
--- linux-2.6.34/net/ipv4/Kconfig 2010-05-16 23:17:36.000000000 +0200
+++ linux-2.6.34-emulab/net/ipv4/Kconfig 2010-06-03 17:29:18.000000000 +0200
@@ -627,3 +627,10 @@
If unsure, say N.
+#
+# Emulab special
+#
+config ICMP_PINGOFDEATH
+ bool "ICMP: ICMP Ping-of-Death (Emulab)"
+
+
diff -ru linux-2.6.34/net/ipv4/sysctl_net_ipv4.c linux-2.6.34-emulab/net/ipv4/sysctl_net_ipv4.c
--- linux-2.6.34/net/ipv4/sysctl_net_ipv4.c 2010-05-16 23:17:36.000000000 +0200
+++ linux-2.6.34-emulab/net/ipv4/sysctl_net_ipv4.c 2010-06-03 17:35:13.000000000 +0200
@@ -22,6 +22,14 @@
#include <net/cipso_ipv4.h>
#include <net/inet_frag.h>
+#ifdef CONFIG_ICMP_PINGOFDEATH
+extern int sysctl_ipod_version;
+extern int sysctl_ipod_enabled;
+extern u32 sysctl_ipod_host;
+extern u32 sysctl_ipod_mask;
+extern char sysctl_ipod_key[32+1];
+#endif
+
static int zero;
static int tcp_retr1_max = 255;
static int ip_local_port_range_min[] = { 1, 1 };
@@ -614,6 +622,48 @@
.proc_handler = proc_dointvec_minmax,
.extra1 = &zero
},
+#ifdef CONFIG_ICMP_PINGOFDEATH
+ {
+ .ctl_name = CTL_UNNUMBERED,
+ .procname = "icmp_ipod_version",
+ .data = &sysctl_ipod_version,
+ .maxlen = sizeof(int),
+ .mode = 0444,
+ .proc_handler = &proc_dointvec,
+ },
+ {
+ .ctl_name = CTL_UNNUMBERED,
+ .procname = "icmp_ipod_enabled",
+ .data = &sysctl_ipod_enabled,
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = &proc_dointvec,
+ },
+ {
+ .ctl_name = CTL_UNNUMBERED,
+ .procname = "icmp_ipod_host",
+ .data = &sysctl_ipod_host,
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = &proc_dointvec,
+ },
+ {
+ .ctl_name = CTL_UNNUMBERED,
+ .procname = "icmp_ipod_mask",
+ .data = &sysctl_ipod_mask,
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = &proc_dointvec,
+ },
+ {
+ .ctl_name = CTL_UNNUMBERED,
+ .procname = "icmp_ipod_key",
+ .data = sysctl_ipod_key,
+ .maxlen = sizeof(sysctl_ipod_key),
+ .mode = 0600,
+ .proc_handler = &proc_dostring,
+ },
+#endif
{ }
};
......@@ -379,19 +379,35 @@ else {
die("Bad data in tarlist name: $tarlist");
}
my $oumask = umask(0);
system("tar $decompressflag -xvf $tarfile > $tarlist");
my $TAR = `which gtar`;
chomp $TAR;
$TAR = "tar" if $TAR eq '';
open VER, "$TAR --version 2>&1 |";
my $GNU_TAR = 0;
while (<VER>) {
$GNU_TAR = 1 if /GNU tar/;
}
my $TAR_FLAGS = $GNU_TAR ? "-xvf" : "-xf";
system("tar $decompressflag $TAR_FLAGS $tarfile >$tarlist 2>&1");
$exit_status = $? >> 8;
umask($oumask);
if ($copymode) {
unlink($copyfile);
}
if ($unknownuser) {
if ($unknownuser && $GNU_TAR) {
open(TARIN, "< $tarlist");
while (my $line = <TARIN>) {
chop $line;
if ($line =~ /^(.*)$/) {
$line = "$installdir/$1";
my $file = $1;
# XXX hack for bsdtar
if (! -e "$installdir/$file" && $file =~ /^x (.*)$/) {
$file = $1;
}
$line = "$installdir/$file";
if (-e $line &&
(my (undef,undef,undef,undef,$fuid,$fgid) = stat $line)) {
if ($fuid < 100) {
......@@ -417,6 +433,8 @@ if ($unknownuser) {
}
}
close(TARIN);
} elsif ($unknownuser) {
warn("*** WARNING: -u option requires GNU tar, ignoring.\n");
}
unlink($tarlist);
......
......@@ -18,8 +18,11 @@ INSERT IGNORE INTO os_boot_cmd VALUES ('FreeBSD','5.4','delay','/boot/kernel.del
INSERT IGNORE INTO os_boot_cmd VALUES ('FreeBSD','5.4','linkdelay','/boot/kernel.linkdelay/kernel');
INSERT IGNORE INTO os_boot_cmd VALUES ('FreeBSD','6.2','delay','/boot/kernel.poll/kernel HZ=10000');
INSERT IGNORE INTO os_boot_cmd VALUES ('FreeBSD','6.2','linkdelay','/boot/kernel/kernel HZ=1000');
INSERT IGNORE INTO os_boot_cmd VALUES ('FreeBSD','7.3','delay','/boot/kernel.poll/kernel HZ=10000');
INSERT IGNORE INTO os_boot_cmd VALUES ('FreeBSD','8.1','delay','/boot/kernel.poll/kernel HZ=10000');
INSERT IGNORE INTO os_boot_cmd VALUES ('Linux','9.0','linkdelay','linkdelay');
INSERT IGNORE INTO emulab_indicies (name,idx) VALUES ('cur_log_seq', 1);
INSERT IGNORE INTO emulab_indicies (name,idx) VALUES ('frisbee_index', 1);
INSERT IGNORE INTO emulab_indicies (name,idx) VALUES ('next_osid', 10000);
INSERT IGNORE INTO emulab_locks (name,value) VALUES ('pool_daemon', 0);
......@@ -10,7 +10,7 @@ You appear to have running frisbee servers. Please make sure the
testbed is shutdown before applying this upgrade. This should normally
be taken care of automatically if you use "gmake update-testbed". If
the testbed is shutdown than see the instruction at the end of
sql/updates/4/XXX for how to rectify the situation.
sql/updates/4/225 for how to rectify the situation.
EOF
chop $running_frisbee_messages;
sub DoUpdate($$$)
......
#
# Create the frisbee_index table. We used to do this on the fly in
# frisbeelauncher, but that is overkill and I don't want to port that
# logic forward to the frisbeelauncher replacement.
#
use Socket;
use strict;
use libdb;
use EmulabConstants;
sub DoUpdate($$$)
{
my ($dbhandle, $dbname, $version) = @_;
my $result;
$result = DBQueryFatal("SELECT name FROM emulab_indicies ".
"WHERE name='frisbee_index'");
if ($result->numrows != 0) {
return 0;
}
DBQueryFatal("LOCK TABLES emulab_indicies WRITE");
my $idx = 0;
if ($EmulabConstants::TBDB_FRISBEEMCBASEADDR =~ /^(\d+\.\d+\.\d+):\d+$/) {
my $BASEADDR = $1;
my $result = DBQueryFatal("SELECT idx FROM emulab_indicies ".
"WHERE name='frisbee_mcastaddr'");
if ($result->numrows) {
($idx) = $result->fetchrow_array();
my $orig = unpack("N", inet_aton("${BASEADDR}.1"));
$idx -= $orig;
# absolutely anal: we didn't use 2 of every 256 addresses
my $tweak = int($idx / 256) * 2;
$idx -= $tweak;
if ($idx < 0 || $idx > 1000000) {
$idx = 0;
}
}
}
$idx++;
DBQueryFatal("INSERT INTO emulab_indicies (name, idx) ".
" VALUES ('frisbee_index', $idx)");
DBQueryFatal("UNLOCK TABLES");
return 0;
}
1;