Revision 1b48f7af
b/lib/constants.py | ||
---|---|---|
165 | 165 |
|
166 | 166 |
KVM_PATH = _autoconf.KVM_PATH |
167 | 167 |
SOCAT_PATH = _autoconf.SOCAT_PATH |
168 |
SOCAT_ESCAPE = _autoconf.SOCAT_ESCAPE |
|
169 |
SOCAT_ESCAPE_CODE = "0x1d" |
|
170 | 168 |
KVM_MIGRATION_PORT = _autoconf.KVM_MIGRATION_PORT |
171 | 169 |
|
172 | 170 |
VALUE_DEFAULT = "default" |
b/lib/hypervisor/hv_kvm.py | ||
---|---|---|
114 | 114 |
""" |
115 | 115 |
return '%s/%s.serial' % (cls._CTRL_DIR, instance_name) |
116 | 116 |
|
117 |
@staticmethod |
|
118 |
def _SocatUnixConsoleParams(): |
|
119 |
"""Returns the correct parameters for socat |
|
120 |
|
|
121 |
If we have a new-enough socat we can use raw mode with an escape character. |
|
122 |
|
|
123 |
""" |
|
124 |
if constants.SOCAT_ESCAPE: |
|
125 |
return "raw,echo=0,escape=%s" % constants.SOCAT_ESCAPE_CODE |
|
126 |
else: |
|
127 |
return "echo=0,icanon=0" |
|
128 |
|
|
129 | 117 |
@classmethod |
130 | 118 |
def _InstanceKVMRuntime(cls, instance_name): |
131 | 119 |
"""Returns the instance KVM runtime filename |
... | ... | |
690 | 678 |
|
691 | 679 |
""" |
692 | 680 |
if hvparams[constants.HV_SERIAL_CONSOLE]: |
693 |
shell_command = ("%s STDIO,%s UNIX-CONNECT:%s" % |
|
694 |
(constants.SOCAT_PATH, cls._SocatUnixConsoleParams(), |
|
681 |
# FIXME: The socat shell is not perfect. In particular the way we start |
|
682 |
# it ctrl+c will close it, rather than being passed to the other end. |
|
683 |
# On the other hand if we pass the option 'raw' (or ignbrk=1) there |
|
684 |
# will be no way of exiting socat (except killing it from another shell) |
|
685 |
# and ctrl+c doesn't work anyway, printing ^C rather than being |
|
686 |
# interpreted by kvm. For now we'll leave it this way, which at least |
|
687 |
# allows a minimal interaction and changes on the machine. |
|
688 |
shell_command = ("%s STDIO,echo=0,icanon=0 UNIX-CONNECT:%s" % |
|
689 |
(constants.SOCAT_PATH, |
|
695 | 690 |
utils.ShellQuote(cls._InstanceSerial(instance.name)))) |
696 | 691 |
else: |
697 | 692 |
shell_command = "echo 'No serial shell for instance %s'" % instance.name |
Also available in: Unified diff