Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emulab
emulab-devel
Commits
61c9bb93
Commit
61c9bb93
authored
Mar 26, 2001
by
Leigh B. Stoller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some seriously bogus auto reloading code.
parent
249c62d9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
4 deletions
+54
-4
db/nfree.in
db/nfree.in
+10
-2
tbsetup/os_setup.in
tbsetup/os_setup.in
+38
-2
tbsetup/sched_reload.in
tbsetup/sched_reload.in
+6
-0
No files found.
db/nfree.in
View file @
61c9bb93
...
...
@@ -52,7 +52,7 @@ if ($sth->numrows < 1) {
}
$cmd
=
"
lock tables nodes read, node_types read, reloads read,
"
.
"
interfaces write, delays write, reserved write
";
"
interfaces write, delays write, reserved
write, last_reservation
write
";
$sth
=
$dbh
->
query
(
$cmd
)
||
die
("
Locking error:
\n
$cmd
\n
Error string is:
"
.
$dbh
->
errstr
.
"
\n
");
...
...
@@ -78,12 +78,17 @@ foreach my $n (@node_names) {
push
(
@freed_nodes
,
$n
);
}
# This little sillyness is for disk reloading. Kill the last reservation.
$cmd
=
"
delete from last_reservation where node_id='
$n
'
";
$dbh
->
query
(
$cmd
);
# If the node has a reloads entry, change the reservation and start it
$cmd
=
"
select node_id,partition,image_id,path from reloads where
"
.
"
node_id='
$n
'
";
$sth
=
$dbh
->
query
(
$cmd
)
||
(
print
"
Failed Command:
\n
$cmd
\n
Error string is:
"
.
$dbh
->
errstr
.
"
\n
"
&&
$error
++
);
if
(
(
$sth
->
num_rows
())
>
0
)
{
my
@reload
;
print
"
Adding reloads for
$n
to the list.
\n
";
...
...
@@ -102,10 +107,13 @@ foreach my $n (@node_names) {
push
(
@list
,
$node
);
$reloads
{"
$image
$part
$path
"}
=
\
@list
;
}
}
}
else
{
# No reloads to be done, so really free the node
# This little sillyness is for disk reloading. Remember the last
# project a node was reserved into.
$cmd
=
"
insert into last_reservation values ('
$n
', '
$pid
')
";
$dbh
->
query
(
$cmd
);
print
"
Releasing node '
$n
'...
";
$cmd
=
"
delete from reserved where node_id='
$n
' and eid='
$eid
'
";
$sth
=
$dbh
->
query
(
$cmd
)
&&
print
"
Succeeded.
\n
"
...
...
tbsetup/os_setup.in
View file @
61c9bb93
...
...
@@ -40,6 +40,15 @@ my %pids = ();
my
$SAVEUID
=
$UID
;
my
@row
;
#
# This stuff is BOGUS! Quick hack for paper deadline to make Jay happy.
#
my
$NETDISK
=
"
/tftpboot/netdisk
";
my
$PAPERADDR
=
"
boss.emulab.net
";
my
$IMAGE
=
"
/usr/testbed/images/wd0-all.ndz
";
my
$RELOADCMD
=
"
${PAPERADDR}
:
${IMAGE}
wd0
";
my
%reload
=
();
# un-taint path
$ENV
{'
PATH
'}
=
'
/bin:/usr/bin:/usr/local/bin
';
delete
@ENV
{'
IFS
',
'
CDPATH
',
'
ENV
',
'
BASH_ENV
'};
...
...
@@ -161,6 +170,19 @@ while (<IN>) {
die
("
Node '
$node
' pid/eid mismatch:
$pid
/
$eid
...
$row
[0]/
$row
[1]
\n
");
}
#
# BOGUS
#
$db_result
=
$DB
->
query
("
select pid from last_reservation
"
.
"
where node_id='
$node
'
");
$reload
{
$node
}
=
0
;
if
(
$db_result
->
numrows
)
{
@row
=
$db_result
->
fetchrow_array
();
if
(
$row
[
0
]
ne
$pid
)
{
$reload
{
$node
}
=
1
;
}
}
#
# First see if the OS spec is a local one from the images table. We
# leave it up to the user to make sure the OS is capable of running
...
...
@@ -248,6 +270,16 @@ foreach my $node ( keys %nodeos ) {
next
;
}
#
# BOGUS!
#
if
(
$reload
{
$pc
})
{
$sth
=
$DB
->
query
("
update nodes set
"
.
"
next_boot_path='
$NETDISK
',
"
.
"
next_boot_cmd_line='
$RELOADCMD
'
"
.
"
where node_id='
$pc
'
");
}
#
# Fire off a reboot process so that we can overlap them all.
# We need the pid so we can wait for them all before preceeding.
...
...
@@ -339,6 +371,11 @@ sub PowerCycle {
sub
WaitTillAlive
{
my
(
$pc
)
=
@_
;
my
$maxwait
=
150
;
if
(
$reload
{
$pc
})
{
$maxwait
+=
150
;
}
print
STDERR
"
Waiting for
$pc
to come alive
\n
"
if
$dbg
;
#
# Sigh, a long ping results in the script waiting until all the
...
...
@@ -363,8 +400,7 @@ sub WaitTillAlive {
(
int
(
$curtime
/
60
)),"
min.
\n
";
}
$lasttime
=
$curtime
;
# If I wait more than 150 seconds (2.5 min) it must be dead...
if
(
$i
>
3
&&
$curtime
>
150
)
{
last
;
}
if
(
$i
>
3
&&
$curtime
>
$maxwait
)
{
last
;
}
}
close
(
PING
);
print
STDERR
"
$pc
is not responding. Better check into it.
\n
"
if
$dbg
;
...
...
tbsetup/sched_reload.in
View file @
61c9bb93
...
...
@@ -194,6 +194,12 @@ foreach my $node (@nodes) {
}
else
{
push
(
@load_list
,
$pc
);
}
#
# Kill the last_reservation so that whoever gets the node next
# won't be fooled into thinking a reload is required.
#
$sth
=
$DB
->
query
("
delete from last_reservation where node_id='
$pc
'
");
}
else
{
print
STDERR
"
Reserved.
\n
";
}
...
...
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