[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Fix server reloading when the HTTP server is enabled.



# HG changeset patch
# User Ewan Mellor <ewan@xxxxxxxxxxxxx>
# Node ID c4824dcd57c4dc9f8e9f25248b9d6d7ac7b59cfa
# Parent  258722281202ae3aec98e970caf331888d03496b
Fix server reloading when the HTTP server is enabled.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>
---
 tools/python/xen/xend/server/SrvServer.py |   24 +++++++++++++++---------
 1 files changed, 15 insertions(+), 9 deletions(-)

diff -r 258722281202 -r c4824dcd57c4 tools/python/xen/xend/server/SrvServer.py
--- a/tools/python/xen/xend/server/SrvServer.py Wed Dec 06 10:13:46 2006 +0000
+++ b/tools/python/xen/xend/server/SrvServer.py Wed Dec 06 10:37:10 2006 +0000
@@ -62,8 +62,9 @@ xroot = XendRoot.instance()
 
 class XendServers:
 
-    def __init__(self):
+    def __init__(self, root):
         self.servers = []
+        self.root = root
         self.cleaningUp = False
         self.reloadingConfig = False
 
@@ -101,6 +102,9 @@ class XendServers:
         while True:
             threads = []
             for server in self.servers:
+                if server.ready:
+                    continue
+
                 thread = Thread(target=server.run, 
name=server.__class__.__name__)
                 if isinstance(server, HttpServer):
                     thread.setDaemon(True)
@@ -156,21 +160,23 @@ class XendServers:
                     pass
 
             if self.reloadingConfig:
-                log.info("Restarting all servers...")
+                log.info("Restarting all XML-RPC and Xen-API servers...")
                 self.cleaningUp = False
                 self.reloadingConfig = False
                 xroot.set_config()
-                self.servers = []
-                _loadConfig(self)
+                new_servers = [x for x in self.servers
+                               if isinstance(x, HttpServer)]
+                self.servers = new_servers
+                _loadConfig(self, self.root, True)
             else:
                 break
 
-def _loadConfig(servers, root):
-    if xroot.get_xend_http_server():
+def _loadConfig(servers, root, reload):
+    if not reload and xroot.get_xend_http_server():
         servers.add(HttpServer(root,
                                xroot.get_xend_address(),
                                xroot.get_xend_port()))
-    if xroot.get_xend_unix_server():
+    if not reload and xroot.get_xend_unix_server():
         path = xroot.get_xend_unix_path()
         log.info('unix path=' + path)
         servers.add(UnixHttpServer(root, path))
@@ -218,6 +224,6 @@ def create():
 def create():
     root = SrvDir()
     root.putChild('xend', SrvRoot())
-    servers = XendServers()
-    _loadConfig(servers, root)
+    servers = XendServers(root)
+    _loadConfig(servers, root, False)
     return servers

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.