Commit 5e1b1523 authored by Leigh Stoller's avatar Leigh Stoller

Add an update script to get all of the shared node support in place.

parent 3bf715b3
......@@ -46,7 +46,6 @@ my $FRISADDR = '@FRISEBEEMCASTADDR@';
#
# Fixed paths for clients
#
my $PROJROOT = "@PROJROOT_DIR@";
my $GROUPROOT = "@GROUPSROOT_DIR@";
my $USERROOT = "@USERSROOT_DIR@";
my $SCRATCHROOT = "@SCRATCHROOT_DIR@";
......@@ -94,7 +93,6 @@ my $SYSLOG_CONF = "/etc/syslog.conf";
my $NEWSYSLOG_CONF = "/etc/newsyslog.conf";
my $INETD_CONF = "/etc/inetd.conf";
my $PROTOUSER = "elabman";
my $PROTOUSER_KEY = "$TOP_SRCDIR/install/elabman_dsa.pub";
my $ROOT_PRIVKEY = "/root/.ssh/id_rsa";
my $ROOT_PUBKEY = "$ROOT_PRIVKEY.pub";
......@@ -111,7 +109,6 @@ my $DHCPD_TEMPLATE = "/usr/local/etc/dhcpd.conf.template";
my $DHCPD_LEASES = "/var/db/dhcpd.leases";
my $DHCPD_MAKECONF = "$PREFIX/sbin/dhcpd_makeconf";
my $BATCHEXP = "$PREFIX/bin/batchexp";
my $WAP = "$PREFIX/sbin/withadminprivs";
my $NAMED_SETUP = "$PREFIX/sbin/named_setup";
my $ADDPUBKEY = "$PREFIX/sbin/addpubkey";
my $TBACCT = "$PREFIX/sbin/tbacct";
......
......@@ -35,7 +35,6 @@ my $SCRATCHDIR = '@FSDIR_SCRATCH@';
#
# Fixed paths for clients
#
my $PROJROOT = "@PROJROOT_DIR@";
my $GROUPROOT = "@GROUPSROOT_DIR@";
my $USERROOT = "@USERSROOT_DIR@";
my $SCRATCHROOT = "@SCRATCHROOT_DIR@";
......
......@@ -13,12 +13,14 @@ use Exporter;
use vars qw(@EXPORT $TOP_OBJDIR $TOP_SRCDIR
$TBROOT $LOGDIR $MAINSITE $PGENISUPPORT $GMAKE $PKG_INFO
$PORTSDIR $VARRUN $RCDIR $MYSQL $DBNAME
$PROJROOT $PROTOUSER $WAP
$SQL_UPDATE_MAJOR_REVISION $INSTALL_UPDATE_MAJOR_REVISION
$HAVE_XERCES);
@EXPORT = qw($TOP_OBJDIR $TOP_SRCDIR
$TBROOT $LOGDIR $MAINSITE $PGENISUPPORT $GMAKE $PKG_INFO
$PORTSDIR $VARRUN $RCDIR $MYSQL $DBNAME
$PROJROOT $PROTOUSER $WAP
$SQL_UPDATE_MAJOR_REVISION $INSTALL_UPDATE_MAJOR_REVISION
$HAVE_XERCES);
......@@ -31,9 +33,12 @@ $MAINSITE = @TBMAINSITE@;
$PGENISUPPORT = @PROTOGENI_SUPPORT@;
$GMAKE = "/usr/local/bin/gmake";
$PKG_INFO = "/usr/sbin/pkg_info";
$WAP = "$TBROOT/sbin/withadminprivs";
$PORTSDIR = "/usr/ports";
$VARRUN = "/var/run";
$RCDIR = "/usr/local/etc/rc.d";
$PROJROOT = "@PROJROOT_DIR@";
$PROTOUSER = "elabman";
$DBNAME = "@TBDBNAME@";
$MYSQL = "/usr/local/bin/mysql";
......@@ -83,6 +88,10 @@ $TOP_OBJDIR = `/usr/bin/dirname $0`;
chomp $TOP_OBJDIR;
$TOP_OBJDIR = "$TOP_OBJDIR/..";
# Real path to the source dir.
$TOP_SRCDIR = `realpath $TOP_SRCDIR`;
chomp $TOP_SRCDIR;
#
# Let's pretend perl's exception mechanism has a sane name for the function
# that raises an exception
......
......@@ -52,7 +52,6 @@ if ($OUTER_BOSS eq '')
#
# Fixed paths for clients
#
my $PROJROOT = "@PROJROOT_DIR@";
my $GROUPROOT = "@GROUPSROOT_DIR@";
my $USERROOT = "@USERSROOT_DIR@";
my $SCRATCHROOT = "@SCRATCHROOT_DIR@";
......
#
# Do things to set up shared node support.
#
use strict;
use libinstall;
my $EID = "shared-nodes";
my $SUDO = "/usr/local/bin/sudo";
my $BATCHEXP = "$TBROOT/bin/batchexp";
my $IDIR = "$TOP_OBJDIR/install";
my $DUMPDESC = "$TBROOT/sbin/dumpdescriptor";
my $LOADDESC = "$IDIR/load-descriptors";
my $DESCRIPTORS = "$TOP_SRCDIR/install/descriptors-sh.xml";
sub InstallUpdate($$)
{
my ($version, $phase) = @_;
my $pid = "emulab-ops";
#
# If something should run in the pre-install phase.
#
if ($phase eq "pre") {
Phase "shared-nodes", "Setting up shared node support", sub {
#
# This experiment is in the usual state; swapped. The pool
# daemon will not do anything until it comes out of this
# state, since we do not want the pool daemon to add shared
# nodes unless the local testbed actually wants them. A
# local administrator will have to do the first swap in by
# running the pool daemon with the -s option.
#
Phase "experiment", "Creating shared node experiment", sub {
PhaseSkip("Experiment exists")
if (-d "$PROJROOT/$pid/exp/$EID");
ExecQuietFatal("$SUDO -u $PROTOUSER $WAP $BATCHEXP ".
" -q -i -k -j -w -f -n ".
" -S 'System Experiment' ".
" -L 'System Experiment' ".
" -E 'Nodes in shared mode - DO NOT DELETE' ".
" -p $pid -e $EID");
};
#
# An administrator will need to go into the web interface
# and edit the descriptors to add the appropriate node types.
#
Phase "descriptors", "Creating shared node descriptors", sub {
PhaseSkip("Descriptors exist")
if (ExecQuiet("$DUMPDESC -o $pid,OPENVZ-STD") == 0);
ExecQuietFatal("$SUDO -u $PROTOUSER $WAP ".
" perl $LOADDESC $DESCRIPTORS");
};
#
# An administrator will need to set these three sitevars
# to something appropriate for the local site.
#
# general/maxpoolsize
# general/minpoolsize
# general/poolnodetype
#
# And then check the node_auxtypes table to make sure that
# nodes have a reasonable setting for the pcvm count. If
# everything is 0, then the virtnode_capacity setting for that
# node type is not set, and you need to go edit that type in
# the web interface, and then update all of the existing entries
# in the node_auxtypes table:
#
# mysql> update node_auxtypes set count='NN' where type='pcvm';
#
};
}
#
# If something should run in the post-install phase.
#
if ($phase eq "post") {
}
return 0;
}
1;
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