Revision 86d6bc2a lib/hypervisor/hv_kvm.py

b/lib/hypervisor/hv_kvm.py
115 115
    """
116 116
    return '%s/%s.serial' % (cls._CTRL_DIR, instance_name)
117 117

  
118
  @staticmethod
119
  def _SocatUnixConsoleParams():
120
    """Returns the correct parameters for socat
121

  
122
    If we have a new-enough socat we can use raw mode with an escape character.
123

  
124
    """
125
    if constants.SOCAT_ESCAPE:
126
      return "raw,echo=0,escape=%s" % constants.SOCAT_ESCAPE_CODE
127
    else:
128
      return "echo=0,icanon=0"
129

  
118 130
  @classmethod
119 131
  def _InstanceKVMRuntime(cls, instance_name):
120 132
    """Returns the instance KVM runtime filename
......
684 696

  
685 697
    """
686 698
    if hvparams[constants.HV_SERIAL_CONSOLE]:
687
      # FIXME: The socat shell is not perfect. In particular the way we start
688
      # it ctrl+c will close it, rather than being passed to the other end.
689
      # On the other hand if we pass the option 'raw' (or ignbrk=1) there
690
      # will be no way of exiting socat (except killing it from another shell)
691
      # and ctrl+c doesn't work anyway, printing ^C rather than being
692
      # interpreted by kvm. For now we'll leave it this way, which at least
693
      # allows a minimal interaction and changes on the machine.
694
      shell_command = ("%s STDIO,echo=0,icanon=0 UNIX-CONNECT:%s" %
695
                       (constants.SOCAT_PATH,
699
      shell_command = ("%s STDIO,%s UNIX-CONNECT:%s" %
700
                       (constants.SOCAT_PATH, cls._SocatUnixConsoleParams(),
696 701
                        utils.ShellQuote(cls._InstanceSerial(instance.name))))
697 702
    else:
698 703
      shell_command = "echo 'No serial shell for instance %s'" % instance.name

Also available in: Unified diff