Commit 3eb35d57 authored by Leigh B Stoller's avatar Leigh B Stoller

Pass back an optional USEWEB flag to override local decision.

Better for VMs where there might not be NFS access (as in Utah),
and because in general, using NFS is bad, use the web server
instead.
parent 559968e3
......@@ -46,4 +46,4 @@
* it in clientside/tmcc/common/libsetup.pm!
*/
#define DEFAULT_VERSION 2
#define CURRENT_VERSION 36
#define CURRENT_VERSION 37
#!/usr/bin/perl -w
#
# Copyright (c) 2004-2012 University of Utah and the Flux Group.
# Copyright (c) 2004-2013 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -130,13 +130,21 @@ sub doboot()
# to NFS mounted FSes.
#
my $MAXCPSIZE = (256 * 1024 * 1024);
my $useweb = (REMOTE() || SHADOW() || WINDOWS()) ? 1 : 0;
foreach my $rpm (@rpms) {
if ($rpm =~ /(?:SERVER=(\S+)\s+)?RPM=(.+)/) {
my $server = $1;
my $rpm = $2;
my $useweb = (REMOTE() || SHADOW() || WINDOWS()) ? 1 : 0;
if ($rpm =~ /SERVER=(\S+)\s+RPM=(.+)/ ||
$rpm =~ /SERVER=(\S+)\s+USEWEB=(\d)\s+RPM=(.+)/) {
my $server = $1;
my $rpm;
if (defined($3)) {
$rpm = $3;
$useweb = $2;
}
else {
$rpm = $2;
}
my $installoption = $useweb ? "-t" : "-c";
#
......
#!/usr/bin/perl -w
#
# Copyright (c) 2004-2012 University of Utah and the Flux Group.
# Copyright (c) 2004-2013 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -124,20 +124,31 @@ sub doboot()
# Option to install-tarfile: Locally, always use the copy (-c) option
# to get the file via NFS, but avoid the stupid changing-exports-file
# server race (install-tarfile knows how to deal with said race).
# Remote nodes get the tarfile via the network (-t) option.
# Remote nodes get the tarfile via the network (-t) option, or if
# the server overrides.
#
# Note: Windows also uses the -t option since root does not have access
# to NFS mounted FSes.
#
my $MAXCPSIZE = (256 * 1024 * 1024);
my $useweb = (REMOTE() || SHADOW() || WINDOWS()) ? 1 : 0;
foreach my $tarball (@tarballs) {
if ($tarball =~ /(?:SERVER=(\S+)\s+)?DIR=(.+)\s+TARBALL=(.+)/) {
my $useweb = (REMOTE() || SHADOW() || WINDOWS()) ? 1 : 0;
if ($tarball =~ /SERVER=(\S+)\s+DIR=(.+)\s+TARBALL=(.+)/ ||
$tarball =~ /SERVER=(\S+)\s+USEWEB=(\d)\s+DIR=(.+)\s+TARBALL=(.+)/){
my $server = $1;
my $idir = $2;
my $tball = $3;
my $idir;
my $tball;
if (defined($4)) {
$useweb = $2;
$idir = $3;
$tball = $4;
}
else {
$idir = $2;
$tball = $3;
}
my $installoption = $useweb ? "-t" : "-c";
#
......
......@@ -81,7 +81,7 @@ use librc;
# IMPORTANT NOTE: if you change the version here, you must also change it
# in clientside/lib/tmcd/tmcd.h!
#
sub TMCD_VERSION() { 36; };
sub TMCD_VERSION() { 37; };
libtmcc::configtmcc("version", TMCD_VERSION());
# Control tmcc timeout.
......
......@@ -3798,13 +3798,19 @@ COMMAND_PROTOTYPE(dorpms)
bp = row[0];
sp = bp;
do {
char *bufp = buf, *ebufp = &buf[sizeof(buf)];
bp = strsep(&sp, ":");
if (vers < 36) {
OUTPUT(buf, sizeof(buf), "RPM=%s\n", bp);
} else {
OUTPUT(buf, sizeof(buf), "SERVER=%s RPM=%s\n",
srv, bp);
}
else {
bufp += OUTPUT(bufp, ebufp - bufp, "SERVER=%s ", srv);
if (vers >= 37 &&
reqp->sharing_mode[0] && reqp->isvnode) {
bufp += OUTPUT(bufp, ebufp - bufp, "USEWEB=1 ");
}
OUTPUT(bufp, ebufp - bufp, "RPM=%s\n", bp);
}
client_writeback(sock, buf, strlen(buf), tcp);
if (verbose)
......@@ -3855,6 +3861,8 @@ COMMAND_PROTOTYPE(dotarballs)
bp = row[0];
sp = bp;
do {
char *bufp = buf, *ebufp = &buf[sizeof(buf)];
bp = strsep(&sp, ":");
if ((tp = strchr(bp, ' ')) == NULL)
continue;
......@@ -3864,8 +3872,14 @@ COMMAND_PROTOTYPE(dotarballs)
OUTPUT(buf, sizeof(buf),
"DIR=%s TARBALL=%s\n", bp, tp);
} else {
OUTPUT(buf, sizeof(buf),
"SERVER=%s DIR=%s TARBALL=%s\n", srv, bp, tp);
bufp += OUTPUT(bufp, ebufp - bufp, "SERVER=%s ", srv);
if (vers >= 37 &&
reqp->sharing_mode[0] && reqp->isvnode) {
bufp += OUTPUT(bufp,
ebufp - bufp, "USEWEB=1 ");
}
OUTPUT(bufp, ebufp - bufp,
"DIR=%s TARBALL=%s\n", bp, tp);
}
client_writeback(sock, buf, strlen(buf), tcp);
if (verbose)
......
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