From: Stefan Berger Subject: [PATCH] [Xend] host.get_log() : clean log of non-printable characters Date: Wed, 14 Nov 2007 22:25:58 -0500 Message-ID: <1195097158.18754.3.camel@941e-2.watson.ibm.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-2H+3wG+CXMq+io3cXtjx" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel List-Id: xen-devel@lists.xenproject.org --=-2H+3wG+CXMq+io3cXtjx Content-Type: text/plain Content-Transfer-Encoding: 7bit When retrieving the log via host.get_log() the python parser on the receiving side gets upset about non-printable characters ("\b"). Those stem from libxc/xc_domain_restore:xc_domain_restore(). Signed-off-by: Stefan Berger --=-2H+3wG+CXMq+io3cXtjx Content-Disposition: attachment; filename=xenapi_log_clean.diff Content-Type: text/x-vhdl; name=xenapi_log_clean.diff; charset=UTF-8 Content-Transfer-Encoding: 7bit --- xen-unstable.hg/tools/python/xen/xend/XendAPI.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) Index: root/xen-unstable.hg/tools/python/xen/xend/XendAPI.py =================================================================== --- root.orig/xen-unstable.hg/tools/python/xen/xend/XendAPI.py +++ root/xen-unstable.hg/tools/python/xen/xend/XendAPI.py @@ -995,7 +995,16 @@ class XendAPI(object): log_file = open(XendLogging.getLogFilename()) log_buffer = log_file.read() log_file.close() - return xen_api_success(log_buffer) + i = 0 + res = "" + while i < len(log_buffer): + c = ord(log_buffer[i]) + if (c < 32 or c > 126) and (c < 10 or c > 13): + res += " " + else: + res += log_buffer[i] + i += 1 + return xen_api_success(res) def host_send_debug_keys(self, _, host_ref, keys): node = XendNode.instance() --=-2H+3wG+CXMq+io3cXtjx Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=-2H+3wG+CXMq+io3cXtjx--