Revision 874f6148 lib/hypervisor/hv_kvm.py
b/lib/hypervisor/hv_kvm.py | ||
---|---|---|
1696 | 1696 |
# 500ms and likely more: socat can't detect the end of the reply and waits |
1697 | 1697 |
# for 500ms of no data received before exiting (500 ms is the default for |
1698 | 1698 |
# the "-t" parameter). |
1699 |
socat = ("echo %s | %s STDIO UNIX-CONNECT:%s" % |
|
1699 |
socat = ("echo %s | %s %s STDIO UNIX-CONNECT:%s" %
|
|
1700 | 1700 |
(utils.ShellQuote(command), |
1701 |
timeout_cmd, |
|
1701 | 1702 |
constants.SOCAT_PATH, |
1702 | 1703 |
utils.ShellQuote(self._InstanceMonitor(instance_name)))) |
1704 |
|
|
1703 | 1705 |
result = utils.RunCmd(socat) |
1704 | 1706 |
if result.failed: |
1705 | 1707 |
msg = ("Failed to send command '%s' to instance '%s', reason '%s'," |
... | ... | |
1776 | 1778 |
else: |
1777 | 1779 |
return "pc" |
1778 | 1780 |
|
1779 |
def StopInstance(self, instance, force=False, retry=False, name=None): |
|
1781 |
def StopInstance(self, instance, force=False, retry=False, name=None, |
|
1782 |
timeout=None): |
|
1780 | 1783 |
"""Stop an instance. |
1781 | 1784 |
|
1782 | 1785 |
""" |
1786 |
assert(timeout is None or force is not None) |
|
1787 |
|
|
1783 | 1788 |
if name is not None and not force: |
1784 | 1789 |
raise errors.HypervisorError("Cannot shutdown cleanly by name only") |
1785 | 1790 |
if name is None: |
... | ... | |
1792 | 1797 |
if force or not acpi: |
1793 | 1798 |
utils.KillProcess(pid) |
1794 | 1799 |
else: |
1795 |
self._CallMonitorCommand(name, "system_powerdown") |
|
1800 |
self._CallMonitorCommand(name, "system_powerdown", timeout)
|
|
1796 | 1801 |
|
1797 | 1802 |
def CleanupInstance(self, instance_name): |
1798 | 1803 |
"""Cleanup after a stopped instance |
Also available in: Unified diff