Commit 3531609f authored by Leigh B Stoller's avatar Leigh B Stoller

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

parents a9590e3a ae15ba4b
......@@ -37,6 +37,7 @@ my $LOGFILE = "$TB/log/expire_daemon.log";
my $IDLETIMES = "$TB/sbin/idletimes";
my $EMULAB_PEMFILE = "$TB/etc/genicm.pem";
my $REGISTER = "$TB/sbin/protogeni/register_sliver";
my $SLEEP_INTERVAL= 60;
# un-taint path
$ENV{'PATH'} = '/bin:/usr/bin:/usr/local/bin:/usr/site/bin';
......@@ -349,6 +350,8 @@ sub ReportLockedSlices()
$TBOPS);
}
my $counter = 0;
while (1) {
if (NoLogins()) {
sleep(5);
......@@ -362,14 +365,19 @@ while (1) {
ExpireSlices();
ShutdownSlices();
RegisterSlices();
ReportLockedSlices();
$counter += $SLEEP_INTERVAL;
if ($counter >= (24 * 60 * 60)) {
ReportLockedSlices();
$counter = 0;
}
# Be certain stale info is gone.
Experiment->FlushAll();
Node->FlushAll();
GeniUtil::FlushCaches();
sleep(60);
sleep($SLEEP_INTERVAL);
}
exit(0);
......
<rspec xmlns="http://www.protogeni.net/resources/rspec/0.2" type="request">
<node virtual_id="kentucky1"
component_manager_uuid="urn:publicid:IDN+uky.emulab.net+authority+cm"
exclusive="1"
virtualization_type="emulab-vnode"
virtualization_subtype="raw">
<interface virtual_id="control"/>
</node>
</rspec>
<link virtual_id="tun0"
link_type="tunnel">
<interface_ref virtual_node_id="utah1"
virtual_interface_id="control"
tunnel_ip="192.168.0.1" />
<interface_ref virtual_node_id="kentucky1"
virtual_interface_id="control"
tunnel_ip="192.168.0.2" />
</link>
<rspec xmlns="http://www.protogeni.net/resources/rspec/0.2" type="request">
<node virtual_id="utah1"
component_manager_uuid="urn:publicid:IDN+emulab.net+authority+cm"
exclusive="1"
virtualization_type="emulab-vnode"
virtualization_subtype="raw">
<interface virtual_id="virt1"/>
<interface virtual_id="virt2"/>
<interface virtual_id="control"/>
<disk_image
name="urn:publicid:IDN+emulab.net+image+emulab-ops//FEDORA8-OVZ-STD" />
</node>
<node virtual_id="utah2"
component_manager_uuid="urn:publicid:IDN+emulab.net+authority+cm"
exclusive="1"
virtualization_type="emulab-vnode"
virtualization_subtype="raw">
<interface virtual_id="virt1"/>
<disk_image
name="urn:publicid:IDN+emulab.net+image+emulab-ops//FEDORA8-OVZ-STD" />
</node>
<!--
<node virtual_id="utah3"
component_manager_uuid="urn:publicid:IDN+emulab.net+authority+cm"
exclusive="1"
virtualization_type="emulab-vnode"
virtualization_subtype="raw">
<interface virtual_id="virt1"/>
<disk_image
name="urn:publicid:IDN+emulab.net+image+emulab-ops//FEDORA8-OVZ-STD" />
</node>
-->
<link virtual_id="link1">
<interface_ref virtual_node_id="utah1"
virtual_interface_id="virt1" />
<interface_ref virtual_node_id="utah2"
virtual_interface_id="virt1" />
</link>
<!--
<link virtual_id="link2">
<interface_ref virtual_node_id="utah1"
virtual_interface_id="virt2" />
<interface_ref virtual_node_id="utah3"
virtual_interface_id="virt1" />
</link>
-->
</rspec>
......@@ -40,6 +40,18 @@ else:
mycredential = get_self_credential()
print "Got my SA credential"
type = URN.split('+')[2]
if type == 'slice':
SLICENAME = URN
pass
if type == 'slice' or type == 'sliver':
myslice = resolve_slice( SLICENAME, mycredential )
print "Found the slice, asking for a credential ..."
mycredential = get_slice_credential( myslice, mycredential )
print "Got the slice credential"
pass
print "Resolving at the local CM"
params = {}
......
#! /usr/bin/env python
#
# GENIPUBLIC-COPYRIGHT
# Copyright (c) 2008-2009 University of Utah and the Flux Group.
# Copyright (c) 2008-2010 University of Utah and the Flux Group.
# All rights reserved.
#
# Permission to use, copy, modify and distribute this software is hereby
......@@ -28,6 +28,13 @@ ACCEPTSLICENAME=1
execfile( "test-common.py" )
if len(REQARGS) != 1 or REQARGS[0] != "verified":
print "Are you sure you want to use this script? It freezes the slice."
print "You probably want to use deleteslice.py instead."
print "If you really want to use this script, add 'verified'"
sys.exit(1)
pass
#
# Get a credential for myself, that allows me to do things at the SA.
#
......
......@@ -25,6 +25,7 @@ import xmlrpclib
import urllib
from xml.sax.handler import ContentHandler
import xml.sax
import xml.dom.minidom
import string
from M2Crypto import X509
......@@ -32,7 +33,7 @@ ACCEPTSLICENAME=1
def Usage():
print "usage: " + sys.argv[ 0 ] + " [option...] \
[component-manager-1 component-manager-2]"
[component-manager-1 component-manager-2 [rspec1-file rspec2-file tunnel-file]]"
print """Options:
-c file, --credentials=file read self-credentials from file
[default: query from SA]
......@@ -46,17 +47,59 @@ def Usage():
[default: ~/.ssl/password]
-r file, --read-commands=file specify additional configuration file
-s file, --slicecredentials=file read slice credentials from file
[default: query from SA]"""
[default: query from SA]
component-manager-1 and component-manager-2 are hrns
rspec1-file and rspec2-file are the rspecs to be sent to the two component managers.
tunnel-file contains just link tags for the tunnels between them."""
execfile( "test-common.py" )
if len( args ) == 2:
def makeRequest(mainText, otherText, tun):
main = xml.dom.minidom.parseString(mainText)
other = xml.dom.minidom.parseString(otherText)
result = '''<?xml version="1.0" encoding="UTF-8"?>
<rspec xmlns="http://www.protogeni.net/resources/rspec/0.2" type="request">'''
result += "\n"
for node in main.getElementsByTagName("node"):
result += node.toxml()
result += "\n"
for node in other.getElementsByTagName("node"):
result += node.toxml()
result += "\n"
for link in main.getElementsByTagName("link"):
result += link.toxml()
result += "\n"
result += tun
result += "</rspec>"
return result
if len( args ) >= 2:
managers = ( args[ 0 ], args[ 1 ] )
if len ( args ) == 5:
try:
rspecfile = open(args[ 2 ])
rspec1 = rspecfile.read()
rspecfile.close()
rspecfile = open(args[ 3 ])
rspec2 = rspecfile.read()
rspecfile.close()
rspecfile = open(args[ 4 ])
tunnel = rspecfile.read()
rspecfile.close()
except IOError, e:
print >> sys.stderr, args[ 0 ] + ": " + e.strerror
sys.exit( 1 )
else:
rspec1 = None
rspec2 = None
tunnel = None
elif len( args ):
Usage()
sys.exit( 1 )
else:
managers = None
rspec = None
class findElement(ContentHandler):
name = None
......@@ -159,8 +202,8 @@ else:
url1 = components[0]["url"]
url2 = components[1]["url"]
url1 = "https://boss.emulab.net/protogeni/xmlrpc/cm"
url2 = "https://myboss.myelab.testbed.emulab.net/protogeni/xmlrpc/cm"
#url1 = "https://boss.emulab.net/protogeni/xmlrpc/cm"
#url2 = "https://myboss.myelab.testbed.emulab.net/protogeni/xmlrpc/cm"
def DeleteSlivers():
#
......@@ -210,11 +253,12 @@ if debug: print str(mykeys)
#
# Get a ticket for a node on a CM.
#
rspec1 = "<rspec xmlns=\"http://protogeni.net/resources/rspec/0.1\"> " +\
" <node virtual_id=\"geni1\" "+\
" virtualization_type=\"emulab-vnode\"> " +\
" </node>" +\
"</rspec>"
if not rspec1:
rspec1 = ("<rspec xmlns=\"http://protogeni.net/resources/rspec/0.1\"> " +\
" <node virtual_id=\"geni1\" "+\
" virtualization_type=\"emulab-vnode\"> " +\
" </node>" +\
"</rspec>")
print "Asking for a ticket from CM1 ..."
params = {}
......@@ -236,18 +280,19 @@ print "Got a ticket from CM1, asking for a ticket from CM2 ..."
#
# Get the uuid of the node assigned so we can specify it in the tunnel.
#
ticket_element = findElement("ticket", ticket1)
node_element = findElement("node", str(ticket_element.string))
node1_rspec = str(node_element.string);
#ticket_element = findElement("ticket", ticket1)
#node_element = findElement("node", str(ticket_element.string))
#node1_rspec = str(node_element.string);
#
# Get a ticket for a node on another CM.
#
rspec2 = "<rspec xmlns=\"http://protogeni.net/resources/rspec/0.1\"> " +\
" <node virtual_id=\"geni2\" "+\
" virtualization_type=\"emulab-vnode\"> " +\
" </node>" +\
"</rspec>"
if not rspec2:
rspec2 = ("<rspec xmlns=\"http://protogeni.net/resources/rspec/0.1\"> " +\
" <node virtual_id=\"geni2\" "+\
" virtualization_type=\"emulab-vnode\"> " +\
" </node>" +\
"</rspec>")
params = {}
params["slice_urn"] = SLICEURN
......@@ -268,9 +313,9 @@ print "Got a ticket from CM2, redeeming ticket on CM1 ..."
#
# Get the uuid of the node assigned so we can specify it in the tunnel.
#
ticket_element = findElement("ticket", ticket2)
node_element = findElement("node", str(ticket_element.string))
node2_rspec = str(node_element.string);
#ticket_element = findElement("ticket", ticket2)
#node_element = findElement("node", str(ticket_element.string))
#node2_rspec = str(node_element.string);
#
# Create the slivers.
......@@ -308,18 +353,25 @@ sliver2_urn = str(findElement("target_urn", sliver2).value)
#
# Now add the tunnel part since we have the uuids for the two nodes.
#
rspec = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +\
"<rspec xmlns=\"http://www.protogeni.net/resources/rspec/0.1\" " +\
" type=\"request\"> " + node1_rspec + " " + node2_rspec + " " +\
" <link virtual_id=\"link0\" link_type=\"tunnel\"> " +\
if not tunnel:
tunnel = (" <link virtual_id=\"link0\" link_type=\"tunnel\"> " +\
" <interface_ref virtual_node_id=\"geni1\" " +\
" virtual_interface_id=\"virt0\" "+\
" tunnel_ip=\"192.168.1.1\" />" +\
" <interface_ref virtual_node_id=\"geni2\" " +\
" virtual_interface_id=\"virt0\" "+\
" tunnel_ip=\"192.168.1.2\" />" +\
" </link> " +\
"</rspec>"
" </link> ")
rspec1 = makeRequest(manifest1, manifest2, tunnel)
sys.stderr.write("RSPEC1: \n\n\n" + rspec1 + "\n\n\n")
rspec2 = makeRequest(manifest2, manifest1, tunnel)
sys.stderr.write("RSPEC2: \n\n\n" + rspec2 + "\n\n\n")
#rspec = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +\
# "<rspec xmlns=\"http://www.protogeni.net/resources/rspec/0.1\" " +\
# " type=\"request\"> " + node1_rspec + " " + node2_rspec + " " +\
# "</rspec>"
#print str(rspec)
......@@ -327,7 +379,7 @@ print "Updating sliver on CM1 with tunnel stuff ..."
params = {}
params["credentials"] = (myslice,)
params["sliver_urn"] = sliver1_urn
params["rspec"] = rspec
params["rspec"] = rspec1
rval,response = do_method(None, "UpdateSliver", params,
URI=url1, version="2.0")
if rval:
......@@ -339,7 +391,7 @@ print "Updated sliver on CM1. Updating sliver on CM2 with tunnel stuff ..."
params = {}
params["credentials"] = (myslice,)
params["sliver_urn"] = sliver2_urn
params["rspec"] = rspec
params["rspec"] = rspec2
rval,response = do_method(None, "UpdateSliver", params,
URI=url2, version="2.0")
if rval:
......@@ -399,8 +451,8 @@ if rval:
Fatal("Could not start sliver on CM2")
pass
print "Slivers have been started, waiting for input to delete it"
print "Slivers have been started"
print "You should be able to log into the sliver after a little bit"
sys.stdin.readline();
DeleteSlivers()
#DeleteSlivers()
......@@ -470,7 +470,7 @@ CREATE TABLE `emulab_indicies` (
DROP TABLE IF EXISTS `emulab_locks`;
CREATE TABLE `emulab_locks` (
`name` varchar(64) NOT NULL default '',
`value` int(10) unsigned NOT NULL default '0',
`value` int(10) NOT NULL default '0',
PRIMARY KEY (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
......
#
# Fix emulab_locks table.
#
use strict;
use libdb;
sub DoUpdate($$$)
{
DBQueryFatal("alter table emulab_locks change `value` `value` ".
" int(10) NOT NULL default '0'");
return 0;
}
1;
......@@ -13,9 +13,10 @@ sub usage()
scriptname() . " [-j vnodeid] [-n] boot|shutdown|reconfig|reset\n";
exit(1);
}
my $optlist = "j:n";
my $optlist = "j:nM";
my $action = "boot";
my $doit = 1;
my $updatemasterpasswdfiles = 0;
# Turn off line buffering on output
$| = 1;
......@@ -62,6 +63,9 @@ if (defined($options{'j'})) {
if (defined($options{'n'})) {
$doit = 0;
}
if (defined($options{'M'})) {
$updatemasterpasswdfiles = 1;
}
if (@ARGV) {
$action = $ARGV[0];
}
......@@ -651,7 +655,7 @@ sub docleanup()
# Hand this off to liblocsetup to restore default passwd/group files.
if ($doit) {
$retval = os_account_cleanup();
$retval = os_account_cleanup($updatemasterpasswdfiles);
}
my $pdb = $PASSDB . ".db";
......
......@@ -24,11 +24,12 @@ sub usage()
scriptname() . " [-j vnodeid] boot|shutdown|reconfig|reset\n";
exit(1);
}
my $optlist = "j:d";
my $optlist = "j:dM";
my %options = ();
my $action = "boot";
my $debug = 0;
my $vnodeid;
my $updatemasterpasswdfiles = 0;
# Turn off line buffering on output
$| = 1;
......@@ -67,6 +68,9 @@ if (defined($options{'j'})) {
if (defined($options{'d'})) {
$debug++;
}
if (defined($options{'M'})) {
$updatemasterpasswdfiles = 1;
}
# Allow default above.
if (@ARGV) {
$action = $ARGV[0];
......@@ -77,6 +81,8 @@ if (@ARGV) {
# specify a shorter set for the MFS.
#
my @bootscripts;
my %bootscript_args = ( 'rc.accounts' => $updatemasterpasswdfiles ?
'-M' : '' );
if (MFS()) {
@bootscripts = ("rc.misc", "rc.localize", "rc.mounts", "rc.accounts",
......@@ -141,6 +147,12 @@ sub doaction($@)
my $optarg = (defined($vnodeid) ? "-j $vnodeid" : "");
foreach my $script (@scripts) {
my $bargs = '';
if (exists($bootscript_args{$script})
&& defined($bootscript_args{$script})) {
$bargs = $bootscript_args{$script};
}
# No need to install all this cruft on the MFS or other small envs.
next
if (!-x "$BINDIR/rc/$script");
......@@ -150,7 +162,7 @@ sub doaction($@)
print "Running $BINDIR/rc/$script\n"
if ($debug);
system("$BINDIR/rc/$script $optarg $what");
system("$BINDIR/rc/$script $optarg $bargs $what");
if ($?) {
fatal("Failed running $BINDIR/rc/$script");
}
......
......@@ -160,7 +160,7 @@ sub dokeyhash()
}
umask($oldumask);
return 0;
+}
}
#
# Get the event key
......
......@@ -116,8 +116,14 @@ sub mysystem($)
#
# OS dependent part of cleanup node state.
#
sub os_account_cleanup()
sub os_account_cleanup($)
{
# XXX this stuff should be lifted up into rc.accounts, sigh
my ($updatemasterpasswdfiles) = @_;
if (!defined($updatemasterpasswdfiles)) {
$updatemasterpasswdfiles = 0;
}
# Undo what rc.mounts and rc.accounts did.
# Get the users list from NT, dumped into /etc/passwd and preened by the
......
......@@ -99,8 +99,14 @@ my $DEFSHELL = "/bin/tcsh";
# OS dependent part of account cleanup. On a remote node, this will
# only be called from inside a JAIL, or from the prepare script.
#
sub os_account_cleanup()
sub os_account_cleanup($)
{
# XXX this stuff should be lifted up into rc.accounts, sigh
my ($updatemasterpasswdfiles) = @_;
if (!defined($updatemasterpasswdfiles)) {
$updatemasterpasswdfiles = 0;
}
printf STDOUT "Resetting passwd and group files\n";
if (system("$CP -f $TMGROUP /etc/group") != 0) {
print STDERR "Could not copy default group file into place: $!\n";
......
......@@ -120,8 +120,14 @@ my $debug = 0;
#
# OS dependent part of cleanup node state.
#
sub os_account_cleanup()
sub os_account_cleanup($)
{
# XXX this stuff should be lifted up into rc.accounts, sigh
my ($updatemasterpasswdfiles) = @_;
if (!defined($updatemasterpasswdfiles)) {
$updatemasterpasswdfiles = 0;
}
#
# Don't just splat the master passwd/group files into place from $ETCDIR.
# Instead, grab the current Emulab uids/gids, grab the current group/passwd
......@@ -131,6 +137,14 @@ sub os_account_cleanup()
# master files if they no longer appear in the current files. Finally, we
# strip deleted uids from any groups they might appear in (!).
#
# And now we only do the merge if told to do so. This is the default
# coming from prepare, now. If not merging, we just overwrite the real
# files with the master files -- we do not update the master files.
#
# We *do* output the diff to say what *would* have changed, so that
# an operator can know that they need to manually add a user to the
# master files.
#
my %PDB;
my %GDB;
......@@ -313,16 +327,34 @@ sub os_account_cleanup()
print STDERR "Running 'diff -u $file ${file}.new'\n";
$retval = system("diff -u $file ${file}.new");
if ($retval) {
print STDERR "Files ${file}.new and $file differ; updating $file.\n";
system("mv ${file}.new $file");
if ($updatemasterpasswdfiles) {
print STDERR "Files ${file}.new and $file differ; updating $file.\n";
system("mv ${file}.new $file");
}
else {
print STDERR "Files ${file}.new and $file differ, but I was told not to update the master files!.\n";
system("rm -f ${file}.new");
}
}
else {
system("rm -f ${file}.new");
}
}
else {
print STDERR "Running 'diff -q -u $file ${file}.new'\n";
$retval = system("diff -q -u $file ${file}.new");
if ($retval) {
print STDERR "Files ${file}.new and $file differ, but we can't show the changes! Updating $file anyway!\n";
system("mv ${file}.new $file");
if ($updatemasterpasswdfiles) {
print STDERR "Files ${file}.new and $file differ, but we can't show the changes! Updating $file anyway!\n";
system("mv ${file}.new $file");
}
else {
print STDERR "Files ${file}.new and $file differ, but we can't show the changes, and I was told not to update the master files!\n";
system("rm -f ${file}.new");
}
}
else {
system("rm -f ${file}.new");
}
}
}
......
......@@ -64,10 +64,13 @@ use libsetup;
#
my $noumount = 0;
my %options = ();
if (getopts("N", \%options)) {
if (getopts("NM", \%options)) {
if (defined($options{"N"})) {
$noumount = 1;
}
if (defined($options{"M"})) {
$updatemasterpasswdfiles = 1;
}
}
my $isvm = ((-e "$ETCDIR/genvmtype") ? 1 : 0);
......@@ -77,7 +80,11 @@ my $isvm = ((-e "$ETCDIR/genvmtype") ? 1 : 0);
cleanup_node(1);
print "Running $BINDIR/rc/rc.config to clean up ...\n";
system("$BINDIR/rc/rc.config reset");
my $rcconfig_args = "";
if ($updatemasterpasswdfiles) {
$rcconfig_args = "-M";
}
system("$BINDIR/rc/rc.config $rcconfig_args reset");
print "Removing old DB files ...\n";
foreach my $dbfile (@DBFILES) {
......
......@@ -47,6 +47,12 @@ my $debug = get_config("debug",undef);
#
my $testmode = undef;
#
# If set, try to hide trivial merges (i.e., ones with standard subject
# line and no body text). Ugly hack.
#
my $hide_trivial_merges = get_config("hidetrivialmerges",undef);
#
# Command-line options - have to do this before setting other options, since
# we want to be able to turn on debugging early
......@@ -681,6 +687,28 @@ sub commit_mail($\@$@) {
$showcommand .= "'$rev'";
debug("running '$showcommand'");
my @body = `$showcommand`;
if ($hide_trivial_merges) {
my $is_merge = 0;
my $body_lines = 0;
my $subject;
for (@body) {
$is_merge = 1 if (/^Merge:/);
if (/^ /) {
if (not defined $subject) {
$subject = $_;
} else {
$body_lines++;
}
}
}
if ($is_merge && $body_lines == 0 &&
$subject =~ /^ +Merge (?:remote )?branch '[^']+'(?: of .*)?$/){
next;
}
}
if ($separate_mail) {
# Send this message by itself
......@@ -693,7 +721,7 @@ sub commit_mail($\@$@) {
#
# Send all the changes together in one message
#
if (!$separate_mail) {
if (!$separate_mail && @fullbody) {
send_mail($subject,
$actionstring . join("\n" . "-"x72 . "\n\n",
map { join "",@$_} @fullbody),
......
......@@ -159,7 +159,7 @@ function SPITFORM($formfields, $errors)
global $EXPOSELINKTEST, $EXPOSEARCHIVE;
global $EXPOSESTATESAVE;
global $TBVALIDDIRS_HTML;
global $WIKIDOCURL;
global $WIKIDOCURL, $WIKINODE;
PAGEHEADER("Begin a Testbed Experiment");
......@@ -214,7 +214,11 @@ function SPITFORM($formfields, $errors)
<li><b>If you have an NS file:</b><br> You may want to
<b><a href='nscheck_form.php3'>syntax check it first</a></b>
<li><b>If you do not have an NS file:</b><br>
<b><a href='clientui.php3'>New GUI editor</a></b> - An enhanced Java applet for editing topologies.<br>
<b><a href='clientui.php3'>New GUI editor</a></b> -
An enhanced Java applet for editing topologies.
(<b><a href='clientui-alt.php3'>ProtoGeni Version</a></b> -
<a href='http://$WIKINODE/trac/protogeni/wiki'>
What's ProtoGeni?</a>)<br>
The older <b><a href='buildui/bui.php3'>NetBuild GUI</a></b>
can be used to graphically create topologies.<font size=-2>
(<a href='$TBDOCBASE/faq.php3#netbuild'>Additional
......
......@@ -434,6 +434,7 @@ function WRITESIDEBAR() {
}
NavMenuButton("Documentation", "$WIKIDOCURL");
NavMenuButtonNew("Forums", "http://groups.google.com/group/emulab-users");
if ($rootEmulab) {
# Leave New here about 2 weeks
......
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