Commit b0693ee9 authored by Gary Wong's avatar Gary Wong

Merge branch 'multisite-too' into multisite

Conflicts:
	apt/create_instance.in
	apt/manage_profile.in
	backend/newimageid_ez.in
	clientside/tmcc/linux-ms/mfs/slicefix
	utils/create_image.in
	www/aptui/css/jquery-steps.css
	www/aptui/instantiate.php
	www/aptui/js/instantiate.js
	www/aptui/js/status.js
	www/newimageid_ez.php3
parents 38ee3014 73fd4833
......@@ -670,8 +670,14 @@ if (!defined($instance)) {
fatal(defined($errmsg) ? $errmsg :
"Could not create instance record for $quickvm_uuid");
}
# To keep stuff happy until finished.
$instance->Update({'aggregate_urn' => $default_aggregate_urn});
# To keep stuff happy until multisite support finished.
if (keys(%{$sitemap})) {
my ($temp_aggregate_urn) = values(%{$sitemap});
$instance->Update({'aggregate_urn' => $temp_aggregate_urn});
}
else {
$instance->Update({'aggregate_urn' => $default_aggregate_urn});
}
# We use this list of references for ParRun below.
my @aggregate_list = ();
......@@ -829,6 +835,8 @@ sub WaitForSliver($)
if (exists($repblob->{'public_url'})) {
$public_url = $repblob->{'public_url'};
$aggobj->SetPublicURL($public_url);
# Temporary until web interface catches up.
$instance->SetPublicURL($public_url);
}
if ($repblob->{'status'} eq "ready") {
$ready = 1;
......
......@@ -335,8 +335,10 @@ if ($snap) {
UserError();
}
my $sliver_urn = GeniXML::GetSliverId($nodes[0]);
my $manager_urn= GeniXML::GetManagerId($nodes[0]);
$node_id = GeniXML::GetVirtualId($nodes[0]);
if (! (defined($sliver_urn) && $sliver_urn eq $aggregate->aggregate_urn())){
if (! (defined($sliver_urn) &&
$manager_urn eq $aggregate->aggregate_urn())) {
$errors{"error"} = "$node_id is not at " . $aggregate->aggregate_urn();
UserError();
}
......
......@@ -56,6 +56,7 @@ my $TBPROJ_DIR = "@PROJROOT_DIR@";
my $CREATEIMAGE = "$TB/bin/create_image";
my $CLONEIMAGE = "$TB/sbin/clone_image";
my $RUNSONXEN = "$TB/sbin/runsonxen";
my $DOIMAGEDIRS = @IMAGEDIRECTORIES@;
#
# Untaint the path
......@@ -79,6 +80,7 @@ use Project;
use Image;
use OSinfo;
use Node;
use EmulabFeatures;
# Protos
sub fatal($);
......@@ -552,6 +554,17 @@ elsif (! $isadmin) {
UserError("Path: Invalid Path");
}
}
#
# Image path from the web interface does not respect the
# IMAGEDIRECTORIES feature or config variable. We fix it up here.
#
if ($newimageid_args{"path"} =~ /\/$/ &&
(! $DOIMAGEDIRS ||
! ($isadmin ||
EmulabFeatures->FeatureEnabled("ImageDirectories",
$this_user, $group)))) {
$newimageid_args{"path"} =~ s/\/$/.ndz/;
}
if ($newimageid_args{"path"} =~ /\/$/) {
if (-e $newimageid_args{"path"} && ! -d $newimageid_args{"path"}) {
UserError("Path: invalid path, it should be a directory");
......
#
# Copyright (c) 2000-2014 University of Utah and the Flux Group.
# Copyright (c) 2000-2015 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -36,7 +36,8 @@ WITH_TELNET = 0
all: boss-all tipserv-all
boss-all: capserver
tipserv-all: capture capture-tty capquery caplogserver caplog caplog.bin
client: capture capture-nossl capquery caplog caplog.bin
client: capture capture-nossl capquery caplog caplog.bin
subboss: client
include $(TESTBED_SRCDIR)/GNUmakerules
......@@ -101,6 +102,8 @@ client-install: client
$(INSTALL_PROGRAM) capquery$(EXE) $(DESTDIR)$(INSTALL_SBINDIR)/capquery$(EXE)
$(INSTALL_PROGRAM) capture-nossl$(EXE) $(DESTDIR)$(INSTALL_SBINDIR)/capture-nossl$(EXE)
subboss-install: subboss client-install
real-install: all $(INSTALL_SBINDIR)/capserver $(INSTALL_SBINDIR)/capture
tipserv-install: tipserv-all $(INSTALL_SBINDIR)/capture \
......
......@@ -677,7 +677,7 @@ fi
#
if [ $reboot -eq 1 ]; then
# XXX let serial output drain
sleep 1
sleep 2
$BINDIR/tmcc state RELOADDONEV2
echo "`date`: Waiting for server to reboot us ..."
sleep 30
......
......@@ -168,7 +168,7 @@ dolinux() {
# XXX we have had problems with unclean FSes.
# The situation gets much worse if we don't clean it up here.
#
fsck -y $rootdev || {
e2fsck -y $rootdev || {
echo "Failed to fsck root filesystem $rootdev"
return 1
}
......
......@@ -682,19 +682,38 @@ if ($srcsigfile && ($srcsigfile =~ /^$TB/)) {
# image is created on the nodes, and it NFS mounts directories on ops.
# Writing the image to anyplace else is just going to break things.
#
# Use realpath to validate the path. The still use the original path
# for passing to the client-side since boss and the client may not have
# the same real path for a file.
# Use realpath on the directory part of the path to validate. If we ran
# realpath on the filename, it would return null since $filename (a temp
# file) won't exist. Note that we can use dirname/basename here since
# $filename is well formed (both dir and file components).
#
# We still use the original path for passing to the client-side since
# boss and the client may not have the same real path for a file.
#
my $ofilename = $filename;
my $translated = realpath($filename);
if ($translated =~ /^([-\w\.\/\+:]+)$/) {
my $tdir = dirname($filename);
my $translated = realpath($tdir);
if ($translated && $translated =~ /^([-\w\.\/\+:]+)$/) {
my $tfile = basename($filename);
$filename = $1;
# XXX check the last component
if ($tfile =~ /^([-\w\.\+:]+)$/) {
$filename = "$filename/$1";
} else {
fatal("Bad characters in image filename");
}
}
else {
fatal("Bad data returned by realpath: $translated");
if ($translated) {
fatal("Bad characters in image pathname");
}
fatal("Image directory does not exist");
}
# Make sure the result (really the final component) is not a symlink or dir
if (-l $filename) {
fatal("$filename is a symlink! Must be a plain file.");
}
# Make sure not a directory.
if (-d $filename) {
fatal("$filename is a directory! Must be a plain file.");
}
......
......@@ -283,10 +283,30 @@ left: -999em;
z-index: 20;
}
.wizard #inline_container #inline_overlay span {
color: #aaa;
top: 100%;
left: 17px;
margin-top: -19px;
position: absolute;
}
#inline_large_container button.close {
padding: 1px 5px 0 0;
}
#about_div {
padding-right: 30px;
}
#about_div .panel {
margin-left: -14px;
}
#where_warming {
margin-bottom: 0;
}
@media (min-width: 768px) {
.wizard #finalize_container.col-lg-8 {
padding-right: 5px;
......
......@@ -266,15 +266,18 @@ function SPITFORM($formfields, $newuser, $errors)
SPITHEADER(1);
echo "<div id='ppviewmodal_div'></div>\n";
# Placeholder for the "about" panel, which is now a template file.
echo "<div id='about_div' class='col-lg-8 col-lg-offset-2
col-md-8 col-md-offset-2
col-sm-10 col-sm-offset-1
col-xs-12 col-xs-offset-0'></div>\n";
echo "<div id='stepsContainer' class='row'>
<h3>Select a Profile</h3>
<div class='col-lg-6 col-lg-offset-3
col-md-6 col-md-offset-3
col-sm-8 col-sm-offset-2
<div class='col-lg-8 col-lg-offset-2
col-md-8 col-md-offset-2
col-sm-10 col-sm-offset-1
col-xs-12 col-xs-offset-0'>\n";
# Placeholder for the "about" panel, which is now a template file.
echo "<div id='about_div'></div>\n";
echo "<form id='quickvm_form' role='form'
enctype='multipart/form-data'
......@@ -556,6 +559,7 @@ function SPITFORM($formfields, $newuser, $errors)
<select name=\"formfields[where]\"
id='profile_where' class='form-control'>
$am_options</select><br>
</div><div class='col-sm-10 col-sm-offset-1' style='text-align: center'>
<div class='alert alert-warning' id='where-warning' style='display: none'>This profile only works on some clusters. Incompatible clusters are unselectable.</div>
</div></div></div>";
$html = $html . "<div id='site_selector' class='hidden'></div></div>";
......@@ -587,13 +591,13 @@ function SPITFORM($formfields, $newuser, $errors)
echo "</div>
</div>\n";
}
echo "<h3>Parameterize</h3><div class='col-lg-6 col-lg-offset-3
col-md-6 col-md-offset-3
col-sm-8 col-sm-offset-2
echo "<h3>Parameterize</h3><div class='col-lg-8 col-lg-offset-2
col-md-8 col-md-offset-2
col-sm-10 col-sm-offset-1
col-xs-12 col-xs-offset-0'></div>\n";
echo "<h3>Finalize</h3><div class='col-lg-6 col-lg-offset-3
col-md-6 col-md-offset-3
col-sm-8 col-sm-offset-2
echo "<h3>Finalize</h3><div class='col-lg-8 col-lg-offset-2
col-md-8 col-md-offset-2
col-sm-10 col-sm-offset-1
col-xs-12 col-xs-offset-0'>
<div id='finalize_container' class='col-lg-8 col-md-8 col-sm-8 col-xs-12'>
<div class='panel panel-default'>
......@@ -604,7 +608,7 @@ function SPITFORM($formfields, $newuser, $errors)
</div>
</div>
<div id='inline_container' class='col-lg-4 col-md-4 col-sm-4 col-xs-12'>
<a id='inline_overlay' href='#'></a>
<a id='inline_overlay' href='#'><span class='glyphicon glyphicon-fullscreen' aria-hidden='true'></span></a>
<div id='inline_jacks'></div>
</div>
</div>\n";
......
......@@ -70,6 +70,7 @@ function (_, Constraints, sup, ppstart, JacksEditor, aboutaptString, aboutcloudS
}
else {
$('#stepsContainer-p-1 > div').attr('style','display:none');
loaded_uuid = selected_uuid;
}
}
else if (currentIndex == 1 && newIndex == 2) {
......@@ -89,6 +90,14 @@ function (_, Constraints, sup, ppstart, JacksEditor, aboutaptString, aboutcloudS
+'</div></div>');
}
});
$('#stepsContainer-p-2 #finalize_options').append(''
+'<div id="cluster_status_link" class="hidden"><center>'
+'<a target="_blank" href="cluster-status.php">Check Cluster Status</a>'
+'</center></div>');
if ($('#nosite_selector').length || $('#site_selector').length) {
$('#cluster_status_link').removeClass('hidden');
}
}
if (currentIndex == 2) {
......@@ -143,8 +152,8 @@ function (_, Constraints, sup, ppstart, JacksEditor, aboutaptString, aboutcloudS
});
// Set up wizard final page formatting
$('#stepsContainer .steps').addClass('col-lg-6 col-lg-offset-3 col-md-6 col-md-offset-3 col-sm-8 col-sm-offset-2 col-xs-12 col-xs-offset-0');
$('#stepsContainer .actions').addClass('col-lg-6 col-lg-offset-3 col-md-6 col-md-offset-3 col-sm-8 col-sm-offset-2 col-xs-12 col-xs-offset-0');
$('#stepsContainer .steps').addClass('col-lg-8 col-lg-offset-2 col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1 col-xs-12 col-xs-offset-0');
$('#stepsContainer .actions').addClass('col-lg-8 col-lg-offset-2 col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1 col-xs-12 col-xs-offset-0');
// Set up jacks swap
$('#stepsContainer #inline_overlay').click(function() {
......@@ -206,6 +215,8 @@ function (_, Constraints, sup, ppstart, JacksEditor, aboutaptString, aboutcloudS
$('button#showtopo_select').click(function (event) {
event.preventDefault();
ChangeProfileSelection($('#quickvm_topomodal .selected'));
selected_uuid = $('#quickvm_topomodal .selected').attr('value');
console.log(selected_uuid);
$('#quickvm_topomodal').modal('hide');
$('.steps .error').removeClass('error');
});
......@@ -522,8 +533,7 @@ function (_, Constraints, sup, ppstart, JacksEditor, aboutaptString, aboutcloudS
" <div class='form-group'>" +
" <label class='col-sm-4 control-label' " +
" style='text-align: right;'>"+
" <a href=cluster-status.php " +
" target=_blank>Site " + siteid + " Cluster:</a>" +
" Site " + siteid + " Cluster:</a>" +
" </label> " +
" <div class='col-sm-6'>" +
" <select name=\"formfields[sites][" + siteid + "]\"" +
......@@ -531,7 +541,7 @@ function (_, Constraints, sup, ppstart, JacksEditor, aboutaptString, aboutcloudS
" </select>" +
"</div></div></div>";
}
console.info(html);
//console.info(html);
$("#nosite_selector").addClass("hidden");
$("#site_selector").removeClass("hidden");
$("#site_selector").html(html);
......
......@@ -62,6 +62,7 @@ function (_, sup, moment, marked, UriTemplate, ShowImagingModal,
// Generate the templates.
var template_args = {
uuid: uuid,
name: window.APT_OPTIONS.name,
profileName: window.APT_OPTIONS.profileName,
profileUUID: window.APT_OPTIONS.profileUUID,
sliceURN: window.APT_OPTIONS.sliceURN,
......@@ -1180,8 +1181,8 @@ function (_, sup, moment, marked, UriTemplate, ShowImagingModal,
// Bind a function to start up ssh for one node topologies.
if (nodecount == 1 && !oneonly && dossh) {
startOneSSH = function () {
var nodename = hostportlist.keys()[0];
var hostport = hostportlist[nodename];
var nodename = hostportList.keys()[0];
var hostport = hostportList[nodename];
NewSSHTab(hostport, nodename);
};
}
......
......@@ -322,7 +322,7 @@ $PAGEHEADER_FUNCTION = function($thinheader = 0, $ignore1 = NULL,
if ($login_user) {
list($pcount, $phours) = Instance::CurrentUsage($login_user);
if ($pcount) {
$average = $phours / $pcount;
$average = sprintf("%.2f", $phours / $pcount);
echo "<center style='margin-bottom: 5px; margin-top: -8px'>
<span class=text-warning>
......
......@@ -137,6 +137,11 @@ else {
}
if ($slice) {
$slice_urn = $slice->urn();
$instance_name = $instance->name();
# Until old instances are gone.
if (!$instance_name) {
$instance_name = $slice_urn;
}
$slice_expires = DateStringGMT($slice->expires());
$slice_expires_text = gmdate("m-d\TH:i\Z", strtotime($slice->expires()));
$slice_created = DateStringGMT($instance->created());
......@@ -146,6 +151,7 @@ else {
$slice_expires = "";
$slice_expires_text = "";
$slice_created = "";
$instance_name = "";
}
$registered = (isset($this_user) ? "true" : "false");
$snapping = 0;
......@@ -192,6 +198,7 @@ echo "<div id='status-body'></div>\n";
echo "<script type='text/javascript'>\n";
echo " window.APT_OPTIONS.uuid = '" . $uuid . "';\n";
echo " window.APT_OPTIONS.name = '" . $instance_name . "';\n";
echo " window.APT_OPTIONS.instanceStatus = '" . $instance_status . "';\n";
echo " window.APT_OPTIONS.profileName = '" . $profile_name . "';\n";
echo " window.APT_OPTIONS.profileUUID = '" . $profile_uuid . "';\n";
......
......@@ -32,8 +32,8 @@
</td>
</tr>
<tr>
<td class='border-none'>URN:</td>
<td class='border-none'><%- sliceURN %></td>
<td class='border-none'>Name:</td>
<td class='border-none'><%- name %></td>
</tr>
<tr>
<td class='border-none'>State:</td>
......
......@@ -483,7 +483,8 @@ function SPITFORM($formfields, $errors)
#
# Path to image.
#
echo "<tr>
$style = ($isadmin ? "" : "style='display:none;'");
echo "<tr $style>
<td>Directory for Image:<br>
(must reside in $TBPROJ_DIR)</td>
<td class=left>
......
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