Commit ddf94fab authored by Leigh Stoller's avatar Leigh Stoller

Minor changes for Protogeni that allows a slice experiment to be

properly swapped out via the protogeni path. This is useful for local
admins, who might want to stop a misbehaving sliver on the local
Emulab.
parent 96c002ce
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
# Copyright (c) 2000-2008 University of Utah and the Flux Group.
# All rights reserved.
#
include("defs.php3");
......@@ -37,10 +37,17 @@ PAGEHEADER("Terminate Experiment");
# Need these below.
$lockdown = $experiment->lockdown();
$geniflags = $experiment->geniflags();
$exptidx = $experiment->idx();
$pid = $experiment->pid();
$eid = $experiment->eid();
# Must go through the geni interfaces.
if ($geniflags) {
USERERROR("You must terminate ProtoGeni experiments via the ".
"the ProtoGeni APIs!", 1);
}
#
# Verify permissions.
#
......
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2006, 2007 University of Utah and the Flux Group.
# Copyright (c) 2006, 2007, 2008 University of Utah and the Flux Group.
# All rights reserved.
#
#
......@@ -317,6 +317,7 @@ class Experiment
function keyhash() { return $this->field('keyhash'); }
function paniced() { return $this->field('paniced'); }
function panic_date() { return $this->field('panic_date'); }
function geniflags() { return $this->field('geniflags'); }
#
# Access Check. Project level check since this might not be a current
......
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
# Copyright (c) 2000-2008 University of Utah and the Flux Group.
# All rights reserved.
#
include("defs.php3");
......@@ -37,6 +37,12 @@ $pid = $experiment->pid();
$eid = $experiment->eid();
$unix_gid = $experiment->UnixGID();
$expstate = $experiment->state();
$geniflags = $experiment->geniflags();
# Must go through the geni interfaces.
if ($geniflags) {
USERERROR("You cannot modify ProtoGeni experiments this way!", 1);
}
if (!$experiment->AccessCheck($this_user, $TB_EXPT_MODIFY)) {
USERERROR("You do not have permission to modify this experiment.", 1);
......
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
# Copyright (c) 2000-2008 University of Utah and the Flux Group.
# All rights reserved.
#
include("defs.php3");
......@@ -267,6 +267,7 @@ $linktest_running = $experiment->linktest_pid();
$paniced = $experiment->paniced();
$panic_date = $experiment->panic_date();
$lockdown = $experiment->lockdown();
$geniflags = $experiment->geniflags();
if (! ($experiment_stats = $experiment->GetStats())) {
TBERROR("Could not get experiment stats object for $expindex", 1);
......@@ -348,7 +349,7 @@ if ($expstate) {
}
}
else {
if ($expstate == $TB_EXPTSTATE_SWAPPED) {
if (!$geniflags && $expstate == $TB_EXPTSTATE_SWAPPED) {
WRITESUBMENUBUTTON(($instance ?
"Swap Instance In" :
"Swap Experiment In"),
......@@ -363,7 +364,7 @@ if ($expstate) {
CreateURL("swapexp", $experiment,
"inout", "out"));
}
elseif ($expstate == $TB_EXPTSTATE_ACTIVATING) {
elseif (!$geniflags && $expstate == $TB_EXPTSTATE_ACTIVATING) {
WRITESUBMENUBUTTON(($instance ?
"Cancel Template Instantiation" :
"Cancel Experiment Swapin"),
......@@ -372,7 +373,7 @@ if ($expstate) {
}
}
if (!$instance && $expstate != $TB_EXPTSTATE_PANICED) {
if (!$instance && !$geniflags && $expstate != $TB_EXPTSTATE_PANICED) {
WRITESUBMENUBUTTON("Terminate Experiment",
CreateURL("endexp", $experiment));
}
......@@ -382,7 +383,8 @@ if ($expstate) {
}
# Batch experiments can be modifed only when paused.
if (!$instance && ($expstate == $TB_EXPTSTATE_SWAPPED ||
if (!$geniflags &&
!$instance && ($expstate == $TB_EXPTSTATE_SWAPPED ||
(!$isbatch && $expstate == $TB_EXPTSTATE_ACTIVE))) {
WRITESUBMENUBUTTON("Modify Experiment",
CreateURL("modifyexp", $experiment));
......@@ -421,7 +423,7 @@ if ($expstate) {
CreateURL("template_commit", $instance));
}
if ($expstate == $TB_EXPTSTATE_ACTIVE) {
if (!$geniflags && $expstate == $TB_EXPTSTATE_ACTIVE) {
WRITESUBMENUBUTTON("Modify Traffic Shaping",
CreateURL("delaycontrol", $experiment));
}
......@@ -433,11 +435,13 @@ WRITESUBMENUBUTTON("Modify Settings",
WRITESUBMENUDIVIDER();
if ($expstate == $TB_EXPTSTATE_ACTIVE) {
WRITESUBMENUBUTTON("Link Tracing/Monitoring",
CreateURL("linkmon_list", $experiment));
if (!$geniflags) {
WRITESUBMENUBUTTON("Link Tracing/Monitoring",
CreateURL("linkmon_list", $experiment));
WRITESUBMENUBUTTON("Event Viewer",
CreateURL("showevents", $experiment));
WRITESUBMENUBUTTON("Event Viewer",
CreateURL("showevents", $experiment));
}
#
# Admin and project/experiment leaders get this option.
......@@ -465,7 +469,7 @@ if (($expstate == $TB_EXPTSTATE_ACTIVE ||
}
if ($expstate == $TB_EXPTSTATE_ACTIVE) {
if (STUDLY() && isset($classes['pcvm'])) {
if (!$geniflags && STUDLY() && isset($classes['pcvm'])) {
WRITESUBMENUBUTTON("Record Feedback Data",
CreateURL("feedback", $experiment) .
"&mode=record");
......@@ -474,7 +478,7 @@ if ($expstate == $TB_EXPTSTATE_ACTIVE) {
if (($expstate == $TB_EXPTSTATE_ACTIVE ||
$expstate == $TB_EXPTSTATE_SWAPPED) &&
STUDLY()) {
!$geniflags && STUDLY()) {
WRITESUBMENUBUTTON("Clear Feedback Data",
CreateURL("feedback", $experiment) . "&mode=clear");
if (isset($classes['pcvm'])) {
......@@ -499,10 +503,12 @@ if (! $instance) {
"showstats.php3?showby=expt&exptidx=$expindex");
}
WRITESUBMENUBUTTON("Duplicate Experiment",
"beginexp_html.php3?copyid=$expindex");
if (!$geniflags) {
WRITESUBMENUBUTTON("Duplicate Experiment",
"beginexp_html.php3?copyid=$expindex");
}
if ($EXPOSEARCHIVE && !$instance) {
if ($EXPOSEARCHIVE && !$instance && !$geniflags) {
WRITESUBMENUBUTTON("Experiment File Archive",
"archive_view.php3?experiment=$expindex");
}
......@@ -538,21 +544,24 @@ if (isset($classes['mote']) && $expstate == $TB_EXPTSTATE_ACTIVE) {
if ($isadmin) {
if ($expstate == $TB_EXPTSTATE_ACTIVE) {
SUBMENUSECTION("Beta-Test Options");
WRITESUBMENUBUTTON("Restart Experiment",
CreateURL("swapexp", $experiment,
"inout", "restart"));
WRITESUBMENUBUTTON("Replay Events",
CreateURL("replayexp", $experiment));
if (!$geniflags) {
SUBMENUSECTION("Beta-Test Options");
WRITESUBMENUBUTTON("Restart Experiment",
CreateURL("swapexp", $experiment,
"inout", "restart"));
WRITESUBMENUBUTTON("Replay Events",
CreateURL("replayexp", $experiment));
}
SUBMENUSECTION("Admin Options");
if (!$geniflags) {
WRITESUBMENUBUTTON("Send an Idle Info Request",
CreateURL("request_idleinfo", $experiment));
WRITESUBMENUBUTTON("Send an Idle Info Request",
CreateURL("request_idleinfo", $experiment));
WRITESUBMENUBUTTON("Send a Swap Request",
CreateURL("request_swapexp", $experiment));
WRITESUBMENUBUTTON("Send a Swap Request",
CreateURL("request_swapexp", $experiment));
}
WRITESUBMENUBUTTON("Force Swap Out (Idle-Swap)",
CreateURL("swapexp", $experiment,
"inout", "out", "force", 1));
......
......@@ -62,9 +62,29 @@ if (isset($force) && $force == 1) {
if ($forcetype=="autoswap") { $autoswap=1; }
}
else {
$force = 0;
$idleswap=0;
$autoswap=0;
# Must go through the geni interfaces.
if ($experiment->geniflags()) {
USERERROR("You must use forceable swap on ProtoGeni experiments", 1);
}
#
# If the user is not a member of the group, it
# must be an admin, and in that case we want him to use the force
# swapout path to avoid permission issues.
#
$group = $experiment->Group();
if (!isset($group)) {
TBERROR("Could not get group object for $pid/eid", 1);
}
if (!$group->IsMember($this_user, $ignore) && $isadmin) {
USERERROR("Since you are an administrator trying to swap out ".
"an experiment in a project/group you do not belong to, ".
"please go back and use the forcible swap options instead.",
1);
}
$force = 0;
$idleswap=0;
$autoswap=0;
}
# Need these below
......
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