From f01738fc51fdbad15e23461ceb68d7eafaa3fdf0 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Thu, 12 May 2011 13:17:47 +0200 Subject: [PATCH] Preload the string-escape code in noded MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This encoding, part of the standard Python installation, is used by the pickle module (in turn used by subprocess when handling failures in program execution). Preloading it means that Python will cache it in memory so that even if the disk goes away or just the module, we're not going to fail in reporting errors. Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: RenΓ© Nussbaumer <rn@google.com> --- NEWS | 3 +++ lib/server/noded.py | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/NEWS b/NEWS index 73928ad5a..09b18a1f5 100644 --- a/NEWS +++ b/NEWS @@ -69,6 +69,9 @@ Many bug-fixes and a few new small features: - Changed the instance memory modifications to only check out-of-memory conditions on memory increases, and turned the secondary node warnings into errors (they can still be overridden via ``--force``) +- Fixed the handling of a corner case when the Python installation gets + corrupted (e.g. a bad disk) while ganeti-noded is running and we try + to execute a command that doesn't exist And as usual, various improvements to the error messages, documentation and man pages. diff --git a/lib/server/noded.py b/lib/server/noded.py index decc87449..c6bba7262 100644 --- a/lib/server/noded.py +++ b/lib/server/noded.py @@ -33,6 +33,7 @@ import os import sys import logging import signal +import codecs from optparse import OptionParser @@ -964,6 +965,13 @@ def CheckNoded(_, args): print >> sys.stderr, ("Usage: %s [-f] [-d] [-p port] [-b ADDRESS]" % sys.argv[0]) sys.exit(constants.EXIT_FAILURE) + try: + codecs.lookup("string-escape") + except LookupError: + print >> sys.stderr, ("Can't load the string-escape code which is part" + " of the Python installation. Is your installation" + " complete/correct? Aborting.") + sys.exit(constants.EXIT_FAILURE) def PrepNoded(options, _): -- GitLab