Commit 2a2d087a authored by Michele Tartara's avatar Michele Tartara

Allow KVM commands to have a timeout

Modify the function that sends commands to the KVM monitor 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 7066724d
......@@ -1680,10 +1680,15 @@ class KVMHypervisor(hv_base.BaseHypervisor):
self._SaveKVMRuntime(instance, kvm_runtime)
self._ExecuteKVMRuntime(instance, kvm_runtime, kvmhelp)
def _CallMonitorCommand(self, instance_name, command):
def _CallMonitorCommand(self, instance_name, command, timeout=None):
"""Invoke a command on the instance monitor.
"""
if timeout is not None:
timeout_cmd = "timeout %s" % (timeout, )
else:
timeout_cmd = ""
# TODO: Replace monitor calls with QMP once KVM >= 0.14 is the minimum
# version. The monitor protocol is designed for human consumption, whereas
# QMP is made for programmatic usage. In the worst case QMP can also
......
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