Commit 7238edb5 authored by Iustin Pop's avatar Iustin Pop

Reverts the patch series about console wrappers

This reverts commits 030a9cb8 and
ae082df0.

There are two problems:

- Makefile.am breakage, which is trivial to revert
- unittest breakage, which honestly I'm not sure how to fix and how
  serial consoles interact with the unpause helper

After the reset, the startup --paused still works but won't unpause
the instance automatically (if I understood the code correctly).

Furthermore, the code also fixes a style issue in hv_kvm.py (too long
line) introduced by the next commit after the above two.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 323f9095
......@@ -495,8 +495,6 @@ nodist_pkglib_python_scripts = \
pkglib_SCRIPTS = \
daemons/daemon-util \
tools/kvm-ifup \
tools/xm-console-wrapper \
tools/kvm-console-wrapper \
$(pkglib_python_scripts)
nodist_pkglib_SCRIPTS = \
......
......@@ -144,8 +144,6 @@ QUEUE_DIR = DATA_DIR + "/queue"
DAEMON_UTIL = _autoconf.PKGLIBDIR + "/daemon-util"
SETUP_SSH = _autoconf.TOOLSDIR + "/setup-ssh"
KVM_IFUP = _autoconf.PKGLIBDIR + "/kvm-ifup"
KVM_CONSOLE_WRAPPER = _autoconf.PKGLIBDIR + "/kvm-console-wrapper"
XM_CONSOLE_WRAPPER = _autoconf.PKGLIBDIR + "/xm-console-wrapper"
ETC_HOSTS = "/etc/hosts"
DEFAULT_FILE_STORAGE_DIR = _autoconf.FILE_STORAGE_DIR
DEFAULT_SHARED_FILE_STORAGE_DIR = _autoconf.SHARED_FILE_STORAGE_DIR
......
......@@ -908,7 +908,8 @@ class KVMHypervisor(hv_base.BaseHypervisor):
"""
self._CheckDown(instance.name)
kvm_runtime = self._GenerateKVMRuntime(instance, block_devices, startup_paused)
kvm_runtime = self._GenerateKVMRuntime(instance, block_devices,
startup_paused)
self._SaveKVMRuntime(instance, kvm_runtime)
self._ExecuteKVMRuntime(instance, kvm_runtime)
......@@ -1140,9 +1141,7 @@ class KVMHypervisor(hv_base.BaseHypervisor):
"""
if hvparams[constants.HV_SERIAL_CONSOLE]:
cmd = [constants.KVM_CONSOLE_WRAPPER,
utils.ShellQuote(instance.name), constants.SOCAT_PATH,
utils.ShellQuote(cls._InstanceMonitor(instance.name)),
cmd = [constants.SOCAT_PATH,
"STDIO,%s" % cls._SocatUnixConsoleParams(),
"UNIX-CONNECT:%s" % cls._InstanceSerial(instance.name)]
return objects.InstanceConsole(instance=instance.name,
......
......@@ -307,8 +307,7 @@ class XenHypervisor(hv_base.BaseHypervisor):
kind=constants.CONS_SSH,
host=instance.primary_node,
user=constants.GANETI_RUNAS,
command=[constants.XM_CONSOLE_WRAPPER,
instance.name])
command=["xm", "console", instance.name])
def Verify(self):
"""Verify the hypervisor.
......
#!/bin/bash
# Copyright (C) 2011 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
INSTANCE="$1"
SOCAT="$2"
MONITOR="$3"
PARAMS="$4"
CONSOLE="$5"
unpause() {
echo "info status" |
"$SOCAT" STDIO "UNIX-CONNECT:$MONITOR" 2>/dev/null |
grep -q '^VM status: paused' || return
# As there is no way to be sure when the main socat has actually connected to
# the instance console, sleep for a few seconds before unpausing the
# instance. This is a tradeoff between missing some console output if the
# node is overloaded and making the user wait everytime when the node isn't
# so busy.
sleep 3
# Send \r\n after notice as terminal is in raw mode
printf "Instance $INSTANCE is paused, unpausing\r\n"
echo "c" | "$SOCAT" STDIO "UNIX-CONNECT:$MONITOR" &>/dev/null
}
unpause &
"$SOCAT" "$PARAMS" "$CONSOLE"
#!/bin/bash
# Copyright (C) 2011 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
INSTANCE="$1"
unpause() {
ispaused=$(xm list -l "$INSTANCE" 2>/dev/null |
sed -n 's/^[[:blank:]]*(state ..\(.\)...)/\1/p')
[[ "$ispaused" == "p" ]] || return
# As there is no way to be sure when xm console has actually connected to the
# instance, sleep for a few seconds before unpausing the instance. This is a
# tradeoff between missing some console output if the node is overloaded and
# making the user wait everytime when the node isn't so busy.
sleep 3
# Send \r\n after notice as terminal is in raw mode
printf "Instance $INSTANCE is paused, unpausing\r\n"
xm unpause "$INSTANCE"
}
unpause &
exec xm console "$INSTANCE"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment