Commit 995e99f1 authored by Jonathon Duerig's avatar Jonathon Duerig
Browse files

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

parents 613a0ea4 21b06bea
......@@ -30,7 +30,7 @@ include Makeconf
# Then things that depend on stuff we just did:
#
ifeq ($(STANDALONE_CLEARINGHOUSE),0)
SUBDIRS = lib apache db assign www @optional_subdirs@ ipod security sensors \
SUBDIRS = lib db assign www @optional_subdirs@ ipod security sensors \
pxe tbsetup account tmcd utils backend tip capture ipod vis \
sensors os xmlrpc install/newnode_sshkeys mote tools/whol \
tools/svn wiki bugdb collab protogeni node_usage install
......
#
# EMULAB-COPYRIGHT
# Copyright (c) 2002-2007, 2010 University of Utah and the Flux Group.
# Copyright (c) 2002-2010 University of Utah and the Flux Group.
# All rights reserved.
#
#
......@@ -54,6 +54,12 @@ httpd.conf.fixed: httpd.conf
install-dirs:
-mkdir -p $(INSTALL_TOPDIR)/www
#
# Well, this is awkward. Make sure we don't try to install anything from
# a dev tree both because it doesn't make any sense and because it would
# clobber the "real" version.
#
ifeq ($(TBROOT),/usr/testbed)
#
# XXX another woeful hack. There appears to be a well-documented problem
# with Apache and PHP4, where loading PHP with certain extensions will cause
......@@ -78,5 +84,9 @@ install: install-dirs install-scripts httpd.conf.fixed
control-install: install-dirs install-scripts httpd.conf-ops
$(INSTALL_DATA) httpd.conf-ops $(INSTALL_APACHE_CONFIG)/httpd.conf
else
install-scripts install control-install:
@echo "Cannot install Apache config in dev tree"
endif
clean:
......@@ -464,12 +464,11 @@ elsif (! $isadmin) {
#
UserError("Node Types: Must have at least one node type")
if ($#mtypes_array < 0);
my $typeclause = join(" or ", map("type='$_'", @mtypes_array));
# Check validity of mtype_* args, since the keys are dynamically generated.
my $node_types_selected = 0;
my @mtype_keys = grep(/^mtype_/, keys(%newimageid_args));
foreach $key (@mtype_keys) {
my @mtype_keys = ();
foreach $key (grep(/^mtype_/, keys(%newimageid_args))) {
my $value = $newimageid_args{$key};
print STDERR "mtype: '$key' -> '$value'\n"
if ($debug);
......@@ -482,11 +481,14 @@ foreach $key (@mtype_keys) {
}
elsif ($value eq "1") {
$node_types_selected++;
push(@mtype_keys, $key);
}
}
UserError("Node Types: Must select at least one node type")
if ($node_types_selected == 0 && !$force);
my $typeclause = join(" or ", map("type='$_'", @mtype_keys));
#
# Check sanity of node name and that user can create an image from it.
#
......
#!/usr/bin/perl -wT
#
# EMULAB-COPYRIGHT
# Copyright (c) 2005-2007 University of Utah and the Flux Group.
# Copyright (c) 2005-2010 University of Utah and the Flux Group.
# All rights reserved.
#
package Archive;
......@@ -32,7 +32,7 @@ use overload ('""' => 'Stringify');
my $TB = "@prefix@";
my $MAINSITE = @TBMAINSITE@;
my $ARCHSUPPORT = @ARCHIVESUPPORT@;
my $USEARCHIVE = ($MAINSITE || $ARCHSUPPORT);
my $USEARCHIVE = $ARCHSUPPORT;
my %ALLOWEDPID = ("testbed" => 1);
# XXX
my $ARCHIVEDIR = "/usr/testbed/exparchive";
......
......@@ -80,7 +80,6 @@ boss-install: $(addprefix $(INSTALL_BINDIR)/, $(BIN_SCRIPTS)) \
$(addprefix $(INSTALL_DIR)/opsdir/lib/, $(USERLIBS))
post-install:
chown root $(INSTALL_SBINDIR)/subboss_dhcpd_makeconf
chown root $(INSTALL_SBINDIR)/genelists
chmod u+s $(INSTALL_SBINDIR)/genelists
chown root $(INSTALL_SBINDIR)/dhcpd_makeconf
......
......@@ -592,6 +592,46 @@ sub IsReserved($)
return 1;
}
sub GetSubboss($$)
{
my ($self, $service, $subboss_id) = @_;
return 0
if (! ref($self));
my $ref;
if (defined $self->{"SUBBOSSES"}) {
my $ref = $self->{"SUBBOSSES"}->{$service};
}
if (!defined $ref) {
my $nodeid = $self->node_id();
my $query_result =
DBQueryWarn("select * from subbosses " .
"where node_id='$nodeid' and " .
"service = '$service'");
return 0
if (!$query_result);
return 0
if (!$query_result->numrows);
if (!defined($self->{"SUBBOSSES"})) {
$self->{"SUBBOSSES"} = {};
}
$ref = $self->{"SUBBOSSES"}->{$service} =
$query_result->fetchrow_hashref();
}
$$subboss_id = $ref->{'subboss_id'};
return 0;
}
#
# Flush the reserve info so it reloads.
#
......
......@@ -369,9 +369,12 @@ if ($install) {
fatal("Could not kill(TERM) process $dpid (dhcpd): $!");
}
my $old_uid = $UID;
$UID = $EUID;
for my $subboss (keys %subboss_dhcp_servers) {
RestartSubbossDhcp($subboss, $restart);
}
$UID = $old_uid;
}
TBScriptUnlock();
......@@ -394,7 +397,7 @@ sub fatal {
sub RestartSubbossDhcp($$)
{
my ($subboss, $restart) = @_;
my $cmd = "ssh $subboss @prefix@/sbin/subboss_dhcpd_makeconf";
$cmd .= " -r" if ($restart);
......
......@@ -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()");
......
......@@ -664,27 +664,33 @@ sub MapNodes($$)
}
$node = $pnode;
}
my $interface = Interface->LookupByIface($node,$iface);
if (!defined($interface)) {
print STDERR "Could not map iface for $node,$iface\n";
print STDERR "$manifest_string\n";
return -1;
}
if (!defined($MAC)) {
print STDERR "No mac (or vmac) for $node,$iface\n";
print STDERR "$manifest_string\n";
return -1;
}
if (! ($MAC =~ /^[\w]*$/)) {
print STDERR "Bad mac '$MAC' for $node,$iface\n";
print STDERR "$manifest_string\n";
return -1;
}
if ($interface->Update({"mac" => "$MAC"})) {
print STDERR "Could not update $node,$iface\n";
print STDERR "$manifest_string\n";
return -1;
#
# If the interface is the loopback, then we do not need
# to do this.
#
if ($iface ne "lo0" && $iface ne "loopback") {
my $interface = Interface->LookupByIface($node,$iface);
if (!defined($interface)) {
print STDERR "Could not map iface for $node,$iface\n";
print STDERR "$manifest_string\n";
return -1;
}
if (!defined($MAC)) {
print STDERR "No mac (or vmac) for $node,$iface\n";
print STDERR "$manifest_string\n";
return -1;
}
if (! ($MAC =~ /^[\w]*$/)) {
print STDERR "Bad mac '$MAC' for $node,$iface\n";
print STDERR "$manifest_string\n";
return -1;
}
if ($interface->Update({"mac" => "$MAC"})) {
print STDERR "Could not update $node,$iface\n";
print STDERR "$manifest_string\n";
return -1;
}
}
if (defined($VMAC)) {
my $vinterface =
......@@ -818,13 +824,12 @@ sub StartSlivers($$$$)
if (@failed) {
foreach my $resource (@failed) {
my $manager_urn = $resource->manager_urn();
my $ticketstr = $resource->Ticket();
my $ticket = GeniXML::Parse($ticketstr);
my $manifest = $resource->Manifest();
return -1
if (!defined($ticket));
if (!defined($manifest));
foreach my $ref (GeniXML::FindNodes("n:node",
$ticket)->get_nodelist()) {
$manifest)->get_nodelist()) {
my $vname = GeniXML::GetVirtualId($ref);
my $this_manager_urn = GeniXML::GetManagerId($ref);
......
......@@ -61,7 +61,7 @@ CVSSUPPORT=1
STAMPS=1
CHATSUPPORT=1
NFSTRACESUPPORT=1
ARCHIVESUPPORT=1
ARCHIVESUPPORT=0
OPSDBSUPPORT=1
PELABSUPPORT=1
PLABSUPPORT=1
......
......@@ -18,60 +18,6 @@ Note that some instructions may have steps that need to occur at a few
different points in the install process - these are marked with the
earliest time one of the steps needs to occur.
20100507: After install
Minor change to apache.conf, so you need to install that and
restart apache.
boss> cd /your/obj/tree/apache
boss> gmake
To be safe, you should backup your existing config file, and
then install the new one.
boss> cp /usr/local/etc/apache/httpd.conf ~/httpd.conf
boss> sudo gmake install
And restart apache if its currently running.
boss> sudo /usr/local/etc/rc.d/apache.sh restart
20100108: After install:
Change to how stated does it logging. In /etc/newsyslog.conf,
find the line for stated, and append this to the end of that line.
/var/run/stated.pid 31
then restart stated:
sudo kill -USR1 `cat /var/run/stated.pid`
20091228: After install:
New daemon to better manage the transition of nodes into
hwdown after a failure. In /etc/newsyslog.conf, add this line:
/usr/testbed/log/checknodes.log 640 14 300 * Z /var/run/checknodes.pid
Then start this daemon:
boss> sudo /usr/testbed/sbin/checknodes_daemon
Also install new rc.d files on boss.
Note that this is not done as part of toplevel install.
cd /your/object/tree/obj/rc.d
sudo gmake install
20091103: After install:
The structure of /usr/testbed/expinfo has changed. With the
testbed "shutdown" (web interface locked out), run the
following script:
boss> sudo /usr/testbed/sbin/fixexpinfo
20091102: After install:
Some utilities may make use of location information on
......
# New ports collection makefile for: emulab-php5
# Date created: 09 February 2006
# Whom: stoller@flux.utah.edu
#
# These are for the php5-extensions port
#
WITH_XMLRPC=yes
WITH_CURL=yes
WITH_OPENSSL=yes
WITH_BZ2=yes
WITH_GD=yes
WITH_MCRYPT=yes
WITH_MYSQL=yes
WITH_XML=yes
# Additions for mediawiki
#WITH_ICONV=yes
#WITH_READLINE=yes
#WITH_MBSTRING=yes
WITHOUT_SQLITE=true
WITHOUT_PDO_SQLITE=true
#
# For the PHP ports, so they will depend on the actual version of apache we're
# installing
#
APACHE_PORT=www/apache13-modssl
#
# This prevents the option screen.
#
BATCH=yes
#
# But need this too!
#
.MAKEFLAGS+= -DBATCH APACHE_PORT=www/apache13-modssl
.include "../../lang/php5-extensions/Makefile"
Meta-port to make sure the proper php5 extensions required for an emulab
boss,ops node.
@comment This packing list left intentionally empty
......@@ -928,7 +928,7 @@ char *usagestr =
void
usage()
{
fprintf(stderr, usagestr);
fprintf(stderr, "%s", usagestr);
exit(1);
}
......
......@@ -41,7 +41,7 @@ CREATE TABLE `geni_authorities` (
`url` tinytext,
`urn` tinytext,
PRIMARY KEY (`uuid`),
UNIQUE KEY `urn` (`urn`(256))
UNIQUE KEY `urn` (`urn`(255))
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `geni_slices`;
......
......@@ -67,14 +67,45 @@ sub ListResources()
# Create a sliver by allocating and starting resources.
sub CreateSliver()
{
my ($slice_urn, $credentials, $rspec) = @_;
my ($slice_urn, $credentials, $rspec, $users) = @_;
print STDERR "CreateSliver\n";
# circulate through the users and bind them to the slice
my $caller_urn = $ENV{'GENIURN'};
my $caller_keys = undef;
foreach my $user (@$users) {
my $user_urn = $user->{'urn'};
# Skip if it is not the caller
next if ($user_urn ne $caller_urn);
$caller_keys = $user->{keys};
}
# Package the caller_keys in a list of hashes the way the CM wants
# it. Each hash has two keys ('type' and 'key'). 'type' is always
# 'ssh' for us, and 'key' is the key.
my $sliver_keys = undef;
if (defined($caller_keys)) {
$sliver_keys = [];
foreach my $key (@$caller_keys) {
# The CMV2 does not like newlines at the end of the keys.
chomp($key);
push(@$sliver_keys, {'type' => 'ssh', 'key' => $key});
}
}
# This only gets us part of the way there. For users that are not
# *this* user, we need to somehow add their keys, which also
# requires adding them as a user *without* their certificate. Not
# sure we'll be able to do that.
# Invoke CreateSliver
my $create_args = {
'slice_urn' => $slice_urn,
'rspec' => $rspec,
'credentials' => $credentials
# Omit keys, we expect them to be in the rspec
'credentials' => $credentials,
'keys' => $sliver_keys
};
my $response = GeniCMV2::CreateSliver($create_args);
......@@ -145,9 +176,9 @@ sub SliverStatus()
$status->{'geni_urn'} = 'Unknown';
# Determine geni_status. XXX how to determine 'configuring'?
if ($pgstatus->{'status'} == 'ready') {
if ($pgstatus->{'status'} eq 'ready') {
$status->{'geni_status'} = 'ready';
} elsif ($pgstatus->{'status'} == 'failed') {
} elsif ($pgstatus->{'status'} eq 'failed') {
$status->{'geni_status'} = 'failed';
} else {
$status->{'geni_status'} = 'unknown';
......
......@@ -1121,6 +1121,13 @@ sub GetTicketAuxAux($$$$$$$$$)
GeniHRN::ParseInterface( $iface_name );
$iface_name = $urn_iface;
}
#
# Hack to catch a loopback (trivial link).
#
if ($iface_name eq "loopback") {
$iface_name = "";
$trivial_ok = 1;
}
my $iface_vport = $ifacemap{$node_nickname}->{$iface_id}->{"vport"};
# XXX
......@@ -4063,7 +4070,7 @@ sub CheckCredential($)
sub CheckTicket($)
{
my $ticket = GeniCredential->CreateFromSignedTicket($_[0]);
my $ticket = GeniTicket->CreateFromSignedTicket($_[0]);
if (!defined($ticket)) {
return GeniResponse->Create(GENIRESPONSE_ERROR, undef,
"Could not create ticket object");
......
......@@ -1470,12 +1470,10 @@ sub Credential2SliceAggregate($)
my $slice;
my $aggregate;
print STDERR "Credential2SliceAggregate target_urn = $target_urn\n";
# First try the target urn, then fall back to the uuid
$slice = GeniSlice->Lookup($target_urn);
if (! defined($slice)) {
# Could not find it by urn, trying uuid
print STDERR "Credential2SliceAggregate target_uuid = $target_uuid\n";
$slice = GeniSlice->Lookup($target_uuid);
}
if (defined($slice)) {
......
......@@ -335,8 +335,13 @@ sub Create($$$$;$)
# Insert the sshkey if we got one.
if (defined($keys)) {
foreach my $keyref (@{ $keys }) {
my $safe_key = DBQuoteSpecial($keyref->{'key'});
my $safe_type = DBQuoteSpecial($keyref->{'type'});
my $key = $keyref->{'key'};
my $type = $keyref->{'type'};
chomp($key);
chomp($type);
my $safe_key = DBQuoteSpecial($key);
my $safe_type = DBQuoteSpecial($type);
DBQueryWarn("replace into geni_userkeys set ".
" uuid=$safe_uuid, created=now(), ".
......@@ -380,8 +385,13 @@ sub Modify($$$$)
if (!DBQueryWarn("delete from geni_userkeys where uuid='$uuid'"));
foreach my $keyref (@{ $keys }) {
my $safe_key = DBQuoteSpecial($keyref->{'key'});
my $safe_type = DBQuoteSpecial($keyref->{'type'});
my $key = $keyref->{'key'};
my $type = $keyref->{'type'};
chomp($key);
chomp($type);
my $safe_key = DBQuoteSpecial($key);
my $safe_type = DBQuoteSpecial($type);
DBQueryWarn("replace into geni_userkeys set ".
" uuid='$uuid', created=now(), ".
......
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