Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
emulab-devel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Emmanuel Cecchet
emulab-devel
Commits
73012cdb
Commit
73012cdb
authored
22 years ago
by
Leigh B. Stoller
Browse files
Options
Downloads
Patches
Plain Diff
Add web option to reboot nodes/expirements.
parent
18dcf80d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
tbsetup/GNUmakefile.in
+1
-1
1 addition, 1 deletion
tbsetup/GNUmakefile.in
www/boot.php3
+148
-0
148 additions, 0 deletions
www/boot.php3
www/showexp.php3
+7
-12
7 additions, 12 deletions
www/showexp.php3
www/shownode.php3
+7
-4
7 additions, 4 deletions
www/shownode.php3
with
163 additions
and
17 deletions
tbsetup/GNUmakefile.in
+
1
−
1
View file @
73012cdb
...
...
@@ -33,7 +33,7 @@ LIBEXEC_STUFF = rmproj rmacct-ctrl wanlinksolve wanlinkinfo \
webrmgroup webswapexp webnodecontrol \
webmkgroup webmkacct websetgroups webmkproj \
spewlogfile staticroutes routecalc wanassign \
webidlecheck
webidlecheck
webnodereboot
LIB_STUFF = libtbsetup.pm exitonwarn.pm libtestbed.pm snmpit_intel.pm \
snmpit_cisco.pm snmpit_lib.pm snmpit_apc.pm power_rpc27.pm \
...
...
This diff is collapsed.
Click to expand it.
www/boot.php3
0 → 100644
+
148
−
0
View file @
73012cdb
<?php
include
(
"defs.php3"
);
include
(
"showstuff.php3"
);
#
# No PAGEHEADER since we spit out a Location header later. See below.
#
#
# Only known and logged in users can do this.
#
$uid = GETLOGIN();
LOGGEDINORDIE
(
$uid
);
#
# Check to make sure a valid nodeid, *or* a valid experiment.
#
if (isset($pid) && strcmp($pid, "") &&
isset
(
$eid
)
&&
strcmp
(
$eid
,
""
))
{
if
(
!
TBValidExperiment
(
$pid
,
$eid
))
{
USERERROR
(
"
$pid
/
$eid
is not a valid experiment!"
,
1
);
}
if
(
!
TBExptAccessCheck
(
$uid
,
$pid
,
$eid
,
$TB_EXPT_MODIFY
))
{
USERERROR
(
"You do not have permission to reboot nodes in "
.
"experiment
$exp_eid
!"
,
1
);
}
$nodemode
=
0
;
}
elseif
(
isset
(
$node_id
)
&&
strcmp
(
$node_id
,
""
))
{
if
(
!
TBValidNodeName
(
$node_id
))
{
USERERROR
(
"
$node_id
is not a valid node name!"
,
1
);
}
if
(
!
TBNodeAccessCheck
(
$uid
,
$node_id
,
$TB_NODEACCESS_REBOOT
))
{
USERERROR
(
"You do not have permission to reboot
$node_id
!"
,
1
);
}
$nodemode
=
1
;
}
else
{
USERERROR
(
"Must specify a node or an experiment!"
,
1
);
}
#
# We run this twice. The first time we are checking for a confirmation
# by putting up a form. The next time through the confirmation will be
# set. Or, the user can hit the cancel button, in which case we should
# probably redirect the browser back up a level.
#
if ($canceled) {
PAGEHEADER
(
"Reboot Nodes"
);
echo
"<center><h3><br>
Operation canceled!
</h3></center>
\n
"
;
PAGEFOOTER
();
return
;
}
if
(
!
$confirmed
)
{
PAGEHEADER
(
"Reboot Nodes"
);
if
(
$nodemode
)
{
echo
"<center><h2><br>
Are you <b>REALLY</b>
sure you want to reboot node '
$node_id
?'
</h2>
\n
"
;
SHOWNODE
(
$node_id
);
}
else
{
echo
"<center><h2><br>
Are you <b>REALLY</b>
sure you want to reboot all nodes in experiment
$pid
/
$eid
?
</h2>
\n
"
;
SHOWEXP
(
$pid
,
$eid
);
}
echo
"<form action=boot.php3 target=_blank method=post>"
;
if
(
$nodemode
)
{
echo
"<input type=hidden name=node_id value=
$node_id
>
\n
"
;
}
else
{
echo
"<input type=hidden name=pid value=
$pid
>
\n
"
;
echo
"<input type=hidden name=eid value=
$eid
>
\n
"
;
}
echo
"<b><input type=submit name=confirmed value=Confirm></b>
\n
"
;
echo
"<b><input type=submit name=canceled value=Cancel></b>
\n
"
;
echo
"</form>
\n
"
;
echo
"</center>
\n
"
;
PAGEFOOTER
();
return
;
}
#
# Pass it off to the script.
#
$retval = 0;
header
(
"Content-Type: text/plain"
);
ignore_user_abort
(
1
);
if
(
$nodemode
)
{
$result
=
system
(
"
$TBSUEXEC_PATH
$uid
nobody webnodereboot
$node_id
"
,
$retval
);
}
else
{
$result
=
system
(
"
$TBSUEXEC_PATH
$uid
nobody webnodereboot -e
$pid
,
$eid
"
,
$retval
);
}
if
(
$retval
)
{
USERERROR
(
"Reboot failed!"
,
1
);
}
#
# And send an audit message.
#
TBUserInfo($uid, $uid_name, $uid_email);
if
(
$nodemode
)
{
$message
=
"
$node_id
was rebooted via the web interface by
$uid
\n
"
;
$subject
=
"Node Reboot:
$node_id
"
;
}
else
{
$message
=
"Nodes in
$pid
/
$eid
were rebooted via the web interface "
.
"by
$uid
\n
"
;
$subject
=
"Nodes Rebooted:
$pid
/eid"
;
}
TBMAIL
(
$TBMAIL_AUDIT
,
$subject
,
$message
,
"From:
$uid_name
<
$uid_email
>
\n
"
.
"Errors-To:
$TBMAIL_WWW
"
);
#
# Spit out a redirect so that the history does not include a post
# in it.
#
#if ($nodemode)
# header("Location: shownode.php3?node_id=$node_id");
#else
# header("Location: showexp.php3?exp_pid=$pid&exp_eid=$eid");
?>
This diff is collapsed.
Click to expand it.
www/showexp.php3
+
7
−
12
View file @
73012cdb
...
...
@@ -48,7 +48,7 @@ SUBPAGESTART();
SUBMENUSTART
(
"Experiment Options"
);
if
(
$expstate
)
{
if
(
strcmp
(
$expstate
,
$TB_EXPTSTATE_ACTIVATING
)
==
0
)
{
if
(
TBExptLogFile
(
$exp_pid
,
$exp_eid
)
)
{
WRITESUBMENUBUTTON
(
"View Activation Logfile"
,
"spewlogfile.php3?pid=
$exp_pid
&eid=
$exp_eid
"
);
}
...
...
@@ -88,6 +88,12 @@ if (TBExptAccessCheck($uid, $exp_pid, $exp_eid, $TB_EXPT_UPDATEACCOUNTS)) {
"updateaccounts.php3?pid=
$exp_pid
&eid=
$exp_eid
"
);
}
# Reboot option
if
(
TBExptAccessCheck
(
$uid
,
$exp_pid
,
$exp_eid
,
$TB_EXPT_MODIFY
))
{
WRITESUBMENUBUTTON
(
"Reboot all Nodes"
,
"boot.php3?pid=
$exp_pid
&eid=
$exp_eid
"
);
}
#
# Admin folks get a swap request link to send email.
#
...
...
@@ -109,17 +115,6 @@ SUBPAGEEND();
#
SHOWNODES($exp_pid, $exp_eid);
if
(
$expstate
&&
(
strcmp
(
$expstate
,
$TB_EXPTSTATE_SWAPPING
)
==
0
||
strcmp
(
$expstate
,
$TB_EXPTSTATE_ACTIVATING
)
==
0
))
{
echo
"<script language=
\"
JavaScript
\"
>
<!--
doLoad(30000);
//-->
</script>
\n
"
;
}
#
# Standard Testbed Footer
#
...
...
This diff is collapsed.
Click to expand it.
www/shownode.php3
+
7
−
4
View file @
73012cdb
...
...
@@ -25,10 +25,8 @@ if (!isset($node_id) ||
#
# Check to make sure that this is a valid nodeid
#
$query_result =
DBQueryFatal
(
"SELECT node_id FROM nodes WHERE node_id='
$node_id
'"
);
if
(
mysql_num_rows
(
$query_result
)
==
0
)
{
USERERROR
(
"The node
$node_id
is not a valid nodeid!"
,
1
);
if (! TBValidNodeName($node_id)) {
USERERROR
(
"
$node_id
is not a valid node name!"
,
1
);
}
#
...
...
@@ -50,6 +48,11 @@ SUBMENUSTART("Node Options");
WRITESUBMENUBUTTON("Edit node info",
"nodecontrol_form.php3?node_id=
$node_id
"
);
if
(
TBNodeAccessCheck
(
$uid
,
$node_id
,
$TB_NODEACCESS_REBOOT
))
{
WRITESUBMENUBUTTON
(
"Reboot Node"
,
"boot.php3?node_id=
$node_id
"
);
}
if
(
$isadmin
)
{
WRITESUBMENUBUTTON
(
"Access Node Log"
,
"shownodelog.php3?node_id=
$node_id
"
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment