Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
9ff27b0c
Commit
9ff27b0c
authored
Oct 14, 2013
by
Leigh B Stoller
Browse files
Attempt to deal with hotplug errors.
parent
9a9e2c81
Changes
2
Hide whitespace changes
Inline
Side-by-side
clientside/tmcc/common/libutil.pm
View file @
9ff27b0c
...
...
@@ -27,7 +27,7 @@
package
libutil
;
use
Exporter
;
@ISA
=
"
Exporter
";
@EXPORT
=
qw( ipToMac macAddSep fatal mysystem mysystem2
@EXPORT
=
qw( ipToMac macAddSep fatal mysystem mysystem2
ExecQuiet
findDNS setState isRoutable findDomain convertToMebi
ipToNetwork CIDRmask untaintNumber untaintHostname
GenFakeMac
...
...
@@ -279,6 +279,42 @@ sub mysystem2($)
}
}
sub
ExecQuiet
($)
{
my
(
$command
)
=
@_
;
print
STDERR
"
ExecQuiet: '
$command
'
\n
";
my
$output
=
"";
#
# This open implicitly forks a child, which goes on to execute the
# command. The parent is going to sit in this loop and capture the
# output of the child. We do this so that we have better control
# over the descriptors.
#
my
$pid
=
open
(
PIPE
,
"
-|
");
if
(
!
defined
(
$pid
))
{
print
STDERR
"
ExecQuiet Failure; popen failed!
\n
";
return
undef
;
}
if
(
$pid
)
{
while
(
<
PIPE
>
)
{
$output
.=
$_
;
}
close
(
PIPE
);
}
else
{
open
(
STDERR
,
"
>&STDOUT
");
exec
(
$command
);
}
print
STDERR
$output
;
if
(
$?
)
{
print
STDERR
"
Command failed: $?
\n
";
}
return
$output
;
}
#
# Generate a hopefully unique mac address that is suitable for use
# on a shared node where uniqueness matters.
...
...
clientside/tmcc/linux/xen/libvnode_xen.pm
View file @
9ff27b0c
...
...
@@ -1549,7 +1549,23 @@ sub vnodeBoot($$$$)
libutil::
setState
("
BOOTING
");
# and finally, create the VM
mysystem
("
xm create
$config
");
my
$output
=
ExecQuiet
("
xm create
$config
");
return
-
1
if
(
!
defined
(
$output
));
# We have a problem with intermittent failures. We retry if we
# get a hotplug error after a small wait.
if
(
$?
&&
$output
=~
/hotplug/i
)
{
print
"
Hotplug Error: Retrying after a short wait.
\n
";
sleep
(
10
);
my
$output
=
ExecQuiet
("
xm create
$config
");
return
-
1
if
(
!
defined
(
$output
));
}
return
-
1
if
(
$?
);
print
"
Created virtual machine
$vnode_id
\n
";
return
0
;
}
...
...
Write
Preview
Supports
Markdown
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