Commit 4fe3217b authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Merge branch 'master' of git-public.flux.utah.edu:/flux/git/emulab-devel

parents f19c1266 122b6fe8
......@@ -91,9 +91,28 @@ else {
die("Tainted argument $pid!\n");
}
# Temporary ... See utils/firstuser ...
DBQueryFatal("update group_membership set pid_idx=1,gid_idx=1 ".
"where pid='$TBOPSPID' and pid=gid");
#
# XXX Fixup the pid/gid indicies for emulab-ops in various tables.
# At this point they have the values of the outer Emulab so they need
# to be reset to reflect the newly minted version here.
#
my @PIDGIDTABLES = ("group_membership", "images");
my @PIDONLYTABLES = ("os_info");
my $q = DBQueryFatal("select pid_idx from projects ".
"where pid='$TBOPSPID'");
my ($npid) = $q->fetchrow_array();
my $q = DBQueryFatal("select gid_idx from groups ".
"where pid='$TBOPSPID' and gid=pid");
my ($ngid) = $q->fetchrow_array();
foreach my $table (@PIDGIDTABLES) {
DBQueryFatal("update $table set pid_idx=$npid,gid_idx=$ngid ".
"where pid='$TBOPSPID' and pid=gid");
}
foreach my $table (@PIDONLYTABLES) {
DBQueryFatal("update $table set pid_idx=$npid where pid='$TBOPSPID'");
}
# Do not want to share the UUIDs with outer Emulab.
DBQueryFatal("update users set uid_uuid=UUID()");
......
......@@ -855,7 +855,7 @@ sub DumpDBGoo()
" Could not dump table group_membership\n");
#
# Initial images; not that these images are not going to exist inside!
# Initial images; note that these images are not going to exist inside!
#
DBQueryWarn("select * from images ".
"where pid='$pid' or (pid='$TBOPSPID' and global=1) ".
......
......@@ -1674,7 +1674,7 @@ sub print_switch
# LAN nodes, which encourages the placement of all LAN members on the same
# switch
my $types = ["switch:1"];
if (defined($MAINSITE) && $MAINSITE && $name ne "procurve1") {
if (!(defined($MAINSITE) && $MAINSITE && $name eq "procurve1")) {
push(@$types, "*lan:*");
}
print_node($name, $types, [], [], $uuid, $interfaces,
......
#!/bin/sh
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
# Copyright (c) 2000-2010 University of Utah and the Flux Group.
# All rights reserved.
#
# Optional flag argument says "do not reboot"
......@@ -84,15 +84,14 @@ tweakmbr() {
}
find_disks() {
local disks
for d in `sed -n 's/^\([a-z]*[0-9][0-9]*\): [0-9][0-9]*MB/\1/p' /var/run/dmesg.boot`; do
case $d in
ad*|da*|ar*|aacd*) disks="$disks $d"
esac
done
_DISKS=""
for d in `sed -n 's/^\([a-z]*[0-9][0-9]*\): [0-9][0-9]*MB/\1/p' /var/run/dmesg.boot`; do
case $d in
ad*|da*|ar*|aacd*) _DISKS="$_DISKS $d"
esac
done
echo $disks
echo $_DISKS
}
#
......@@ -106,22 +105,22 @@ find_disks() {
# via fdisk.
#
zapsuperblocks() {
DSK=$1
_DSK=$1
#
# Note we are not overly concerned about the consequences of misparsing
# the fdisk output. If we whack random blocks, it doesn't hurt anything.
#
offs=`fdisk -s $DSK 2>/dev/null | sed -n -e 's/^[ 0-9]*: *\([0-9]*\).*$/\1/p'`
offs=`fdisk -s $_DSK 2>/dev/null | sed -n -e 's/^[ 0-9]*: *\([0-9]*\).*$/\1/p'`
if [ x"$offs" = x ]; then
return
fi
echo -n "Invalidating old potential superblocks on $DSK: "
echo -n "Invalidating old potential superblocks on $_DSK: "
for off in $offs; do
echo -n "$off "
dd if=/dev/zero of=/dev/${DSK} oseek=$off count=16 >/dev/null 2>&1 || {
dd if=/dev/zero of=/dev/${_DSK} oseek=$off count=16 >/dev/null 2>&1 || {
echo "WARNING: failed to invalidate $off"
}
done
......@@ -134,32 +133,49 @@ zapsuperblocks() {
# Function to load a single image on a disk
#
loadone() {
LOADINFO=$1
NUM=$2
echo "Loading image #$NUM"
_LOADINFO=$1
_NUM=$2
echo "Loading image #$_NUM"
# Parse dem args
for parm in $_LOADINFO; do
case $parm in
ADDR=*|\
SERVER=*|\
PART=*|\
PARTOS=*|\
DISK=*|\
ZFILL=*|\
ACPI=*|\
ASF=*|\
MBRVERS=*|\
PREPARE=*)
# XXX need to parse better, eval is dangerous!
eval $parm
;;
*)
echo "WARNING: bad loadinfo parameter \"$parm\" ignored"
;;
esac
done
ADDRESS=`echo $LOADINFO | sed -e 's/.*ADDR=\([^[:space:]]*\).*/\1/'`
SERVER=`echo $LOADINFO | sed -e 's/.*SERVER=\([^[:space:]]*\).*/\1/'`
#
# Assign defaults where needed.
# Assumed to be set: ADDR
#
SERVER=${SERVER:-$BOSSIP}
PARTITION=`echo $LOADINFO | sed -e 's/.*PART=\([^[:space:]]*\).*/\1/'`
PARTITION=${PARTITION:-'0'}
PARTOS=`echo $LOADINFO | sed -e 's/.*PARTOS=\([^[:space:]]*\).*/\1/'`
DISK=`echo $LOADINFO | sed -e 's/.*DISK=\([^[:space:]]*\).*/\1/'`
PART=${PART:-'0'}
PARTOS=${PARTOS:-'unknown'}
DISK=${DISK:-'ad0'}
ZFILL=`echo $LOADINFO | sed -e 's/.*ZFILL=\([^[:space:]]*\).*/\1/'`
ZFILL=${ZFILL:-'0'}
ACPI=`echo $LOADINFO | sed -e 's/.*ACPI=\([^[:space:]]*\).*/\1/'`
ACPI=${ACPI:-'unknown'}
ASF=`echo $LOADINFO | sed -e 's/.*ASF=\([^[:space:]]*\).*/\1/'`
ASF=${ASF:-'unknown'}
MBR=`echo $LOADINFO | sed -e 's/.*MBRVERS=\([^[:space:]]*\).*/\1/'`
MBR=${MBR:-'1'}
PREPARE=`echo $LOADINFO | sed -e 's/.*PREPARE=\([^[:space:]]*\).*/\1/'`
MBRVERS=${MBRVERS:-'1'}
PREPARE=${PREPARE:-'0'}
if [ "$PARTITION" != "0" ]; then
SLICE="-s $PARTITION"
if [ "$PART" != "0" ]; then
SLICE="-s $PART"
case $PARTOS in
FreeBSD)
SLICE="$SLICE -D 165"
......@@ -215,12 +231,12 @@ loadone() {
(cd /dev; ./MAKEDEV $DISK ${DISK}s2a ${DISK}s3a ${DISK}s4a)
fi
if [ x"$ADDRESS" != x ]; then
isurl=`echo $ADDRESS | grep http -`
ispath=`echo $ADDRESS | grep '^/' -`
if [ x"$ADDR" != x ]; then
isurl=`echo $ADDR | grep http -`
ispath=`echo $ADDR | grep '^/' -`
if [ x"$isurl" != x ]; then
echo "Need to download $ADDRESS"
echo "Need to download $ADDR"
isurl=1
if [ ! -d /images ]; then
......@@ -231,19 +247,19 @@ loadone() {
#
# This needs a lot more work ...
#
imagefile=`echo $ADDRESS | sed -e 's,^http[s]*://[^/]*/,,'`
imagefile=`echo $ADDR | sed -e 's,^http[s]*://[^/]*/,,'`
imagefile="/images/$imagefile"
elif [ x"$ispath" != x ]; then
ispath=1
if [ ! -e $ADDRESS ]; then
echo "$ADDRESS does not exist!"
if [ ! -e $ADDR ]; then
echo "$ADDR does not exist!"
return 1
fi
imagefile="$ADDRESS"
imagefile="$ADDR"
else
PORT=`echo $ADDRESS | awk -F: '{ printf $2 }'`
MCAST=`echo $ADDRESS | awk -F: '{ printf $1 }'`
PORT=`echo $ADDR | awk -F: '{ printf $2 }'`
MCAST=`echo $ADDR | awk -F: '{ printf $1 }'`
if [ -e $BOOTDIR/myip ]; then
MCASTIF="-i `cat $BOOTDIR/myip`"
else
......@@ -283,14 +299,14 @@ loadone() {
# For slice images, ensure that the MBR is the correct version
# and replace if not.
#
if [ $NUM -eq 0 ]; then
if [ "$PARTITION" != "0" ]; then
tweakmbr $DISK $MBR
if [ $_NUM -eq 0 ]; then
if [ "$PART" != "0" ]; then
tweakmbr $DISK $MBRVERS
fi
FIRSTMBR=$MBR
FIRSTMBR=$MBRVERS
else
if [ "$FIRSTMBR" != "$MBR" ]; then
echo "MBR Mismatch: First MBR is \"$FIRSTMBR\" while image #$NUM is \"$MBR\""
if [ "$FIRSTMBR" != "$MBRVERS" ]; then
echo "MBR Mismatch: First MBR is \"$FIRSTMBR\" while image #$_NUM is \"$MBRVERS\""
fi
fi
......@@ -299,14 +315,14 @@ loadone() {
# to put it. Done after the MBR tweak of course. Then download the URL.
#
if [ $isrem -eq 1 -a $isurl -eq 1 ]; then
echo "Downloading image \'$ADDRESS\' to /images directory ..."
echo "Downloading image \'$ADDR\' to /images directory ..."
$BINDIR/mkextrafs.pl -c -s 4 -r $DISK /images || {
$BINDIR/mkextrafs.pl -n -f -s 4 -r $DISK /images || {
echo "Could not create /images partition"
return 1
}
}
wget -nv -N -P /images "$ADDRESS"
wget -nv -N -P /images "$ADDR"
wstat=$?
case $wstat in
0)
......@@ -332,14 +348,14 @@ loadone() {
# environment and at least won't hurt anything if not true.
#
if [ $PREPARE -eq 1 -o \
\( $isrem -eq 0 -a x"$ZFILL" = x -a "$PARTITION" = "0" \) ]
\( $isrem -eq 0 -a x"$ZFILL" = x -a "$PART" = "0" \) ]
then
zapsuperblocks $DISK
fi
if [ x"$imagefile" != x ]; then
echo "Running /usr/local/bin/imageunzip -o -O -W 32 $ZFILL $imagefile /dev/${DISK}s${PARTITION}"
/usr/local/bin/imageunzip -o -O -W 32 $ZFILL $imagefile /dev/${DISK}s${PARTITION}
echo "Running /usr/local/bin/imageunzip -o -O -W 32 $ZFILL $imagefile /dev/${DISK}s${PART}"
/usr/local/bin/imageunzip -o -O -W 32 $ZFILL $imagefile /dev/${DISK}s${PART}
else
echo "Running $BINDIR/frisbee -S $SERVER $MEMARGS $ZFILL $SLICE $MCASTIF $MCASTADDR /dev/$DISK at `date`"
$BINDIR/frisbee -S $SERVER $MEMARGS $ZFILL $SLICE $MCASTIF $MCASTADDR /dev/$DISK
......@@ -372,8 +388,8 @@ loadone() {
echo "Adjusting slice-related files"
export SLICEFIX_ACPI=$ACPI
export SLICEFIX_ASF=$ASF
$BINDIR/slicefix $PARTITION $DISK
echo "Image #$NUM load complete at `date`"
$BINDIR/slicefix $PART $DISK
echo "Image #$_NUM load complete at `date`"
return 0
;;
*)
......@@ -391,10 +407,6 @@ $BINDIR/tmcc state RELOADSETUP
BOSSINFO=`$BINDIR/tmcc bossinfo`
STATUS=`$BINDIR/tmcc status`
# For testing purposes.
#BOSSINFO='boss.emulab.net 155.101.128.70'
#LOADINFO='ADDR=234.5.6.69:4444'
BOSSIP=`echo $BOSSINFO | awk '{ print $2 }'`
if [ -x /usr/sbin/ntpdate ]; then
......@@ -407,14 +419,15 @@ if [ -r $BINDIR/rc.ipod ]; then
fi
#
# Break the load info into lines by setting IFS to a newline.
# Assign each line (one image) to one of the positional parameters.
# This is done by setting IFS to a newline and using set.
# XXX there must be a better way to do this!
#
OIFS=$IFS
OIFS="$IFS"
IFS='
'
set -- `$BINDIR/tmcc loadinfo`
IFS=$OIFS
IFS="$OIFS"
if [ "$1"x = x ]; then
echo "No load information for node"
exit 1
......@@ -495,7 +508,3 @@ fi
echo "Frisbee finished"
exit 0
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
# Copyright (c) 2000-2010 University of Utah and the Flux Group.
# All rights reserved.
#
include("defs.php3");
......@@ -112,7 +112,8 @@ else {
}
elseif (! ($group = Group::LookupByPidGid($formfields["exp_pid"],
$formfields["exp_gid"]))) {
$errors["Group"] = "Group '$exp_gid' is not in project '$exp_pid'";
$errors["Group"] = "Group '" . $formfields["exp_gid"] .
"' is not in project '" . $formfields["exp_pid"]. "'";
}
}
else {
......
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
# Copyright (c) 2000-2010 University of Utah and the Flux Group.
# All rights reserved.
#
# Stuff to support checking field data before we insert it into the DB.
......@@ -336,3 +336,4 @@ function TBvalid_archive_message($token) {
return TBcheck_dbslot($token, "archive_tags", "description",
TBDB_CHECKDBSLOT_WARN|TBDB_CHECKDBSLOT_ERROR);
}
?>
......@@ -1580,5 +1580,4 @@ function ShowExperimentList_internal($templates_only,
}
return $html;
}
?>
......@@ -382,4 +382,4 @@ class ClientSliver
return $result;
}
}
?>
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2006-2008 University of Utah and the Flux Group.
# Copyright (c) 2006-2010 University of Utah and the Flux Group.
# All rights reserved.
#
#
......@@ -1269,4 +1269,4 @@ function TBGrpTrust($uid, $pid, $gid)
}
return $group->UserTrust($user);
}
?>
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2006-2009 University of Utah and the Flux Group.
# Copyright (c) 2006-2010 University of Utah and the Flux Group.
# All rights reserved.
#
include_once("osinfo_defs.php");
......@@ -1591,4 +1591,4 @@ function ShowFreeNodes($user, $group)
$output .= "</table>";
return $output;
}
?>
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
# Copyright (c) 2000-2010 University of Utah and the Flux Group.
# All rights reserved.
#
include("defs.php3");
......@@ -105,4 +105,3 @@ echo "keylen: $keylen\n";
echo "key: $keydata\n";
echo "ssl-server-cert: $certhash\n";
?>
......@@ -541,4 +541,4 @@ function SpitOSIDLink($osid)
echo "<a href='$url'>$osname</a>\n";
}
}
?>
......@@ -921,3 +921,4 @@ class Project
}
}
?>
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2006, 2007 University of Utah and the Flux Group.
# Copyright (c) 2010 University of Utah and the Flux Group.
# All rights reserved.
#
# Emulate register_globals off on the fly.
......@@ -48,3 +48,4 @@ function EmulateRegisterGlobals()
}
EmulateRegisterGlobals();
?>
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2006, 2007, 2008, 2009, 2010 University of Utah and the Flux Group.
# Copyright (c) 2006-2010 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -745,5 +745,4 @@ function ValidateArgument($name, $arg)
}
return 0;
}
?>
......@@ -1355,3 +1355,4 @@ class User
return 0;
}
}
?>
Supports Markdown
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