From 637c8ab8fdcadb0d024b9811012e3a210bdcf58e Mon Sep 17 00:00:00 2001 From: Balazs Lecz <leczb@google.com> Date: Mon, 5 Jul 2010 14:48:39 +0000 Subject: [PATCH] LXC: add lxc.console to the generated lxc.conf file Signed-off-by: Balazs Lecz <leczb@google.com> Reviewed-by: Iustin Pop <iustin@google.com> --- lib/constants.py | 1 + lib/hypervisor/hv_lxc.py | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/constants.py b/lib/constants.py index a7570c93f..5ff50fc46 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -97,6 +97,7 @@ DISK_LINKS_DIR = RUN_GANETI_DIR + "/instance-disks" RUN_DIRS_MODE = 0775 SOCKET_DIR = RUN_GANETI_DIR + "/socket" SECURE_DIR_MODE = 0700 +SECURE_FILE_MODE = 0600 SOCKET_DIR_MODE = 0750 CRYPTO_KEYS_DIR = RUN_GANETI_DIR + "/crypto" CRYPTO_KEYS_DIR_MODE = SECURE_DIR_MODE diff --git a/lib/hypervisor/hv_lxc.py b/lib/hypervisor/hv_lxc.py index 81e416ef7..c7c6f24a1 100644 --- a/lib/hypervisor/hv_lxc.py +++ b/lib/hypervisor/hv_lxc.py @@ -164,8 +164,17 @@ class LXCHypervisor(hv_base.BaseHypervisor): # separate pseudo-TTY instances out.append("lxc.pts = 255") - # standard TTYs/console + # standard TTYs out.append("lxc.tty = 6") + # console log file + console_log = utils.PathJoin(self._ROOT_DIR, instance.name + ".console") + try: + utils.WriteFile(console_log, data="", mode=constants.SECURE_FILE_MODE) + except EnvironmentError, err: + raise errors.HypervisorError("Creating console log file %s for" + " instance %s failed: %s" % + (console_log, instance.name, err)) + out.append("lxc.console = %s" % console_log) # root FS out.append("lxc.rootfs = %s" % root_dir) -- GitLab