ganeti-noded: add bind address option
authorGuido Trotter <ultrotter@google.com>
Tue, 5 May 2009 10:29:10 +0000 (12:29 +0200)
committerGuido Trotter <ultrotter@google.com>
Tue, 5 May 2009 13:41:11 +0000 (15:41 +0200)
This allows ganeti-noded to bind only on one interface rather than all
the ones on the machine. The default behaviour doesn't change.

Signed-off-by: Guido Trotter <ultrotter@google.com>

daemons/ganeti-noded

index 3a2b4a0..9600e30 100755 (executable)
@@ -721,7 +721,7 @@ def ParseOptions():
 
   """
   parser = OptionParser(description="Ganeti node daemon",
-                        usage="%prog [-f] [-d]",
+                        usage="%prog [-f] [-d] [-b ADDRESS]",
                         version="%%prog (ganeti) %s" %
                         constants.RELEASE_VERSION)
 
@@ -731,6 +731,10 @@ def ParseOptions():
   parser.add_option("-d", "--debug", dest="debug",
                     help="Enable some debug messages",
                     default=False, action="store_true")
+  parser.add_option("-b", "--bind", dest="bind_address",
+                    help="Bind address",
+                    default="", metavar="ADDRESS")
+
   options, args = parser.parse_args()
   return options, args
 
@@ -781,7 +785,7 @@ def main():
     queue_lock = jstore.InitAndVerifyQueue(must_lock=False)
 
     mainloop = daemon.Mainloop()
-    server = NodeHttpServer(mainloop, "", port,
+    server = NodeHttpServer(mainloop, options.bind_address, port,
                             ssl_params=ssl_params, ssl_verify_peer=True)
     server.Start()
     try: