Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
emulab-devel
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
143
Issues
143
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
emulab
emulab-devel
Commits
6fa26960
Commit
6fa26960
authored
Oct 31, 2000
by
Leigh B. Stoller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Experiments stuff.
parent
c0b2800b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
185 additions
and
17 deletions
+185
-17
www/beginexp_process.php3
www/beginexp_process.php3
+96
-11
www/defs.php3
www/defs.php3
+9
-1
www/endexp.php3
www/endexp.php3
+79
-4
www/endexp_form.php3
www/endexp_form.php3
+1
-1
No files found.
www/beginexp_process.php3
View file @
6fa26960
...
...
@@ -95,7 +95,7 @@ if ($row = mysql_fetch_row($pswd_result)) {
$query_result
=
mysql_db_query
(
$TBDBNAME
,
"SELECT eid FROM experiments WHERE eid=
\"
$exp_id
\"
"
);
if
(
$row
=
mysql_fetch_row
(
$query_result
))
{
USERERROR
(
"The experiment name
\"
$exp_id
\"
you have chosen is already "
.
USERERROR
(
"The experiment name
\"
$exp_id
\"
you have chosen is already "
.
"in use. Please select another."
,
1
);
}
...
...
@@ -109,27 +109,112 @@ if ($row = mysql_fetch_row($query_result)) {
$query_result
=
mysql_db_query
(
$TBDBNAME
,
"SELECT * FROM grp_memb WHERE gid=
\"
$exp_pid
\"
and uid=
\"
$uid
\"
"
);
if
((
$row
=
mysql_fetch_array
(
$query_result
))
==
0
)
{
USERERROR
(
"You are not a member of Project
$exp_pid
, so you cannot begin "
.
USERERROR
(
"You are not a member of Project
$exp_pid
, so you cannot begin "
.
"an experiment in that project."
,
1
);
}
$trust
=
$row
[
trust
];
if
(
strcmp
(
$trust
,
"group_root"
)
&&
strcmp
(
$trust
,
"local_root"
))
{
USERERROR
(
"You are not group or local root in Project
$exp_pid
, so you "
.
"cannot begin an experiment in that project."
,
1
);
USERERROR
(
"You are not group or local root in Project
$exp_pid
, so you "
.
"cannot begin an experiment in that project."
,
1
);
}
#
# We are going to write out the NS file to a subdir in the users
# home directory.
# We are going to write out the NS file to a subdir of the testbed
# directory. We create a subdir in there, and stash the ns file for
# processing by tbrun. We generate a name from the experiment ID,
# which we know to be unique cause we tested that above. Later, when
# the experiment is ended, the directory will be deleted.
#
# No need to tell me how bogus this is.
#
$dirname
=
"
$TBWWW_DIR
"
.
"
$TBNSSUBDIR
"
.
"/"
.
"
$exp_id
"
;
$nsname
=
"
$dirname
"
.
"/
$exp_id
"
.
".ns"
;
$irname
=
"
$dirname
"
.
"/
$exp_id
"
.
".ir"
;
$repname
=
"
$dirname
"
.
"/
$exp_id
"
.
".report"
;
if
(
!
mkdir
(
$dirname
,
0777
))
{
TBERROR
(
"Making directory for experiment:
$dirname
."
,
1
);
}
if
(
!
copy
(
$exp_nsfile
,
"
$nsname
"
))
{
rmdir
(
$dirname
);
TBERROR
(
"Copying NS file for experiment into
$dirname
."
,
1
);
}
echo
"<center><br>"
;
echo
"<h3>Setting up experiment. This may take a few minutes ...</h3>"
;
echo
"</center>"
;
#
# Run the scripts. We use a script wrapper to deal with changing
# to the proper directory and to keep some of these details out
# of this. We just want to know if the experiment setup worked.
# The wrapper is going to go the extra step of running tbreport
# so that we can give the user warm fuzzies.
#
$output
=
array
();
$retval
=
0
;
$result
=
exec
(
"
$TBBIN_DIR
/tbdoit
$dirname
$pid
$nsname
"
,
$output
,
$retval
);
if
(
$retval
)
{
echo
"<br><br><h2>
Setup Failure(
$retval
): Output as follows:
</h2>
<br>
<XMP>
\n
"
;
for
(
$i
=
0
;
$i
<
count
(
$output
);
$i
++
)
{
echo
"
$output[$i]
\n
"
;
}
echo
"</XMP>
\n
"
;
unlink
(
"
$nsname
"
);
unlink
(
"
$irname
"
);
unlink
(
"
$repname
"
);
rmdir
(
"
$dirname
"
);
die
(
""
);
}
#
# Make sure the report file exists, just to be safe!
#
if
(
!
file_exists
(
$repname
))
{
unlink
(
"
$nsname
"
);
unlink
(
"
$irname
"
);
unlink
(
"
$repname
"
);
rmdir
(
"
$dirname
"
);
TBERROR
(
"Report file for new experiment does not exist!
\n
"
,
1
);
}
#
# So, that went okay. At this point enter the exp_id into the database
# so that it shows up as valid.
#
$query_result
=
mysql_db_query
(
$TBDBNAME
,
"INSERT INTO experiments "
.
"(eid, pid, expt_created, expt_expires, expt_name, "
.
"expt_head_uid, expt_start, expt_end) "
.
"VALUES ('
$exp_id
', '
$exp_pid
', '
$exp_created
', '
$exp_expires
', "
.
"'
$exp_name
', '
$uid
', '
$exp_start
', '
$exp_end
')"
);
if
(
!
$query_result
)
{
$err
=
mysql_error
();
TBERROR
(
"Database Error adding new experiment
$exp_id
:
$err
\n
"
,
1
);
}
echo
"
$exp_nsfile
<p
>"
;
echo
"
$exp_nsfile_name
<p
>"
;
echo
"
$exp_nsfile_size
<p
>"
;
echo
"
$exp_nsfile_type
<p
>"
;
echo
"
<center><br
>"
;
echo
"
<h2>Experiment Configured!<br
>"
;
echo
"
Here is a summary of the nodes that were allocated<br
>"
;
echo
"
</h2></center><br
>"
;
copy
(
$exp_nsfile
,
"/tmp/foo.ns"
);
#
# Lets dump the report file to the user.
#
$fp
=
fopen
(
$repname
,
"r"
);
if
(
!
$fp
)
{
TBERROR
(
"Error opening report file for experiment:
$exp_eid
\n
"
,
1
);
}
echo
"<XMP>"
;
while
(
$line
=
fgets
(
$fp
,
1024
))
{
echo
"
$line
"
;
}
echo
"</XMP>
\n
"
;
?>
</body>
...
...
www/defs.php3
View file @
6fa26960
...
...
@@ -5,15 +5,19 @@
$TBWWW
=
"<https://www.emulab.net/tbdb.html>"
;
$TBMAIL_CONTROL
=
"Testbed Ops <testbed-ops@flux.cs.utah.edu>"
;
$TBMAIL_WWW
=
"Testbed WWW <testbed-www@flux.cs.utah.edu>"
;
#$TBMAIL_WWW = "Testbed WWW <stoller@fast.cs.utah.edu>";
$TBMAIL_APPROVE
=
"Testbed Approval <testbed-approval@flux.cs.utah.edu>"
;
$TBDBNAME
=
"tbdb"
;
$TBDIR
=
"/usr/testbed/www/"
;
$TBDIR
=
"/usr/testbed/"
;
$TBWWW_DIR
=
"
$TBDIR
"
.
"www/"
;
$TBBIN_DIR
=
"
$TBDIR
"
.
"bin/"
;
$TBLIST_DIR
=
"/usr/testbed/www/maillist"
;
$TBLIST_LEADERS
=
"
$TBLIST_DIR
"
.
"/leaders.txt"
;
$TBLIST_USERS
=
"
$TBLIST_DIR
"
.
"/users.txt"
;
$TBUSER_DIR
=
"/users/"
;
$TBNSSUBDIR
=
"nsdir"
;
#
# Generate the KEY from a name
...
...
@@ -28,6 +32,7 @@ function GENKEY ($name) {
# should then terminate if required to do so.
#
function
TBERROR
(
$message
,
$death
)
{
if
(
0
)
{
mail
(
$TBMAIL_WWW
,
"TESTBED ERROR REPORT"
,
"
\n
"
.
...
...
@@ -36,6 +41,9 @@ function TBERROR ($message, $death) {
"Testbed WWW
\n
"
,
"From:
$TBMAIL_WWW
\n
"
.
"Errors-To:
$TBMAIL_WWW
"
);
}
# Allow sendmail to run.
sleep
(
2
);
if
(
$death
)
{
die
(
"<br><br><h3>"
.
...
...
www/endexp.php3
View file @
6fa26960
...
...
@@ -22,6 +22,14 @@ if (!isset($uid)) {
USERERROR
(
"You must be logged in to sho experiment information!"
,
1
);
}
#
# Must provide the EID!
#
if
(
!
isset
(
$exp_id
)
||
strcmp
(
$exp_id
,
""
)
==
0
)
{
USERERROR
(
"The experiment ID was not provided!"
,
1
);
}
#
# Verify that the uid is known in the database.
#
...
...
@@ -42,9 +50,9 @@ if (($row = mysql_fetch_row($query_result)) == 0) {
# Then check to see if the user (UID) is a member of that PID.
#
$query_result
=
mysql_db_query
(
$TBDBNAME
,
"SELECT * FROM experiments WHERE eid=
\"
$exp_
e
id
\"
"
);
"SELECT * FROM experiments WHERE eid=
\"
$exp_id
\"
"
);
if
((
$exprow
=
mysql_fetch_array
(
$query_result
))
==
0
)
{
USERERROR
(
"The experiment
$exp_
e
id
is not a valid experiment."
,
1
);
USERERROR
(
"The experiment
$exp_id
is not a valid experiment."
,
1
);
}
$pid
=
$exprow
[
pid
];
...
...
@@ -54,9 +62,76 @@ if (mysql_num_rows($query_result) == 0) {
USERERROR
(
"You are not a member of the Project for Experiment:
$exp_id
."
,
1
);
}
?>
<center>
#
# As per what happened when the experiment was created, we need to
# go back to that directory and use the .ir file to terminate the
# experiment, and then delete the files and the directory.
#
# XXX These paths/filenames are setup in beginexp_process.php3.
#
# No need to tell me how bogus this is.
#
$dirname
=
"
$TBWWW_DIR
"
.
"
$TBNSSUBDIR
"
.
"/"
.
"
$exp_id
"
;
$nsname
=
"
$dirname
"
.
"/
$exp_id
"
.
".ns"
;
$irname
=
"
$dirname
"
.
"/
$exp_id
"
.
".ir"
;
$repname
=
"
$dirname
"
.
"/
$exp_id
"
.
".report"
;
#
# Make sure the experiment directory exists before continuing.
#
if
(
!
file_exists
(
$irname
))
{
TBERROR
(
"IR file for new experiment does not exist!
\n
"
,
1
);
}
echo
"<center><br>"
;
echo
"<h3>Terminating the experiment. This may take a few minutes ...</h3>"
;
echo
"</center>"
;
#
# Run the scripts. We use a script wrapper to deal with changing
# to the proper directory and to keep some of these details out
# of this.
#
$output
=
array
();
$retval
=
0
;
$result
=
exec
(
"
$TBBIN_DIR
/tbstopit
$dirname
$irname
"
,
$output
,
$retval
);
if
(
$retval
)
{
echo
"<br><br><h2>
Termination Failure(
$retval
): Output as follows:
</h2>
<br>
<XMP>
\n
"
;
for
(
$i
=
0
;
$i
<
count
(
$output
);
$i
++
)
{
echo
"
$output[$i]
\n
"
;
}
echo
"</XMP>
\n
"
;
die
(
""
);
}
#
# Remove all trace!
#
unlink
(
"
$nsname
"
);
unlink
(
"
$irname
"
);
unlink
(
"
$repname
"
);
rmdir
(
"
$dirname
"
);
#
# From the database too!
#
$query_result
=
mysql_db_query
(
$TBDBNAME
,
"DELETE FROM experiments WHERE eid='
$exp_id
'"
);
if
(
!
$query_result
)
{
$err
=
mysql_error
();
TBERROR
(
"Database Error deleting experiment
$exp_id
:
$err
\n
"
,
1
);
}
echo
"<center><br>"
;
echo
"<h2>Experiment Terminated! Thanks!<br>"
;
echo
"</h2></center><br>"
;
?>
</center>
</body>
</html>
www/endexp_form.php3
View file @
6fa26960
...
...
@@ -67,7 +67,7 @@ echo "<form action=\"endexp.php3?$uid\" method=\"post\">";
# experiments as an option list.
#
echo
"<tr>"
;
echo
" <td><select name=
\"
exp_
e
id
\"
>"
;
echo
" <td><select name=
\"
exp_id
\"
>"
;
while
(
$grprow
=
mysql_fetch_array
(
$groupmemb_result
))
{
$pid
=
$grprow
[
gid
];
$exp_result
=
mysql_db_query
(
$TBDBNAME
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment