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
60a40a3c
Commit
60a40a3c
authored
Oct 25, 2010
by
Leigh B Stoller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wrap in a timeout so that a hung serial controller will not wedge
swap.
parent
22f04bc1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
7 deletions
+29
-7
tbsetup/power_rpc27.pm.in
tbsetup/power_rpc27.pm.in
+29
-7
No files found.
tbsetup/power_rpc27.pm.in
View file @
60a40a3c
...
...
@@ -2,7 +2,7 @@
#
#
EMULAB
-
COPYRIGHT
#
Copyright
(
c
)
2000
-
20
02
,
2005
,
2006
University
of
Utah
and
the
Flux
Group
.
#
Copyright
(
c
)
2000
-
20
10
University
of
Utah
and
the
Flux
Group
.
#
All
rights
reserved
.
#
...
...
@@ -117,6 +117,30 @@ sub rpc27ctrl {
print "outlet_strings: ", join(" ",map("($_)",@outlet_strings)), "\n";
}
#
# Run the rest in a child process, protected by an alarm to ensure that
# we are not hung up forever if the controller is in some funky state.
#
my $syspid = fork();
if ($syspid) {
local $SIG{ALRM} = sub { kill("TERM", $syspid); };
#
# Give it 30 seconds for initial connect plus time per outlet.
# Probably too long.
#
alarm 30 + (15 * scalar(@outlet_strings));
waitpid($syspid, 0);
alarm 0;
my $exitstatus = $?;
if ($exitstatus == 15) {
print STDERR "*** power: $controller is wedged.\n";
}
return($exitstatus);
}
TBdbfork();
#
# Form the connection to the controller via a "tip" line to the
# capture process. Once we have that, we can just talk to the
...
...
@@ -124,7 +148,7 @@ sub rpc27ctrl {
#
if (! ($TIP = tipconnect($controller))) {
print STDERR "*** Could not form TIP connection to $controller\n";
return 1
;
exit(1)
;
}
foreach my $outlet (@outlet_strings) {
...
...
@@ -174,13 +198,11 @@ sub rpc27ctrl {
}
if
($
status
)
{
close
($
TIP
);
return
1
;
exit
(
1
)
;
}
}
close
($
TIP
);
return
0
;
exit
(
0
);
}
#
...
...
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