Commit e55f5f57 authored by Leigh Stoller's avatar Leigh Stoller

More work on issue #399; Admins get link to to the classic shownode page

for each node in the list. Also, add a new column to show what image
is running,
parent dd2eee28
......@@ -1292,7 +1292,6 @@ sub ActionStart($$;$)
goto bad;
}
DebugTimeStamp("syncportvlans done");
GeniCM::UpdateManifest($slice);
}
}
$sliver = undef;
......@@ -1386,6 +1385,8 @@ sub ActionStart($$;$)
print STDERR "Calling os_setup @nodes\n";
$rval = system("$OSSETUP $pid $eid @nodes");
print STDERR "os_setup exited with status $rval\n";
# Update to get the disk images into the manifest.
GeniCM::UpdateManifest($slice);
}
#
......
......@@ -7731,6 +7731,7 @@ sub UpdateManifest($)
print STDERR "No manifest for $slice/$aggregate\n";
return -1;
}
my $changed = 0;
my @vlanlist = ();
my %vlanpaths = ();
if ($experiment->PortLanList(\@vlanlist) == 0) {
......@@ -7772,7 +7773,31 @@ sub UpdateManifest($)
$el = GeniXML::AddElement("switchpath",
$linkref, $GeniXML::EMULAB_NS);
$el->appendText($vlanpaths{$vname});
$changed++;
}
}
#
# Update the disk image, adding it to the emulab vnode extension.
#
foreach my $noderef (GeniXML::FindNodes("n:node",
$rspec)->get_nodelist()){
my $vnoderef = GeniXML::FindNodesNS("n:vnode", $noderef,
$GeniXML::EMULAB_NS)->pop();
next
if (! defined($vnoderef));
my $node_id = GeniXML::GetText("name", $vnoderef);
next
if (!defined($node_id));
my $node = Node->Lookup($node_id);
next
if (!defined($node));
my $osimage = $node->RunningOsImage();
next
if (!defined($osimage));
GeniXML::SetText("disk_image", $vnoderef, $osimage->versname());
$changed++;
}
if ($changed) {
return $aggregate->UpdateManifest($rspec);
}
return 0;
......
......@@ -14,11 +14,15 @@ function ParseURN(urn)
"id" : matches[3]};
if (hrn.type == "image") {
parser = /^(.*)(::|\/\/)(.*)$/;
parser = /^([^\/\:]+)(::|:|\/\/)([^\:]+):?(\d+)?$/;
matches = parser.exec(hrn.id);
if (matches) {
hrn["project"] = matches[1];
hrn["image"] = matches[3];
hrn["version"] = null;
if (matches.length > 4) {
hrn["version"] = matches[4];
}
}
}
return hrn;
......
......@@ -39,11 +39,11 @@ $(function ()
var user_lockdown = 0;
var lockdown_code = "";
var consolenodes = {};
var diskimages = {};
var showlinktest = false;
var hidelinktest = false;
var extension_blob = null;
var projlist = null;
var amlist = null;
var changingtopo = false;
var EMULAB_OPS = "emulab-ops";
var EMULAB_NS = "http://www.protogeni.net/resources/rspec/ext/emulab/1";
......@@ -87,12 +87,13 @@ $(function ()
if ($('#extension-blob-json').length) {
extension_blob = decodejson('#extension-blob-json');
console.info(extension_blob);
// console.info(extension_blob);
}
if ($('#projects-json').length) {
projlist = decodejson('#projects-json');
console.info(projlist);
// console.info(projlist);
}
amlist = decodejson('#amlist-json');
// Generate the templates.
var template_args = {
......@@ -1557,6 +1558,7 @@ $(function ()
" <td name='client_id'>n/a</td>" +
" <td name='node_id'>n/a</td>" +
" <td name='type'>n/a</td>" +
" <td name='image'>n/a</td>" +
" <td name='sshurl'>n/a</td>" +
" <td align=left><input name='select' type=checkbox>" +
" <td name='menu' align=center> " +
......@@ -1660,10 +1662,22 @@ $(function ()
clone.attr('id', 'listview-row-' + node);
// Set the client_id in the first column.
clone.find(" [name=client_id]").html(node);
// And the node_id/type
// And the node_id/type. This is an emulab extension.
if (vnode.length) {
clone.find(" [name=node_id]")
.html($(vnode).attr("name"));
var node_id = $(vnode).attr("name");
// Admins get a link to the shownode page.
if (isadmin) {
var weburl = amlist[aggregate_urn].weburl +
"/shownode.php3?node_id=" + node_id;
var html = "<a href='" + weburl + "' target=_blank>" +
node_id + "</a>";
clone.find(" [name=node_id]").html(html);
}
else {
clone.find(" [name=node_id]").html(node_id);
}
clone.find(" [name=type]")
.html($(vnode).attr("hardware_type"));
clientid2nodeid[node] = $(vnode).attr("name");
......@@ -1680,6 +1694,30 @@ $(function ()
$(stype).attr("name") === "firewall") {
isfw = 1;
}
/*
* Find the disk image (if any) for the node and display
* in the listview.
*/
if (vnode.length && $(vnode).attr("disk_image")) {
clone.find(" [name=image]")
.html($(vnode).attr("disk_image"));
}
else if (stype.length) {
var dimage = $(stype).find("disk_image");
if (dimage.length) {
var name = $(dimage).attr("name");
if (name) {
var hrn = sup.ParseURN(name);
if (hrn.type == "image") {
var id = hrn.project + "/" + hrn.image;
if (hrn.version != null) {
id = id + ":" + hrn.version;
}
clone.find(" [name=image]").html(id);
}
}
}
}
if (login.length && dossh) {
var user = window.APT_OPTIONS.thisUid;
......@@ -1755,19 +1793,6 @@ $(function ()
.parent().addClass('disabled');
}
/*
* Find the disk image (if any) for the node and store it.
*/
if (stype.length) {
var dimage = $(stype).find("disk_image");
if (dimage.length) {
var name = $(dimage).attr("name");
if (name) {
diskimages[node] = name;
}
}
}
// Insert into the table, we will attach the handlers below.
$('#listview_table > tbody:last').append(clone);
......
......@@ -196,6 +196,7 @@ $paniced = $instance->paniced();
$pid = $instance->pid();
$gid = $instance->gid();
$extensions = ExtensionInfo::LookupForInstance($instance);
$slivers = InstanceSliver::LookupForInstance($instance);
$isstud = (isset($this_user) && $this_user->stud() ? 1 : 0);
$wholedisk = FeatureEnabled("WholeDiskImage", $creator, $instance->Group());
......@@ -326,6 +327,21 @@ echo "<link rel='stylesheet'
echo "<link rel='stylesheet' href='css/progress.css'>\n";
echo "<link rel='stylesheet' href='css/codemirror.css'>\n";
#
# Build up a blob of aggregates info used by this experiment.
#
$blob = array();
foreach ($slivers as $sliver) {
$aggregate_urn = $sliver->aggregate_urn();
$aggregate = Aggregate::Lookup($aggregate_urn);
$weburl = $aggregate->weburl();
$blob[$aggregate_urn] = array("weburl" => $weburl);
}
echo "<script type='text/plain' id='amlist-json'>\n";
echo json_encode($blob, JSON_HEX_APOS|JSON_HEX_QUOT|JSON_HEX_TAG|JSON_HEX_AMP);
echo "</script>\n";
#
# Build up a blob of stuff to json encode. This should be moved to
# an ajax method on the instance ...
......
......@@ -375,9 +375,9 @@ pre {
<!-- The topo diagram goes inside this div, when it becomes available. -->
<div class='row'>
<div class='col-lg-10 col-lg-offset-1
col-md-10 col-md-offset-1
col-sm-10 col-sm-offset-1
col-xs-12 col-xs-offset-0'>
col-md-12 col-md-offset-0
col-sm-12 col-sm-offset-0
col-xs-12 col-xs-offset-0'>
<div class='panel panel-default invisible' id='showtopo_container'>
<div class='panel-body'>
<div id='quicktabs_div'>
......@@ -457,6 +457,7 @@ data-content='Ask cluster for updated node status'>
<th>ID</th>
<th>Node</th>
<th>Type</th>
<th>Image</th>
<th>SSH command <small>
(if you provided your own key)</small>
</th>
......
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