diff --git a/daemons/ganeti-noded b/daemons/ganeti-noded index c1e8776f7b60e08797fade4fade1fc004bc54a53..958a031d15cd9e56bfe9a24d75462b817839dfe3 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 c22b6673ae54556f5e7c0cfcddfb264007c9072a..c4ed195d348085d0177a3cfb66fde4aff063c04e 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 db897fa146955978ccad572c02c37011a2ed5544..a6585507ab99fa2898fc0b930bd2285a0a89098b 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):