Commit 5f87a0d4 authored by Mac Newbold's avatar Mac Newbold

Add new swapping control bits to the expt. display, along with the ability to toggle

them.

Make user profile toggle for admin mode use toggle.php too.)

Fix Eric's nit about showing no estimate before we have one to offer.
parent 106740ef
......@@ -491,10 +491,10 @@ function SHOWUSER($uid) {
$onoff = ($adminoff ? "Off" : "On");
$flip = ($adminoff ? 0 : 1);
echo "<tr>
<td>Admin (on/off):</td>
<td>Yes
<a href=adminmode.php3?target_uid=$uid&adminoff=$flip>
($onoff)</td>
<td>Admin (on/off):</td>
<td>Yes
<a href=toggle.php?target_uid=$uid&type=adminoff&value=$flip>
($onoff)</td>
</tr>\n";
}
......@@ -564,6 +564,12 @@ function SHOWEXP($pid, $eid) {
$batchstate = $exprow[batchstate];
$priority = $exprow[priority];
$swappable = $exprow[swappable];
$noswap_reason = $exprow[noswap_reason];
$idleswap = $exprow[idleswap];
$idleswap_timeout = $exprow[idleswap_timeout];
$noidleswap_reason = $exprow[noidleswap_reason];
$autoswap = $exprow[autoswap];
$autoswap_timeout = $exprow[autoswap_timeout];
$idle_ignore = $exprow[idle_ignore];
$swapreqs = $exprow[swap_requests];
$lastswapreq = $exprow[last_swap_req];
......@@ -576,6 +582,29 @@ function SHOWEXP($pid, $eid) {
else
$swappable = "No
<a href=\"toggle.php?type=swappable&value=1&pid=$pid&eid=$eid\">
<img src=\"redball.gif\" border=0 alt=\"Toggle\"></a> (\"$noswap_reason\")";
$idleswap_hrs= ($idleswap_timeout/60.0);
$idleswap_str= $idleswap_hrs." hour".($idleswap_hrs==1 ? "" : "s");
if ($idleswap)
$idleswap = "Yes
<a href=\"toggle.php?type=idleswap&value=0&pid=$pid&eid=$eid\">
<img src=\"greenball.gif\" border=0 alt=\"Toggle\"></a> (after $idleswap_str)";
else
$idleswap = "No
<a href=\"toggle.php?type=idleswap&value=1&pid=$pid&eid=$eid\">
<img src=\"redball.gif\" border=0 alt=\"Toggle\"></a> ".
"(\"$noidleswap_reason\")";
$autoswap_hrs= ($autoswap_timeout/60.0);
$autoswap_str= $autoswap_hrs." hour".($autoswap_hrs==1 ? "" : "s");
if ($autoswap)
$autoswap = "Yes
<a href=\"toggle.php?type=autoswap&value=0&pid=$pid&eid=$eid\">
<img src=\"greenball.gif\" border=0 alt=\"Toggle\"></a> (after $autoswap_str)";
else
$autoswap = "No
<a href=\"toggle.php?type=autoswap&value=1&pid=$pid&eid=$eid\">
<img src=\"redball.gif\" border=0 alt=\"Toggle\"></a>";
if ($idle_ignore)
......@@ -633,10 +662,26 @@ function SHOWEXP($pid, $eid) {
}
echo "<tr>
<td><a href='$TBDOCBASE/faq.php3#UTT-Swapping'>Swappable:</a></td>
<td><a
href='$TBDOCBASE/docwrapper.php3?docname=swapping.html#swapping'>
Swappable:</a></td>
<td class=\"left\">$swappable</td>
</tr>\n";
echo "<tr>
<td><a
href='$TBDOCBASE/docwrapper.php3?docname=swapping.html#idleswap'>
Idle-Swap:</a></td>
<td class=\"left\">$idleswap</td>
</tr>\n";
echo "<tr>
<td><a
href='$TBDOCBASE/docwrapper.php3?docname=swapping.html#autoswap'>
Auto-Swap:</a></td>
<td class=\"left\">$autoswap</td>
</tr>\n";
# XXX: isadmin doesn't use the uid you give it, and we don't have a real
# uid to send here. so just make something up to match the prototype.
if (isadmin(123)) {
......@@ -646,11 +691,6 @@ function SHOWEXP($pid, $eid) {
</tr>\n";
}
echo "<tr>
<td>Priority: (0 is highest) </td>
<td class=\"left\">$priority</td>
</tr>\n";
echo "<tr>
<td>Shared: </td>
<td class=\"left\">";
......@@ -683,11 +723,19 @@ function SHOWEXP($pid, $eid) {
echo "</td>
</tr>\n";
} else {
echo "<tr>
if ($minnodes!="") {
echo "<tr>
<td>Minumum Nodes: </td>
<td class=\"left\"><font color=blue>
<td class=\"left\"><font color=green>
$minnodes (estimate)</font></td>
</tr>\n";
} else {
echo "<tr>
<td>Minumum Nodes: </td>
<td class=\"left\"><font color=green>
Unknown</font></td>
</tr>\n";
}
}
$lastact = TBGetExptLastAct($pid,$eid);
......
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
# All rights reserved.
#
include("defs.php3");
......@@ -29,11 +29,14 @@ LOGGEDINORDIE($uid);
# (type & value are required, others are optional and vary by type)
# List of valid toggles
$toggles = array("adminoff", "swappable", "idle_ignore");
$toggles = array("adminoff", "swappable", "idleswap", "autoswap",
"idle_ignore");
# list of valid values for each toggle
$values = array("adminoff" => array(0,1),
"swappable" => array(0,1),
"idleswap" => array(0,1),
"autoswap" => array(0,1),
"idle_ignore" => array(0,1) );
if (! in_array($type, $toggles)) {
......@@ -56,7 +59,7 @@ if ($type=="adminoff") {
DBQueryFatal("update users set adminoff=$value where uid='$target_uid'");
} elseif ($type=="swappable") {
} elseif ($type=="swappable" || $type=="idleswap" || $type=="autoswap") {
# must be admin OR must have permission to modify the expt...
if (! ($CHECKLOGIN_STATUS & CHECKLOGIN_ISADMIN) ||
! TBExptAccessCheck($uid, $pid, $eid, $TB_EXPT_MODIFY)) {
......@@ -68,7 +71,7 @@ if ($type=="adminoff") {
USERERROR("Experiment '$pid/$eid' is not valid!", 1);
}
DBQueryFatal("update experiments set swappable=$value ".
DBQueryFatal("update experiments set $type=$value ".
"where pid='$pid' and eid='$eid'");
} elseif ($type=="idle_ignore") {
......
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