xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][RESENT] xend: fix bug in xend option parsing
@ 2010-05-16 21:34 Arnd Hannemann
  2010-05-17  9:59 ` Keir Fraser
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Hannemann @ 2010-05-16 21:34 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 2529 bytes --]

Resent of mail sent on 28.04.


xend: fix bug in option parsing

If you enable legacy tcp xmlrpc in xend's config but omit to enable ssl
the following backtrace is generated when starting xend:

[2010-04-28 16:09:04 15754] ERROR (SrvDaemon:349) Exception starting xend ('NoneType' object has no attribute 'rfind')
Traceback (most recent call last):
  File "usr/lib/python2.5/site-packages/xen/xend/server/SrvDaemon.py", line 341, in run
    servers = SrvServer.create()
  File "usr/lib/python2.5/site-packages/xen/xend/server/SrvServer.py", line 253, in create
    _loadConfig(servers, root, False)
  File "usr/lib/python2.5/site-packages/xen/xend/server/SrvServer.py", line 233, in _loadConfig
    ssl_key_file = xoptions.get_xend_tcp_xmlrpc_server_ssl_key_file()
  File "usr/lib/python2.5/site-packages/xen/xend/XendOptions.py", line 210, in get_xend_tcp_xmlrpc_server_ssl_key_file
    if os.path.dirname(file) == "":
  File "/usr/lib/python2.5/posixpath.py", line 119, in dirname
    return split(p)[0]
  File "/usr/lib/python2.5/posixpath.py", line 77, in split
    i = p.rfind('/') + 1

This patch fixes above bug.
Patch should be considered for 4.0.x as the bug is present in release 4.0.0.

Signed-off-by: Arnd Hannemann <hannemann@nets.rwth-aachen.de>

diff -r 9a1d7caa2024 -r 0d3979903bac tools/python/xen/xend/XendOptions.py
--- a/tools/python/xen/xend/XendOptions.py	Mon Apr 26 12:13:23 2010 +0100
+++ b/tools/python/xen/xend/XendOptions.py	Wed Apr 28 16:54:04 2010 +0200
@@ -207,18 +207,18 @@
     def get_xend_tcp_xmlrpc_server_ssl_key_file(self):
         name = 'xend-tcp-xmlrpc-server-ssl-key-file'
         file = self.get_config_string(name)
-        if os.path.dirname(file) == "":
+        if file and os.path.dirname(file) == "":
             file = auxbin.xen_configdir() + '/' + file;
-        if not os.path.exists(file):
+        if file and not os.path.exists(file):
             raise XendError("invalid xend config %s: directory '%s' does not exist" % (name, file))
         return file

     def get_xend_tcp_xmlrpc_server_ssl_cert_file(self):
         name = 'xend-tcp-xmlrpc-server-ssl-cert-file'
         file = self.get_config_string(name)
-        if os.path.dirname(file) == "":
+        if file and os.path.dirname(file) == "":
             file = auxbin.xen_configdir() + '/' + file;
-        if not os.path.exists(file):
+        if file and not os.path.exists(file):
             raise XendError("invalid xend config %s: directory '%s' does not exist" % (name, file))
         return file


[-- Attachment #2: fix_xend_xmlrpc_tcp_without_ssl.patch --]
[-- Type: text/x-patch, Size: 2719 bytes --]

Exportiere Patch:
# HG changeset patch
# User Arnd Hannemann <hannemann@nets.rwth-aachen.de>
# Date 1272466444 -7200
# Node ID 0d3979903bac114437297618b4d012f90e75ef72
# Parent  9a1d7caa20246f89bf7395131483f44e686bd9cd
xend: fix bug in option parsing

If you enable legacy tcp xmlrpc in xend's config but omit to enable ssl
the following backtrace is generated when starting xend:

[2010-04-28 16:09:04 15754] ERROR (SrvDaemon:349) Exception starting xend ('NoneType' object has no attribute 'rfind')
Traceback (most recent call last):
  File "usr/lib/python2.5/site-packages/xen/xend/server/SrvDaemon.py", line 341, in run
    servers = SrvServer.create()
  File "usr/lib/python2.5/site-packages/xen/xend/server/SrvServer.py", line 253, in create
    _loadConfig(servers, root, False)
  File "usr/lib/python2.5/site-packages/xen/xend/server/SrvServer.py", line 233, in _loadConfig
    ssl_key_file = xoptions.get_xend_tcp_xmlrpc_server_ssl_key_file()
  File "usr/lib/python2.5/site-packages/xen/xend/XendOptions.py", line 210, in get_xend_tcp_xmlrpc_server_ssl_key_file
    if os.path.dirname(file) == "":
  File "/usr/lib/python2.5/posixpath.py", line 119, in dirname
    return split(p)[0]
  File "/usr/lib/python2.5/posixpath.py", line 77, in split
    i = p.rfind('/') + 1

This patch fixes above bug.
Patch should be considered for 4.0.x as the bug is present in release 4.0.0.

Signed-off-by: Arnd Hannemann <hannemann@nets.rwth-aachen.de>

diff -r 9a1d7caa2024 -r 0d3979903bac tools/python/xen/xend/XendOptions.py
--- a/tools/python/xen/xend/XendOptions.py	Mon Apr 26 12:13:23 2010 +0100
+++ b/tools/python/xen/xend/XendOptions.py	Wed Apr 28 16:54:04 2010 +0200
@@ -207,18 +207,18 @@
     def get_xend_tcp_xmlrpc_server_ssl_key_file(self):
         name = 'xend-tcp-xmlrpc-server-ssl-key-file'
         file = self.get_config_string(name)
-        if os.path.dirname(file) == "":
+        if file and os.path.dirname(file) == "":
             file = auxbin.xen_configdir() + '/' + file;
-        if not os.path.exists(file):
+        if file and not os.path.exists(file):
             raise XendError("invalid xend config %s: directory '%s' does not exist" % (name, file))
         return file
 
     def get_xend_tcp_xmlrpc_server_ssl_cert_file(self):
         name = 'xend-tcp-xmlrpc-server-ssl-cert-file'
         file = self.get_config_string(name)
-        if os.path.dirname(file) == "":
+        if file and os.path.dirname(file) == "":
             file = auxbin.xen_configdir() + '/' + file;
-        if not os.path.exists(file):
+        if file and not os.path.exists(file):
             raise XendError("invalid xend config %s: directory '%s' does not exist" % (name, file))
         return file
 


[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-05-17 10:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-16 21:34 [PATCH][RESENT] xend: fix bug in xend option parsing Arnd Hannemann
2010-05-17  9:59 ` Keir Fraser
2010-05-17 10:57   ` Arnd Hannemann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).