Revision ae082df0
b/Makefile.am | ||
---|---|---|
496 | 496 |
daemons/daemon-util \ |
497 | 497 |
tools/kvm-ifup \ |
498 | 498 |
tools/xm-console-wrapper \ |
499 |
tools/kvm-console-wrapper \ |
|
499 | 500 |
$(pkglib_python_scripts) |
500 | 501 |
|
501 | 502 |
nodist_pkglib_SCRIPTS = \ |
b/lib/constants.py | ||
---|---|---|
144 | 144 |
DAEMON_UTIL = _autoconf.PKGLIBDIR + "/daemon-util" |
145 | 145 |
SETUP_SSH = _autoconf.TOOLSDIR + "/setup-ssh" |
146 | 146 |
KVM_IFUP = _autoconf.PKGLIBDIR + "/kvm-ifup" |
147 |
KVM_CONSOLE_WRAPPER = _autoconf.PKGLIBDIR + "/kvm-console-wrapper" |
|
147 | 148 |
XM_CONSOLE_WRAPPER = _autoconf.PKGLIBDIR + "/xm-console-wrapper" |
148 | 149 |
ETC_HOSTS = "/etc/hosts" |
149 | 150 |
DEFAULT_FILE_STORAGE_DIR = _autoconf.FILE_STORAGE_DIR |
b/lib/hypervisor/hv_kvm.py | ||
---|---|---|
1138 | 1138 |
|
1139 | 1139 |
""" |
1140 | 1140 |
if hvparams[constants.HV_SERIAL_CONSOLE]: |
1141 |
cmd = [constants.SOCAT_PATH, |
|
1141 |
cmd = [constants.KVM_CONSOLE_WRAPPER, |
|
1142 |
utils.ShellQuote(instance.name), constants.SOCAT_PATH, |
|
1143 |
utils.ShellQuote(cls._InstanceMonitor(instance.name)), |
|
1142 | 1144 |
"STDIO,%s" % cls._SocatUnixConsoleParams(), |
1143 | 1145 |
"UNIX-CONNECT:%s" % cls._InstanceSerial(instance.name)] |
1144 | 1146 |
return objects.InstanceConsole(instance=instance.name, |
b/tools/kvm-console-wrapper | ||
---|---|---|
1 |
#!/bin/bash |
|
2 |
|
|
3 |
# Copyright (C) 2011 Google Inc. |
|
4 |
# |
|
5 |
# This program is free software; you can redistribute it and/or modify |
|
6 |
# it under the terms of the GNU General Public License as published by |
|
7 |
# the Free Software Foundation; either version 2 of the License, or |
|
8 |
# (at your option) any later version. |
|
9 |
# |
|
10 |
# This program is distributed in the hope that it will be useful, but |
|
11 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 |
# General Public License for more details. |
|
14 |
# |
|
15 |
# You should have received a copy of the GNU General Public License |
|
16 |
# along with this program; if not, write to the Free Software |
|
17 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
18 |
# 02110-1301, USA. |
|
19 |
|
|
20 |
INSTANCE="$1" |
|
21 |
SOCAT="$2" |
|
22 |
MONITOR="$3" |
|
23 |
PARAMS="$4" |
|
24 |
CONSOLE="$5" |
|
25 |
|
|
26 |
unpause() { |
|
27 |
echo "info status" | |
|
28 |
"$SOCAT" STDIO "UNIX-CONNECT:$MONITOR" 2>/dev/null | |
|
29 |
grep -q '^VM status: paused' || return |
|
30 |
# As there is no way to be sure when the main socat has actually connected to |
|
31 |
# the instance console, sleep for a few seconds before unpausing the |
|
32 |
# instance. This is a tradeoff between missing some console output if the |
|
33 |
# node is overloaded and making the user wait everytime when the node isn't |
|
34 |
# so busy. |
|
35 |
sleep 3 |
|
36 |
# Send \r\n after notice as terminal is in raw mode |
|
37 |
printf "Instance $INSTANCE is paused, unpausing\r\n" |
|
38 |
echo "c" | "$SOCAT" STDIO "UNIX-CONNECT:$MONITOR" &>/dev/null |
|
39 |
} |
|
40 |
|
|
41 |
unpause & |
|
42 |
"$SOCAT" "$PARAMS" "$CONSOLE" |
Also available in: Unified diff