Commit 8f610c47 authored by Leigh B Stoller's avatar Leigh B Stoller

More setup stuff.

parent 681d2ac0
#
# TODO:
# Build from /usr/testbed/src/emulab-stable.
#
# Bake in the routable ip space if possible
# Add partial reverse zone stuff. See the NOTES file.
#
# Add partial reverse zone stuff. See the NOTES file.
#
use strict;
use libinstall;
use installvars;
use libtestbed;
use emutil;
use libEmulab;
use emdb;
use User;
use NodeType;
use OSinfo;
use Image;
use Node;
use EmulabFeatures;
my $EMULABDEVEL = "git://git-public.flux.utah.edu/emulab-devel.git";
my $EMULABSTABLE = "git://git-public.flux.utah.edu/emulab-stable.git";
......@@ -35,8 +38,10 @@ my @EXPORTEDOSIDS= ("FBSD82-STD", "UBUNTU12-64-STD");
my $PGOSSITEVAR = "protogeni/default_osname";
my $CHPASS = "/usr/bin/chpass";
my $SSHTB = "$PREFIX/bin/sshtb";
my $DELETENODE = "$PREFIX/sbin/deletenode";
my $RACKNTPCONF = "$TOP_SRCDIR/install/genirack/ntp.conf";
my $ETCNTPCONF = "/etc/ntp.conf";
my $ELABMANDIR = "/users/elabman";
my %INTERFACES = (
"xn1" => "inet 10.1.1.1 netmask 255.255.255.0",
......@@ -211,10 +216,20 @@ sub Install($$$)
" -p " . $configvars{'ELABMAN_SSLCERT_PASSWORD'} . " elabman");
}
#
# Trun on arp lockdown.
#
if (0) {
Phase "arplockdown", "Turning on arplockdown", sub {
ExecQuietFatal("$PREFIX/sbin/setsitevar ".
"general/arplockdown staticonly");
};
}
#
# A reasonable default image.
#
Phase "sitevar", "Setting sitevar $PGOSSITEVAR", sub {
Phase "sitevar1", "Setting sitevar $PGOSSITEVAR", sub {
my $osinfo = OSinfo->LookupByName($DEFAULTOSID);
PhaseFail("Could not look up $DEFAULTOSID osid")
if (!defined($osinfo));
......@@ -222,6 +237,35 @@ sub Install($$$)
ExecQuietFatal("$PREFIX/sbin/setsitevar ".
"'$PGOSSITEVAR' '$DEFAULTOSID'");
};
#
# Latitude/Longitude
#
if (exists($configvars{'GENIRACK_COUNTRY'}) &&
$configvars{'GENIRACK_COUNTRY'} ne "") {
Phase "sitevar2", "Setting country sitevar", sub {
SetSiteVar("general/default_country",
$configvars{'GENIRACK_COUNTRY'})
or PhaseFail("failed");
};
}
if (exists($configvars{'GENIRACK_LATITUDE'}) &&
$configvars{'GENIRACK_LATITUDE'} ne "") {
Phase "sitevar3", "Setting latitude sitevar", sub {
SetSiteVar("general/default_latitude",
$configvars{'GENIRACK_LATITUDE'})
or PhaseFail("failed");
};
}
if (exists($configvars{'GENIRACK_LONGITUDE'}) &&
$configvars{'GENIRACK_LONGITUDE'} ne "") {
Phase "sitevar4", "Setting longitude sitevar", sub {
SetSiteVar("general/default_longitude",
$configvars{'GENIRACK_LONGITUDE'})
or PhaseFail("failed");
};
}
#
# Shutdown the testbed for the rest of this.
......@@ -235,6 +279,7 @@ sub Install($$$)
#
# Create a clone of emulab-devel while we are close to the server.
#
if (0) {
Phase "cloning1", "Cloning emulab-devel repository", sub {
DoneIfExists("$PREFIX/src/emulab-devel");
ExecQuietFatal("cd $PREFIX/src; ".
......@@ -245,6 +290,7 @@ sub Install($$$)
ExecQuietFatal("cd $PREFIX/src; ".
" git clone $EMULABSTABLE emulab-stable");
};
}
#
# Also grab the port source while close to the server.
......@@ -436,6 +482,26 @@ sub Install($$$)
}
};
#
# Add this feature so we get the right libvtop.
#
my $LIBVTOP_FEATURE = "LibVtopTest";
my $LIBVTOP_DESRIPTION = "Test version of libvtop";
my $feature = EmulabFeatures->Lookup($LIBVTOP_FEATURE);
Phase "feature", "Adding libvtop_test feature", sub {
PhaseSkip("already exists")
if (defined($feature));
$feature = EmulabFeatures->Create($LIBVTOP_FEATURE,
$LIBVTOP_DESRIPTION);
PhaseFail("Failed to create feature")
if (!defined($feature));
};
Phase "feature", "Enabling libvtop_test feature", sub {
$feature->SetGlobalEnable(1) == 0
or PhaseFail("Could not enable feature");
};
#
# Update the DB with the switch community string.
#
......@@ -446,6 +512,15 @@ sub Install($$$)
or PhaseFail("Could not set snmp community strings");
}
#
# Delete existing ops node; we recreate it later.
#
Phase "opsnode", "Deleting ops node", sub {
PhaseSkip("already deleted")
if (!defined(Node->Lookup("ops")));
ExecQuietFatal("$DELETENODE -f -s ops");
};
#
# Shutdown DHCP and fix the dynamic range that rc.mkelab changed.
# This is okay since the subnet is different then Emulab.
......@@ -520,6 +595,44 @@ sub Install($$$)
ExecQuietFatal("/bin/cp -fp $RACKNTPCONF $ETCNTPCONF");
};
#
#
#
Phase "buildenv", "Creating build environment", sub {
Phase "mkdir", "Creating directory in elabman", sub {
DoneIfExists("$ELABMANDIR/emulab-devel");
mkdir "$ELABMANDIR/emulab-devel",0775 or
PhaseFail("Unable to create $ELABMANDIR/emulab-devel: $!");
};
Phase "cpdefs", "Coping defs file to elabman", sub {
DoneIfExists("$ELABMANDIR/emulab-devel/defs-genirack");
ExecQuietFatal("/bin/cp -f $PREFIX/src/testbed/defs-genirack ".
" $ELABMANDIR/emulab-devel");
};
Phase "mvsrc", "Moving src directory to elabman", sub {
DoneIfExists("$ELABMANDIR/emulab-devel/emulab-devel");
ExecQuietFatal("/bin/mv -f $PREFIX/src/testbed ".
" $ELABMANDIR/emulab-devel/emulab-devel");
};
Phase "mvobj", "Moving obj directory to elabman", sub {
DoneIfExists("$ELABMANDIR/emulab-devel/obj");
ExecQuietFatal("/bin/mv -f $PREFIX/obj/testbed ".
" $ELABMANDIR/emulab-devel/obj");
};
Phase "srcsymlink", "Leaving src symlink behind", sub {
DoneIfExists("$PREFIX/src/testbed");
ExecQuietFatal("cd $PREFIX/src; ln -s ".
" $ELABMANDIR/emulab-devel/emulab-devel ".
" testbed");
};
Phase "objsymlink", "Leaving obj symlink behind", sub {
DoneIfExists("$PREFIX/obj/testbed");
ExecQuietFatal("cd $PREFIX/obj; ln -s ".
" $ELABMANDIR/emulab-devel/obj obj");
};
};
PhaseSucceed("Rack Setup Done");
};
return 0;
......
#
# Additional stuff for setting up the geni racks.
#
# This has to happen after reboot. Not sure yet ...
# remove rc.local
# TODO:
#
use strict;
use libinstall;
......@@ -101,6 +100,10 @@ sub Install($$$)
Phase "rc.testbed", "Installing testbed RC scripts", sub {
ExecQuietFatal("$GMAKE -C $TOP_OBJDIR/rc.d control-install");
};
Phase "control", "Installing control node clientside scripts", sub {
ExecQuietFatal("$GMAKE -C $TOP_OBJDIR/clientside/tmcc/freebsd ".
"control-install");
};
CreateFile("$PREFIX/marker", "genirack install marker");
};
......@@ -202,7 +205,7 @@ sub Install($$$)
#
if (defined($configvars{"NAMED_FORWARDERS"})) {
my $forwarders = $configvars{"NAMED_FORWARDERS"};
my @forwarders = split(/\s+/, $forwarders);
my @forwarders = split(/[\s,]+/, $forwarders);
if (@forwarders) {
@forwarders = map {"nameserver $_"} @forwarders;
......
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