Commit 3e18f84d authored by Leigh Stoller's avatar Leigh Stoller

Checkpoint.

parent e3885710
......@@ -18,15 +18,14 @@ sub usage {
print "-R dir - (rsync specific directory (say, install/genirack)\n";
print "-b - Build the software (with reconfig).\n";
print "-i - Install on each rack.\n";
print "-l - List all racks.\n";
print "-p arg - Update shared pool on each rack.\n";
print " arg is type,func where type=xen|openvz\n";
print "-u - Do Utah rack.\n";
print "-d - Do DDC rack.\n";
print "-a - Do APT rack.\n";
print "-l - Do Cloudlab (Utah) rack.\n";
print "-U - Skip Utah rack.\n";
print "-D - Skip DDC rack.\n";
print "-A - Skip APT rack.\n";
print "-7 - Just G7 racks.\n";
print "-8 - Just G8 racks.\n";
print "-f - Run function instead. Add -F to shutdown testbed\n";
......@@ -37,7 +36,7 @@ sub usage {
print "rack - Specific rack, or all racks\n";
exit(1);
}
my $optlist = "binuUdDhfForlc78tsp:aAR:C";
my $optlist = "binuUdDhfForlc78tsp:aAR:CL";
my $rebuild = 0;
my $install = 0;
my $rsync = 0;
......@@ -50,13 +49,30 @@ my $nopar = 0;
my $dopool;
my $rack;
my $TB = "/usr/testbed";
my $UTAHBOSS = "boss.utah.geniracks.net";
my $UTAHCTRL = "control.utah.geniracks.net";
my $DDCBOSS = "boss.utahddc.geniracks.net",
my $DDCCTRL = "control.utahddc.geniracks.net",
my $APTBOSS = "boss.apt.emulab.net",
my $APTCTRL = "boss.apt.emulab.net",
my $TB = "/usr/testbed";
my $UTAHBOSS = "boss.utah.geniracks.net";
my $UTAHCTRL = "control.utah.geniracks.net";
my $DDCBOSS = "boss.utahddc.geniracks.net";
my $DDCCTRL = "control.utahddc.geniracks.net";
my $STITCHBOSS = "boss.utahddc.geniracks.net";
my $APTBOSS = "boss.apt.emulab.net";
my $APTCTRL = "";
my $UTAHCLOUDBOSS = "boss.utah.cloudlab.us";
my $UTAHCLOUDCTRL = "";
my $CLEMCLOUDBOSS = "boss.clemson.cloudlab.us";
my $CLEMCLOUDCTRL = "";
my $WISCCLOUDBOSS = "boss.wisc.cloudlab.us";
my $WISCCLOUDCTRL = "";
my %CLOUDCLUSTERS = ("apt" => [ $APTBOSS, $APTCTRL ],
"utah" => [ $UTAHCLOUDBOSS, $UTAHCLOUDCTRL ],
"wisc" => [ $WISCCLOUDBOSS, $WISCCLOUDCTRL ],
"clemson" => [ $CLEMCLOUDBOSS, $CLEMCLOUDCTRL ],
);
my %UTAHCLUSTERS = ("utahig" => [ $UTAHBOSS, $UTAHCTRL ],
"utahddc" => [ $DDCBOSS, $DDCCTRL ],
"stitch" => [ $STITCHBOSS, $DDCCTRL ],
);
my %G7RACKS = ("bbn" => [ "boss.instageni.gpolab.bbn.com",
"gpolab.control-nodes.geniracks.net" ],
"nwu" => [ "boss.instageni.northwestern.edu",
......@@ -71,8 +87,8 @@ my %G7RACKS = ("bbn" => [ "boss.instageni.gpolab.bbn.com",
"princeton.control-nodes.geniracks.net" ],
"clemson" => [ "boss.instageni.clemson.edu",
"clemson.control-nodes.geniracks.net" ],
"kansas" => [ "boss.instageni.ku.gpeni.net",
"kansas.control-nodes.geniracks.net" ],
# "kansas" => [ "boss.instageni.ku.gpeni.net",
# "kansas.control-nodes.geniracks.net" ],
"nyu" => [ "boss.genirack.nyu.edu",
"nyu.control-nodes.geniracks.net" ],
# Off the air.
......@@ -125,6 +141,10 @@ my %G8RACKS = ("max" => [ "boss.instageni.maxgigapop.net",
# "cisco.control-nodes.geniracks.net" ],
"uw" => [ "boss.instageni.washington.edu",
"uw.control-nodes.geniracks.net" ],
"utc" => [ "boss.instageni.utc.edu",
"utc.control-nodes.geniracks.net" ],
"vt" => [ "boss.instageni.arc.vt.edu",
"vt.control-nodes.geniracks.net" ],
);
sub fatal($)
......@@ -157,19 +177,15 @@ my $which = (defined($options{"c"}) ? 1 : 0);
my $UTAHRACK = (defined($options{"c"}) ? $UTAHCTRL : $UTAHBOSS);
my $DDCRACK = (defined($options{"c"}) ? $DDCCTRL : $DDCBOSS);
my $APTRACK = (defined($options{"c"}) ? $APTCTRL : $APTBOSS);
my $CLOUDRACK= (defined($options{"c"}) ? $UTAHCLOUDCTRL : $UTAHCLOUDBOSS);
my @G7RACKS = map { $G7RACKS{$_}[$which] } keys(%G7RACKS);
my @G8RACKS = map { $G8RACKS{$_}[$which] } keys(%G8RACKS);
my @ALLCLOUD = map { $CLOUDCLUSTERS{$_}[$which] } keys(%CLOUDCLUSTERS);
my @ALLRACKS = (@G7RACKS, @G8RACKS);
my @TODO = ($UTAHRACK, $DDCRACK, @ALLRACKS);
my %SKIP = ();
my $HOME = "/home/stoller";
if (defined($options{"l"})) {
foreach my $name (@ALLRACKS) {
print "$name\n";
}
exit(0);
}
if (defined($options{"i"})) {
$install = 1;
}
......@@ -191,10 +207,6 @@ if (defined($options{"b"})) {
if (defined($options{"r"})) {
$rsync = 1;
}
if (defined($options{"C"})) {
$rsync = 1;
$doscp = 1;
}
if (defined($options{"R"})) {
$rsync = 1;
$rsyncdir = $options{"R"};
......@@ -204,8 +216,10 @@ if (defined($options{"p"})) {
$dofunc = 1;
}
if (defined($options{"u"}) || defined($options{"d"}) ||
defined($options{"a"})) {
defined($options{"a"}) || defined($options{"l"})) {
@TODO = ();
push(@TODO, $CLOUDRACK)
if (defined($options{"l"}));
push(@TODO, $APTRACK)
if (defined($options{"a"}));
push(@TODO, $UTAHRACK)
......@@ -225,6 +239,22 @@ elsif (defined($options{"8"})) {
@TODO = ($DDCRACK, @TODO);
}
}
elsif (defined($options{"C"})) {
if (@ARGV) {
@TODO = ();
foreach my $arg (@ARGV) {
if (exists($CLOUDCLUSTERS{$arg})) {
push(@TODO, $CLOUDCLUSTERS{$arg}[$which]);
}
else {
fatal("No such rack: $arg");
}
}
}
else {
@TODO = @ALLCLOUD;
}
}
elsif (@ARGV) {
@TODO = ();
......@@ -238,6 +268,9 @@ elsif (@ARGV) {
elsif (exists($G8RACKS{$arg})) {
push(@TODO, $G8RACKS{$arg}[$which]);
}
elsif (exists($UTAHCLUSTERS{$arg})) {
push(@TODO, $UTAHCLUSTERS{$arg}[$which]);
}
else {
fatal("No such rack: $arg");
}
......@@ -298,6 +331,14 @@ if ($dofunc && !$install) {
elsif (0) {
$command = "cd $devel/stuff; sudo perl osupdctrl.pl";
}
elsif (0) {
$command = "cd pubsub; sudo gmake client install; ".
"sudo /usr/local/etc/rc.d/2.pubsubd.sh stop; ".
"sudo /usr/local/etc/rc.d/2.pubsubd.sh start";
}
elsif (0) {
$command = "cd pubsub; ./configure; gmake clean; gmake client";
}
elsif (0) {
$command = "cd $devel/stuff; ".
"sudo pkg_delete bash-4.2.20; sudo pkg_add bash-4.3.27.tbz";
......@@ -343,18 +384,21 @@ if ($dofunc && !$install) {
}
elsif (0) {
$command =
"cd emulab-devel/obj/tbsetup/snmpit_test; sudo gmake install";
"cd emulab-devel/obj/named; rm -f mail.access; gmake; ".
"sudo gmake install-head; /usr/testbed/sbin/named_setup";
}
elsif (0) {
$command = "cd emulab-devel/obj/db; ".
"sudo gmake /usr/testbed/lib/Image.pm; ".
"cd ../utils; sudo gmake install";
$command = "cd emulab-devel/obj/apache; sudo gmake install; ".
"sudo /usr/local/etc/rc.d/apache22 restart ";
}
elsif (0) {
$command =
"ssh ops \"(cd emulab-devel/obj/ntpd; ".
$command = "cd emulab-devel/obj/node_usage; sudo gmake install";
}
elsif (0) {
$command = "cd emulab-devel/obj/apache; ".
"sudo gmake control-install; ".
"sudo /etc/rc.d/ntpd restart)\"";
"sudo /usr/local/etc/rc.d/apache22 restart ";
$command = "ssh ops \"($command)\"";
}
elsif (0) {
$command =
......@@ -363,24 +407,45 @@ if ($dofunc && !$install) {
" sudo scp $devel/capture-nossl ".
" vhost3.shared-nodes.emulab-ops:/usr/local/etc/emulab/capture";
}
elsif (1) {
$command = "sudo /usr/testbed/sbin/protogeni/getcacerts ";
}
elsif (0) {
$command = "/usr/testbed/sbin/wap ".
"/usr/testbed/sbin/grantimage -a -x emulab-ops,UBUNTU14-64-STD; ".
"cat $devel/stuff/fee.sql | mysql tbdb; ".
"$devel/stuff/runsonxen.pl emulab-ops,UBUNTU14-64-STD";
"/usr/testbed/sbin/grantimage -a -x emulab-ops,CENTOS63-64-STD";
}
elsif (1) {
$command = "cat $devel/stuff/fee.sql | mysql tbdb; ".
"sudo touch /usr/testbed/images/UBUNTU14-64-STD.ndz";
elsif (0) {
$command = "/usr/testbed/sbin/wap ".
"/usr/testbed/sbin/grantimage -a -x ".
" emulab-ops,UBUNTU14-OVS2.31; ".
"/usr/testbed/sbin/wap ".
" /usr/testbed/sbin/runsonxen emulab-ops,UBUNTU14-OVS2.31; ".
"/usr/testbed/sbin/imagevalidate -u emulab-ops,UBUNTU14-OVS2.31;".
"cat $devel/stuff/fee.sql | mysql tbdb";
}
elsif (0) {
$command = "cd emulab-devel/obj/; sudo gmake update-rcd";
$command = "cat $devel/stuff/fee.sql | mysql tbdb; ";
}
elsif (0) {
$command = "/usr/testbed/sbin/wap /usr/testbed/bin/editnodetype ".
"$devel/stuff/ubuntu.sql";
}
else {
elsif (0) {
$command = "/usr/testbed/sbin/wap /usr/testbed/sbin/setsitevar ".
"protogeni/default_osname UBUNTU14-64-STD";
}
elsif (0) {
$command = "sudo /usr/testbed/sbin/getimages";
}
elsif (0) {
$command =
"cat emulab-devel/emulab-devel/stuff/closed.sql | ".
"cat emulab-devel/emulab-devel/stuff/novz.sql | ".
" mysql tbdb";
}
else {
$command = "sudo /usr/testbed/sbin/testbed-control shutdown; ".
"sleep 5; sudo /usr/testbed/sbin/testbed-control boot";
}
#$command = "($command >& /tmp/function.log)";
if (SSH(($dofuncops ? $rackops : $rack), $command)) {
......
......@@ -13,11 +13,13 @@ sub usage {
print "-t type - xen or openvz\n";
exit(1);
}
my $optlist = "l:t:f:";
my $optlist = "l:t:f:c";
my $limit = 0;
my $docounts = 0;
my $type;
my $fname;
my @nodes = ();
my %osnames = ();
#
# Turn off line buffering on output
......@@ -39,11 +41,17 @@ if (defined($options{"t"})) {
}
if (defined($options{"f"})) {
$fname = $options{"f"};
if ($fname eq "docounts") {
$docounts = 1;
}
}
if (defined($options{"c"})) {
$docounts = 1;
}
usage()
if (!defined($type) || !($type eq "xen" || $type eq "openvz"));
usage()
if (!defined($fname));
if (!(defined($fname) || $docounts));
if (@ARGV) {
@nodes = @ARGV;
......@@ -52,32 +60,51 @@ else {
#
# Set the limit=1 when using the rebuild function.
#
if ($fname eq "BuildClientSide") {
if (defined($fname) && $fname eq "BuildClientSide") {
$limit = 1;
}
#
# Get list of nodes in the shared pool, for the given type.
#
my $osname = ($type eq "xen" ? "XEN43-64-STD" : "FEDORA15-OPENVZ-STD");
my $osclause;
if ($type eq "xen") {
$osclause = "(o.osname='XEN43-64-STD' or o.osname='XEN44-64-BIGFS' or ".
"o.osname='XEN44-64-GENIRACK')";
}
else {
$osclause = "o.osname='FEDORA15-OPENVZ-STD'";
}
my $query_result =
DBQueryFatal("select r.node_id,r.vname from reserved as r ".
DBQueryFatal("select r.node_id,r.vname,o.osname from reserved as r ".
"left join nodes as n on n.node_id=r.node_id ".
"left join os_info as o on o.osid=n.def_boot_osid ".
"where r.sharing_mode is not null and ".
" n.phys_nodeid=n.node_id and ".
" o.osname='$osname' order by r.node_id ".
" $osclause order by r.node_id ".
($limit ? "limit $limit" : ""));
while (my ($nodeid) = $query_result->fetchrow_array()) {
while (my ($nodeid,undef,$osname) = $query_result->fetchrow_array()) {
push(@nodes, $nodeid);
$osnames{$nodeid} = $osname;
}
}
if ($docounts) {
foreach my $nodeid (@nodes) {
my $query_result =
DBQueryFatal("select count(n.node_id) from nodes as n ".
"where n.phys_nodeid='$nodeid' and ".
" n.phys_nodeid!=n.node_id");
my ($count) = $query_result->fetchrow_array();
my $osname = $osnames{$nodeid};
print "$nodeid ($osname): $count\n";
}
exit(0);
}
print "Updating shared node: @nodes\n";
my $opts = "-q -o BatchMode=yes -o StrictHostKeyChecking=no";
my $eltb = "/users/elabman/emulab-devel";
my $objdir = ($type eq "xen" ? "obj-ubuntu12" : "obj-fc15");
my $objdir = ($type eq "xen" ? "obj-xen" : "obj-fc15");
sub echo($) { print "echo\n"; }
......@@ -125,10 +152,8 @@ sub UpdateClientSide($)
if ($?);
system("sudo ssh $opts $node ".
" 'cd $eltb/$objdir/os/imagezip; ".
" make client-install >& /tmp/install-imagezip.log; ".
" cd $eltb/$objdir/os/frisbee.redux; ".
" make client-install >& /tmp/install-frisbee.log' ");
" 'cd $eltb/$objdir/os; ".
" make client-install >& /tmp/install-os.log'");
return -1
if ($?);
......@@ -139,9 +164,29 @@ sub UpdateClientSide($)
return -1
if ($?);
system("sudo ssh $opts $node ".
" 'cd $eltb/$objdir/os/capture; ".
" make client-install >& /tmp/install.log'");
return -1
if ($?);
return 0;
}
#
# Update the client side,
#
sub UpdateSpecial($)
{
my ($node) = @_;
system("sudo ssh $opts $node ".
" 'cp -fp $eltb/emulab-devel/clientside/tmcc/common/mkvnode.pl ".
" /usr/local/etc/emulab'");
return -1
if ($?);
}
#
# Update ssl for Heartbleed.
#
......@@ -243,6 +288,59 @@ sub UpdateVZGuest($)
return 0;
}
sub EnableVIFRouting($)
{
my ($node) = @_;
system("sudo ssh $opts $node ".
" 'echo 1 >/proc/sys/net/ipv4/conf/xenbr0/proxy_arp; ".
" echo 1 >/proc/sys/net/ipv4/ip_forward; ".
" echo 1 >/proc/sys/net/ipv4/ip_nonlocal_bind'");
return -1
if ($?);
return 0;
}
sub CheckVolumes($)
{
my ($node) = @_;
system("sudo ssh $opts $node pvs");
return -1
if ($?);
return 0;
}
sub RestartClusterd($)
{
my ($node) = @_;
system("sudo ssh $opts $node killall clusterd");
sleep(1);
system("sudo ssh $opts $node /usr/local/libexec/clusterd -s event-server");
return -1
if ($?);
return 0;
}
sub FixMounts($)
{
my ($node) = @_;
system("sudo ssh $opts $node /usr/local/etc/emulab/rc/rc.mounts shutdown");
return -1
if ($?);
system("sudo ssh $opts $node /usr/local/etc/emulab/rc/rc.mounts boot");
return -1
if ($?);
return 0;
}
foreach my $node (@nodes) {
print "Doing $node ...\n";
......
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