Commit 55cd655c authored by Mike Hibler's avatar Mike Hibler

Remove one-time frisbee index initialization from frisbeelauncher.

This should never have been there in the first place, and I don't want to
carry that hack forward into the post-frisbeelauncher world.
parent a0d0c95e
......@@ -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"; }
......
......@@ -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);
#
# 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;
......@@ -495,39 +495,6 @@ sub UnlockTables()
debug("Unlocked tables\n");
}
#
# One-time conversion function.
# Convert overly complex frisbee_mcastaddr index into simple incremented one.
#
sub CreateIndex()
{
my $idx = 0;
DBQueryFatal("lock tables emulab_indicies write");
my $baseaddr_query =
DBQueryFatal("select idx from emulab_indicies ".
"where name='frisbee_mcastaddr'");
if ($baseaddr_query->num_rows) {
($idx) = $baseaddr_query->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 $idx;
}
#
# Pick out an address to use.
# DB tables must be *unlocked* for this to work!
......@@ -540,13 +507,8 @@ sub PickAddress()
"where name='frisbee_index'");
if ($index_query->affectedrows <= 0) {
my $msg = "Doing one-time creation of frisbee_index in emulab_indicies table";
SENDMAIL($TBOPS,
"FrisbeeLauncher Notice!",
"File: $filename\n".
$msg);
$idx = CreateIndex();
Fatal("emulab_indicies frisbee_index entry does not exist!".
" See sql/updates/4/226 in the source tree.");
} else {
$idx = $index_query->insertid();
}
......
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