Commit 7066724d authored by Michele Tartara's avatar Michele Tartara

Allow xen commands to have a timeout

Modify the function that runs Xen commands so that it is possible to specify an
optional timeout after which the command is killed.
Signed-off-by: default avatarMichele Tartara <mtartara@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent 76e2e6f6
......@@ -360,13 +360,21 @@ class XenHypervisor(hv_base.BaseHypervisor):
return cmd
def _RunXen(self, args):
def _RunXen(self, args, timeout=None):
"""Wrapper around L{utils.process.RunCmd} to run Xen command.
If a timeout (in seconds) is specified, the command will be terminated after
that number of seconds.
@see: L{utils.process.RunCmd}
"""
cmd = [self._GetCommand()]
cmd = []
if timeout is not None:
cmd.extend(["timeout", str(timeout)])
cmd.extend([self._GetCommand()])
cmd.extend(args)
return self._run_cmd_fn(cmd)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment