Revision 7238edb5

b/Makefile.am
495 495
pkglib_SCRIPTS = \
496 496
	daemons/daemon-util \
497 497
	tools/kvm-ifup \
498
	tools/xm-console-wrapper \
499
	tools/kvm-console-wrapper \
500 498
	$(pkglib_python_scripts)
501 499

  
502 500
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"
148
XM_CONSOLE_WRAPPER = _autoconf.PKGLIBDIR + "/xm-console-wrapper"
149 147
ETC_HOSTS = "/etc/hosts"
150 148
DEFAULT_FILE_STORAGE_DIR = _autoconf.FILE_STORAGE_DIR
151 149
DEFAULT_SHARED_FILE_STORAGE_DIR = _autoconf.SHARED_FILE_STORAGE_DIR
b/lib/hypervisor/hv_kvm.py
908 908

  
909 909
    """
910 910
    self._CheckDown(instance.name)
911
    kvm_runtime = self._GenerateKVMRuntime(instance, block_devices, startup_paused)
911
    kvm_runtime = self._GenerateKVMRuntime(instance, block_devices,
912
                                           startup_paused)
912 913
    self._SaveKVMRuntime(instance, kvm_runtime)
913 914
    self._ExecuteKVMRuntime(instance, kvm_runtime)
914 915

  
......
1140 1141

  
1141 1142
    """
1142 1143
    if hvparams[constants.HV_SERIAL_CONSOLE]:
1143
      cmd = [constants.KVM_CONSOLE_WRAPPER,
1144
             utils.ShellQuote(instance.name), constants.SOCAT_PATH,
1145
             utils.ShellQuote(cls._InstanceMonitor(instance.name)),
1144
      cmd = [constants.SOCAT_PATH,
1146 1145
             "STDIO,%s" % cls._SocatUnixConsoleParams(),
1147 1146
             "UNIX-CONNECT:%s" % cls._InstanceSerial(instance.name)]
1148 1147
      return objects.InstanceConsole(instance=instance.name,
b/lib/hypervisor/hv_xen.py
307 307
                                   kind=constants.CONS_SSH,
308 308
                                   host=instance.primary_node,
309 309
                                   user=constants.GANETI_RUNAS,
310
                                   command=[constants.XM_CONSOLE_WRAPPER,
311
                                            instance.name])
310
                                   command=["xm", "console", instance.name])
312 311

  
313 312
  def Verify(self):
314 313
    """Verify the hypervisor.
/dev/null
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"
/dev/null
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

  
22
unpause() {
23
  ispaused=$(xm list -l "$INSTANCE" 2>/dev/null |
24
             sed -n 's/^[[:blank:]]*(state ..\(.\)...)/\1/p')
25
  [[ "$ispaused" == "p" ]] || return
26
  # As there is no way to be sure when xm console has actually connected to the
27
  # instance, sleep for a few seconds before unpausing the instance. This is a
28
  # tradeoff between missing some console output if the node is overloaded and
29
  # making the user wait everytime when the node isn't so busy.
30
  sleep 3
31
  # Send \r\n after notice as terminal is in raw mode
32
  printf "Instance $INSTANCE is paused, unpausing\r\n"
33
  xm unpause "$INSTANCE"
34
}
35

  
36
unpause &
37
exec xm console "$INSTANCE"

Also available in: Unified diff