From 8b968321f0c6cdf36a3d34f2acc5300c3f62f175 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20R=C4=99korajski?= Date: Wed, 29 Feb 2012 21:03:12 +0000 Subject: [PATCH] - catch connection and log file errors Changed files: xend.catchbt.patch -> 1.1 --- xend.catchbt.patch | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 xend.catchbt.patch diff --git a/xend.catchbt.patch b/xend.catchbt.patch new file mode 100644 index 0000000..95eac54 --- /dev/null +++ b/xend.catchbt.patch @@ -0,0 +1,30 @@ +--- xen-4.1.2/tools/python/xen/xend/image.py.orig 2011-10-20 18:05:44.000000000 +0100 ++++ xen-4.1.2/tools/python/xen/xend/image.py 2011-11-20 20:41:10.730905790 +0000 +@@ -43,7 +43,11 @@ + from xen.util import utils + from xen.xend import osdep + +-xc = xen.lowlevel.xc.xc() ++try: ++ xc = xen.lowlevel.xc.xc() ++except Exception: ++ print >>sys.stderr, ('xend/image.py: Error connecting to hypervisor') ++ os._exit(1) + + MAX_GUEST_CMDLINE = 1024 + +--- xen-4.1.2/tools/python/xen/xend/XendLogging.py.orig 2011-10-20 18:05:44.000000000 +0100 ++++ xen-4.1.2/tools/python/xen/xend/XendLogging.py 2012-01-10 21:27:57.304916048 +0000 +@@ -132,7 +132,11 @@ + fileHandler = openFileHandler(filename) + logfilename = filename + except IOError: +- logfilename = tempfile.mkstemp("-xend.log")[1] ++ try: ++ logfilename = tempfile.mkstemp("-xend.log")[1] ++ except IOError: ++ print >>sys.stderr, ('xend/XendLogging.py: Unable to open standard or temporary log file for xend') ++ os._exit(1) + fileHandler = openFileHandler(logfilename) + + fileHandler.setFormatter(logging.Formatter(LOGFILE_FORMAT, DATE_FORMAT)) -- 2.44.0