From 23e4649459cec8fee042080b272cc7d7fff10aed Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Fri, 24 Oct 2008 11:31:29 +0000
Subject: [PATCH] Document HttpServer.__init__

At the same time, simplify the interface a bit by not using a tuple.

Reviewed-by: killerfoxi, ultrotter
---
 daemons/ganeti-noded |  2 +-
 daemons/ganeti-rapi  |  2 +-
 lib/http.py          | 17 ++++++++++++++---
 3 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/daemons/ganeti-noded b/daemons/ganeti-noded
index c1e8776f7..958a031d1 100755
--- a/daemons/ganeti-noded
+++ b/daemons/ganeti-noded
@@ -697,7 +697,7 @@ def main():
     queue_lock = jstore.InitAndVerifyQueue(must_lock=False)
 
     mainloop = daemon.Mainloop()
-    server = NodeHttpServer(mainloop, ("", port))
+    server = NodeHttpServer(mainloop, "", port)
     server.Start()
     try:
       mainloop.Run()
diff --git a/daemons/ganeti-rapi b/daemons/ganeti-rapi
index c22b6673a..c4ed195d3 100755
--- a/daemons/ganeti-rapi
+++ b/daemons/ganeti-rapi
@@ -132,7 +132,7 @@ def main():
   utils.WritePidFile(constants.RAPI_PID)
   try:
     mainloop = daemon.Mainloop()
-    server = RemoteApiHttpServer(mainloop, ("", options.port))
+    server = RemoteApiHttpServer(mainloop, "", options.port)
     server.Start()
     try:
       mainloop.Run()
diff --git a/lib/http.py b/lib/http.py
index db897fa14..a6585507a 100644
--- a/lib/http.py
+++ b/lib/http.py
@@ -456,9 +456,20 @@ class HttpServer(object):
   """
   MAX_CHILDREN = 20
 
-  def __init__(self, mainloop, server_address):
+  def __init__(self, mainloop, local_address, port):
+    """Initializes the HTTP server
+
+    @type mainloop: ganeti.daemon.Mainloop
+    @param mainloop: Mainloop used to poll for I/O events
+    @type local_addess: string
+    @param local_address: Local IP address to bind to
+    @type port: int
+    @param port: TCP port to listen on
+
+    """
     self.mainloop = mainloop
-    self.server_address = server_address
+    self.local_address = local_address
+    self.port = port
 
     # TODO: SSL support
     self.ssl_cert = None
@@ -488,7 +499,7 @@ class HttpServer(object):
     mainloop.RegisterSignal(self)
 
   def Start(self):
-    self.socket.bind(self.server_address)
+    self.socket.bind((self.local_address, self.port))
     self.socket.listen(5)
 
   def Stop(self):
-- 
GitLab