Commit e947b1c0 authored by Jonathon Duerig's avatar Jonathon Duerig
Browse files

Merge remote-tracking branch 'devel/master' into no-require

parents d6ab8c1d be32d92a
......@@ -235,6 +235,8 @@ endif
subboss:
@$(MAKE) -C clientside subboss
@$(MAKE) -C tbsetup subboss
@$(MAKE) -C db subboss
@$(MAKE) -C os subboss
ifneq ($(SYSTEM),CYGWIN_NT-5.1)
@$(MAKE) -C tip client
......@@ -243,6 +245,7 @@ endif
subboss-install: subboss
@$(MAKE) -C clientside subboss-install
@$(MAKE) -C tbsetup subboss-install
@$(MAKE) -C os subboss-install
ifneq ($(SYSTEM),CYGWIN_NT-5.1)
@$(MAKE) -C tip client-install
......
......@@ -111,7 +111,7 @@ default-clean:
# This is to avoid warnings about duplicate targets.
default-install-notusing:
ifeq ($(ISMAINSITE),1)
ifeq ($(TBROOT),/usr/testbed/devel/stoller)
ifeq ($(TBROOT),/usr/testbed)
(cd $(SRCDIR) ; \
git status --porcelain -s -b | head -1 | grep -q -s current)
else
......
......@@ -422,13 +422,13 @@ sub ParseKey($) {
$key = $1;
}
elsif ($keyline =~
/^(ssh-rsa|ssh-dss) ([-\w\.\@\+\/\=]*) ([-\w\@\.:\ ]*)$/) {
/^(ssh-rsa|ssh-dss|ssh-ed25519) ([-\w\.\@\+\/\=]*) ([-\w\@\.:\ ]*)$/) {
# Protocol 2
$type = $1;
$key = "$1 $2";
$comment = $3;
}
elsif ($keyline =~ /^(ssh-rsa|ssh-dss) ([-\w\.\@\+\/\=:]*)$/) {
elsif ($keyline =~ /^(ssh-rsa|ssh-dss|ssh-ed25519) ([-\w\.\@\+\/\=:]*)$/) {
# Protocol 2 but no comment field
$type = $1;
$key = "$1 $2";
......
How to setup update the genilib-jail environment.
We use a combination of iocage and our own hand-rolled script to efficiently
spawn up environments in which we can interpret geni-lib scripts. Right now
we only have to do this at Utah, but down the road, if other sites start
running their own portal, this will be needed.
0. Convert your ops node to using ZFS.
Ugh.
1. Make sure the "iocage" package is installed.
We are using version 1.7.4.
pkg install iocage
2. Setup the "base" jail.
iocage fetch release=10.2-RELEASE
iocage create -c release=10.2-RELEASE tag=py-cage-new
# if you want to be able to start it up with IP addr
iocage set ip4_addr='ix0|155.98.33.87' py-cage-new
iocage set host_hostname='py-cage-new.emulab.net' py-cage-new
iocage set compression=off py-cage-new
iocage set quota=10G py-cage-new
3. Install packages:
cd /iocage/jails/<UUID>/root
chroot . pkg install ca_root_nss
cat >etc/pkg/Emulab-devel.conf <<EOF
Emulab-devel: {
url: "https://www.emulab.net/FreeBSD/10.2-devel/packages",
mirror_type: NONE,
enabled: yes
}
EOF
chroot . pkg install -r Emulab-devel emulab-genilib
4. Make it a template
iocage set template=yes py-cage-new
Updating your iocage:
1. Fetch the appropriate release:
sudo iocage fetch release=10.2-RELEASE
......@@ -118,7 +118,7 @@ use Experiment;
use User;
use Project;
use Group;
use OSinfo;
use Image;
use emutil;
use libEmulab;
use GeniDB;
......
......@@ -50,7 +50,8 @@ sub usage()
print("Usage: manage_instance linktest instance [-k | level]\n");
print("Usage: manage_instance writecreds instance directory\n");
print("Usage: manage_instance updatekeys instance [uid] \n");
print("Usage: manage_instance extend instance [-m message] days [filename]\n");
print("Usage: manage_instance extend instance ".
"[-M] [-m message | -f filename] days\n");
print("Usage: manage_instance denyextension instance [-m message] [filename]\n");
print("Usage: manage_instance checkreservation instance days\n");
print("Usage: manage_instance maxextension instance\n");
......@@ -1240,25 +1241,28 @@ sub DoExtend()
my $extensions = $instance->Brand()->ExtensionsEmailAddress();
my $granted = 0;
my $needapproval = 0;
my $inhours = 0;
my $message;
my $reason;
my $errmsg;
usage()
if (!@ARGV);
my $optlist = "m:f:h";
my %options = ();
if (! getopts($optlist, \%options)) {
usage();
}
usage()
if (!@ARGV);
my $wanted = shift(@ARGV);
if (@ARGV == 2) {
my $arg = shift(@ARGV);
if ($arg eq "-m") {
$reason = shift(@ARGV);
}
else {
usage();
}
if (defined($options{"m"})) {
$reason = $options{"m"};
}
elsif (@ARGV == 1) {
my $filename = shift(@ARGV);
elsif (defined($options{"f"})) {
my $filename = $options{"f"};
if (! -e $filename) {
fatal("$filename does not exist");
}
......@@ -1271,6 +1275,9 @@ sub DoExtend()
}
close(MSG);
}
if (defined($options{"h"})) {
$inhours = 1;
}
#
# Create the webtask object; the web interface gave us an anonymous
# webtask, so we can use it before lock.
......@@ -1352,10 +1359,22 @@ sub DoExtend()
$autoextend_maximum *= 2;
}
#
# If extension is in hours, always grant if < 24 hours.
#
if ($inhours) {
if ($wanted >= 24) {
$errmsg = "If you want more then 24 hours, use days instead.";
goto bad;
}
$message = "Short extension granted for $wanted hours.";
$reason = $message;
$granted = $wanted;
}
#
# Guest users are treated differently.
#
if (!defined($this_user)) {
elsif (!defined($this_user)) {
# Only extend for 24 hours.
$granted = 1;
......@@ -1466,8 +1485,10 @@ sub DoExtend()
# Do the extension.
#
if ($granted) {
if ($errcode = ExtendInternal($slice,
$granted * 3600 * 24, 0, \$errmsg)) {
my $seconds = $granted * 3600;
$seconds *= 24 if (!$inhours);
if ($errcode = ExtendInternal($slice, $seconds, 0, \$errmsg)) {
goto bad;
}
}
......@@ -1478,6 +1499,16 @@ sub DoExtend()
my $now = POSIX::strftime("20%y-%m-%d %H:%M:%S %Z", localtime());
my $before = POSIX::strftime("20%y-%m-%d %H:%M:%S %Z",
localtime($expires_time));
#
# XXX If in hours, change to 1. Need to come back and fix this.
# Make these fields in the database hours or seconds.
#
if ($inhours) {
$wanted = 1;
$granted = 1;
}
#
# New extension mechanism
#
......
#!/usr/bin/perl -wT
#
# Copyright (c) 2000-2014 University of Utah and the Flux Group.
# Copyright (c) 2000-2016 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -67,7 +67,7 @@ use libdb;
use libtestbed;
use User;
use Project;
use Image;
use OSImage;
# Protos
sub fatal($);
......@@ -161,6 +161,7 @@ my %xmlfields =
"mtype_*" => ["mtype", $SLOT_OPTIONAL],
"hash", => ["hash", $SLOT_ADMINONLY],
"notes", => ["notes", $SLOT_ADMINONLY],
"architecture" => ["architecture", $SLOT_OPTIONAL],
);
#
# Need a list of node types. We join this over the nodes table so that
......@@ -319,8 +320,8 @@ UserError()
# Now do special checks.
#
my $image = Image->Lookup($editimageid_args{"imageid"},
$editimageid_args{"version"});
my $image = OSImage->Lookup($editimageid_args{"imageid"},
$editimageid_args{"version"});
if (!defined($image)) {
UserError("Image: No such image");
}
......@@ -369,6 +370,16 @@ if (!$isadmin && exists($editimageid_args{"path"})) {
}
}
if ($image->architecture() ||
(exists($editimageid_args{"architecture"}) &&
$editimageid_args{"architecture"} ne "")) {
foreach my $arch (split(",", $editimageid_args{"architecture"})) {
if (!exists($OSImage::IMAGE_ARCHITECTURES{$arch})) {
UserError("Architecture: Not a valid Architecture: $arch");
}
}
}
else {
#
# See what node types this image will work on. Must be at least one!
#
......@@ -446,7 +457,7 @@ if (defined($osidclause)) {
" and make the necessary changes!\n $msg");
}
}
}
exit(0)
if ($verify);
......@@ -459,8 +470,8 @@ exit(0)
delete($editimageid_args{"imageid"});
my $usrerr;
my $editimageid_val = Image->EditImageid($image,
\%editimageid_args, \$usrerr);
my $editimageid_val = OSImage->EditImageid($image,
\%editimageid_args, \$usrerr);
UserError($usrerr)
if (defined($usrerr));
fatal("Could not create new Image!")
......
#!/usr/bin/perl -wT
#
# Copyright (c) 2000-2014 University of Utah and the Flux Group.
# Copyright (c) 2000-2016 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -68,7 +68,6 @@ use libdb;
use libtestbed;
use User;
use Project;
use OSinfo;
# Protos
sub fatal($);
......@@ -161,6 +160,8 @@ my %xmlfields =
# Class may only be changed while making a new class.
"class" => ["class", $SLOT_OPTIONAL],
"architecture" => ["architecture", $SLOT_OPTIONAL],
# Fixed attributes.
"isvirtnode" => ["isvirtnode", $SLOT_OPTIONAL],
......@@ -374,6 +375,12 @@ if (exists($editnodetype_args{"class"})) {
}
}
if (exists($editnodetype_args{"architecture"})) {
my $architecture = $editnodetype_args{"architecture"};
push(@nodetype_data, "architecture='$architecture'");
}
# The rest of them all have names starting with "is" at present.
my @fixed_args = grep(/^is/, keys(%editnodetype_args));
foreach my $name (@fixed_args) {
......
#!/usr/bin/perl -w
#
# Copyright (c) 2000-2015 University of Utah and the Flux Group.
# Copyright (c) 2000-2016 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -77,6 +77,7 @@ use libdb;
use libtestbed;
use User;
use Project;
use OSImage;
use Image;
use OSinfo;
use Node;
......@@ -223,6 +224,7 @@ my %xmlfields =
"lba_low", => ["lba_low", $SLOT_OPTIONAL],
"lba_high", => ["lba_high", $SLOT_OPTIONAL],
"lba_size", => ["lba_size", $SLOT_OPTIONAL],
"architecture", => ["architecture", $SLOT_OPTIONAL],
);
#
......@@ -420,7 +422,8 @@ if ($allpc) {
}
}
else {
$types_querystring = "select distinct n.type,nt.class from nodes as n ".
$types_querystring =
"select distinct n.type,nt.class,nt.architecture from nodes as n ".
"left join node_types as nt on n.type=nt.type ".
"left join node_type_attributes as a on a.type=n.type ".
"where a.attrkey='imageable' and ".
......@@ -433,9 +436,11 @@ my $types_result = DBQueryFatal($types_querystring);
# Save the valid types in a new array for later.
my %mtypes_array;
my %mtypes_arch;
if ($types_result->numrows) {
while (my ($type,$class) = $types_result->fetchrow_array()) {
while (my ($type,$class,$arch) = $types_result->fetchrow_array()) {
$mtypes_arch{$type} = $arch if (defined($arch));
$mtypes_array{$type} = $class;
$xmlfields{"mtype_$type"} = ["mtype", $SLOT_OPTIONAL];
}
......@@ -642,81 +647,67 @@ if (!$isdataset &&
#
# See what node types this image will work on. Must be at least one!
#
UserError("Node Types: Must have at least one node type")
UserError("Node Types: Must have at least one node type defined")
if (!$isdataset && !keys(%mtypes_array));
my $node_types_selected = 0;
# Check validity of mtype_* args, since the keys are dynamically generated.
my @mtype_keys = grep(/^mtype_/, keys(%newimageid_args));
foreach $key (@mtype_keys) {
my $value = $newimageid_args{$key};
print STDERR "mtype: '$key' -> '$value'\n"
if ($debug);
my $node_types_selected = 0;
my $type = $key;
$type =~ s/^mtype_//;
# Treat pcvm special for now.
if ($type eq "pcvm" ||
grep(/^${type}$/, keys(%mtypes_array))) {
$node_types_selected++
if ($value eq "1");
}
else {
$errors{$key} = "Illegal node type."
}
}
#
# When -a specified, add mappings for all pc types, does not matter if
# there are nodes of that type. Skip the stub pc/pc entry though.
# If we have architectures defined in the node_types table, and we got
# an architecture in the xml file for the image, we use those. Otherwise
# fall back to the old method.
#
if ($allpc) {
foreach my $type (keys(%mtypes_array)) {
my $class = $mtypes_array{$type};
next
if ($class ne "pc" || $type eq $class);
if (keys(%mtypes_arch) &&
(exists($newimageid_args{"architecture"}) &&
$newimageid_args{"architecture"} ne "")) {
$newimageid_args{"mtype_${type}"} = "1";
$node_types_selected++;
foreach my $arch (split(",", $newimageid_args{"architecture"})) {
if (!exists($OSImage::IMAGE_ARCHITECTURES{$arch})) {
UserError("Architecture: Not a valid Architecture: $arch");
}
}
}
else {
# Clear this since not using Architectures
delete($newimageid_args{"architecture"})
if (exists($newimageid_args{"architecture"}));
# Check validity of mtype_* args, since the keys are dynamically generated.
my @mtype_keys = grep(/^mtype_/, keys(%newimageid_args));
foreach $key (@mtype_keys) {
my $value = $newimageid_args{$key};
print STDERR "mtype: '$key' -> '$value'\n"
if ($debug);
my $type = $key;
$type =~ s/^mtype_//;
# Treat pcvm special for now.
if ($type eq "pcvm" ||
grep(/^${type}$/, keys(%mtypes_array))) {
$node_types_selected++
if ($value eq "1");
}
else {
$errors{$key} = "Illegal node type."
}
}
#
# When -a specified, add mappings for all pc types, does not matter if
# there are nodes of that type. Skip the stub pc/pc entry though.
#
if ($allpc) {
foreach my $type (keys(%mtypes_array)) {
my $class = $mtypes_array{$type};
next
if ($class ne "pc" || $type eq $class);
UserError("Node Types: Must select at least one node type")
if ($node_types_selected == 0 && !($force || $isdataset));
#
# We perform a further check for non-admins. When a node to snapshot
# has been specified, we check the OSID of the appropriate partition
# and see which node types it is appropriate for, and further restrict
# the list as necessary. This prevents creation of custom images based on
# old OSes from being checked as runnable on newer HW where they do not
# stand a chance.
#
if (!($isadmin || $isdataset) && defined($node) && !$node->isvirtnode()) {
my $query_result =
DBQueryFatal("select oi.type from osidtoimageid as oi ".
"left join partitions as p on oi.osid=p.osid ".
"where p.node_id='$node_id' and p.partition=$loadpart");
if ($query_result->numrows != 0) {
my %otypes;
while (my ($ntype) = $query_result->fetchrow_array()) {
$otypes{$ntype} = 1;
$newimageid_args{"mtype_${type}"} = "1";
$node_types_selected++;
}
my @invalid_node_types;
foreach my $ntype (@mtype_keys) {
$ntype =~ s/^mtype_//;
if (!exists($otypes{$ntype})) {
push @invalid_node_types, $ntype;
}
}
if (@invalid_node_types) {
UserError("Node Types: Current image on $node_id".
" cannot run on the following node types: ".
join(' ', @invalid_node_types));
}
} else {
UserError("Partition: No image originally loaded in partition $loadpart on $node_id; this is probably not the partition you meant to save");
}
UserError("Node Types: Must select at least one node type")
if ($node_types_selected == 0 && !($force || $isdataset));
}
# XXX Allowable OS types, OS features, and OpModes need to be
......@@ -787,13 +778,6 @@ if (!$isdataset) {
fatal("Could not create new OSID!")
if (!defined($new_osinfo));
#
# Insert a submap entry.
#
if (defined($parentos)) {
$new_osinfo->SetRunsOnParent($parentos);
}
$newimageid_args{"path"} = $ipath;
$osid = $new_osinfo->osid();
......
#!/usr/bin/perl -wT
#
# Copyright (c) 2011-2013 University of Utah and the Flux Group.
# Copyright (c) 2011-2016 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -72,7 +72,6 @@ use libdb;
use libtestbed;
use User;
use Project;
use OSinfo;
use EmulabFeatures;
# Protos
......
#!/usr/bin/perl -w
#
# Copyright (c) 2000-2011 University of Utah and the Flux Group.
# Copyright (c) 2000-2016 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -37,11 +37,11 @@ use POSIX ":sys_wait_h";
#
sub usage()
{
print "Usage: linktest.proxy [-d level] -u user -p unix_pid -g unix_gid -e pid/eid ".
print "Usage: linktest.proxy [-d level] [-N] -u user -p unix_pid -g unix_gid -e pid/eid ".
"-l level -o logfile -t timeout -r\n";
exit(-1);
}
my $optlist = "d:u:g:e:l:o:t:rp:";
my $optlist = "d:u:g:e:l:o:t:rp:N";
my $debug = 0;
my $user;
my $pid;
......@@ -50,6 +50,7 @@ my $level;
my $logfile;
my $timeout;
my $reportonly = 0;
my $nonfs = 0;
my $unix_gid;
my $unix_pid;
......@@ -128,6 +129,9 @@ if (defined($options{"o"})) {
if (defined($options{"r"})) {
$reportonly = $options{"r"};
}
if (defined($options{"N"})) {
$nonfs = 1
}
#
# Okay, now flip to user before running linktest. Must put the user
......@@ -163,6 +167,8 @@ push(@cmdandargs, ("-o", $output))
if (defined($output));
push(@cmdandargs, "-r")
if ($reportonly);
push(@cmdandargs, "-N")
if ($nonfs);
exec(@cmdandargs);
die("*** $0:\n".
......
......@@ -42,17 +42,19 @@ sub usage()
"-o - Specify output file for linktest results.\n".
"-e - Tell linktest to send error output to stdout or -o file\n".
"-m - Send email to swapper if linktest fails.\n".
"-N - Use loghole instead of NFS shared directory\n".
"-r - Report results only, don't flag errors.\n".
"-d - Turn on debugging output.\n");
exit(-1);
}
my $optlist = "dkl:o:t:mfre";
my $optlist = "dkl:o:t:mfreN";
my $debug = 1;
my $cancel = 0;
my $sendmail = 0;
my $forcerun = 0;
my $reportonly = 0;
my $noerrlog = 0;
my $nonfs = 0;
my $timeout;
my $level;
my $output;
......@@ -105,6 +107,9 @@ if (defined($options{"d"})) {
if (defined($options{"m"})) {
$sendmail = 1;
}
if (defined($options{"N"})) {
$nonfs = 1;
}
if (defined($options{"r"})) {
$reportonly = 1;
}
......@@ -357,6 +362,8 @@ push(@cmdargs, ("-o", $errlog))
if (!$noerrlog);
push(@cmdargs, "-r")
if ($reportonly);
push(@cmdargs, "-N")
if ($nonfs);
print "Running '@cmdargs'\n"
if ($debug > 1);
......
#!/usr/bin/perl -wT
#
# Copyright (c) 2000-2012 University of Utah and the Flux Group.
# Copyright (c) 2000-2016 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -255,7 +255,7 @@ if (!defined($keyfile)) {