Revision 8c96d01f

b/daemons/ganeti-rapi
184 184

  
185 185
  """
186 186
  parser = optparse.OptionParser(description="Ganeti Remote API",
187
                    usage="%prog [-d] [-p port]",
187
                    usage="%prog [-d]",
188 188
                    version="%%prog (ganeti) %s" %
189 189
                                 constants.RAPI_VERSION)
190 190
  parser.add_option("-d", "--debug", dest="debug",
191 191
                    help="Enable some debug messages",
192 192
                    default=False, action="store_true")
193
  parser.add_option("-p", "--port", dest="port",
194
                    help="Port to run API (%s default)." %
195
                                 constants.RAPI_PORT,
196
                    default=constants.RAPI_PORT, type="int")
197 193
  parser.add_option("--no-ssl", dest="ssl",
198 194
                    help="Do not secure HTTP protocol with SSL",
199 195
                    default=True, action="store_false")
......
213 209
  options, args = parser.parse_args()
214 210

  
215 211
  if len(args) != 0:
216
    print >> sys.stderr, "Usage: %s [-d] [-p port]" % sys.argv[0]
212
    print >> sys.stderr, "Usage: %s [-d]" % sys.argv[0]
217 213
    sys.exit(constants.EXIT_FAILURE)
218 214

  
219 215
  if options.ssl and not (options.ssl_cert and options.ssl_key):
......
245 241
    ssl_params = None
246 242

  
247 243
  ssconf.CheckMaster(options.debug)
244
  port = utils.GetDaemonPort(constants.RAPI)
248 245

  
249 246
  if options.fork:
250 247
    utils.Daemonize(logfile=constants.LOG_RAPISERVER)
......
255 252
  utils.WritePidFile(constants.RAPI_PID)
256 253
  try:
257 254
    mainloop = daemon.Mainloop()
258
    server = RemoteApiHttpServer(mainloop, options.bind_address, options.port,
255
    server = RemoteApiHttpServer(mainloop, options.bind_address, port,
259 256
                                 ssl_params=ssl_params, ssl_verify_peer=False,
260 257
                                 request_executor_class=
261 258
                                 JsonErrorRequestExecutor)
b/lib/constants.py
117 117
NODE_INITD_SCRIPT = _autoconf.SYSCONFDIR + "/init.d/ganeti"
118 118

  
119 119
NODED = "ganeti-noded"
120
RAPI = "ganeti-rapi"
120 121

  
121 122
DAEMONS_PORTS = {
122 123
  # daemon-name: ("proto", "default-port")
123 124
  NODED: ("tcp", 1811),
125
  RAPI: ("tcp", 5080),
124 126
}
125 127
DEFAULT_NODED_PORT = DAEMONS_PORTS[NODED][1]
128
DEFAULT_RAPI_PORT = DAEMONS_PORTS[RAPI][1]
126 129

  
127 130
FIRST_DRBD_PORT = 11000
128 131
LAST_DRBD_PORT = 14999
......
496 499
ELOG_MESSAGE = "message"
497 500
ELOG_PROGRESS = "progress"
498 501

  
499
RAPI_PORT = 5080
500

  
501 502
# max dynamic devices
502 503
MAX_NICS = 8
503 504
MAX_DISKS = 16
b/man/ganeti-rapi.sgml
40 40
      <command>&dhpackage; </command>
41 41
      <arg>-d</arg>
42 42
      <arg>-f</arg>
43
      <arg>-p <replaceable>PORT</replaceable></arg>
44 43
      <arg>--no-ssl</arg>
45 44
      <arg>-K <replaceable>SSL_KEY_FILE</replaceable></arg>
46 45
      <arg>-C <replaceable>SSL_CERT_FILE</replaceable></arg>
......
65 64
    </para>
66 65

  
67 66
    <para>
68
      The daemon will listen by default on the port 5080, but this can
69
      be changed via the <option>-p</option> option.
67
      The daemon will listen to the "ganeti-rapi" tcp port, as listed in the
68
      system services database, or to port 5080 by default.
70 69
    </para>
71 70

  
72 71
    <para>
b/qa/qa_rapi.py
64 64
def _DoTests(uris):
65 65
  master = qa_config.GetMasterNode()
66 66
  host = master["primary"]
67
  port = qa_config.get("rapi-port", default=constants.RAPI_PORT)
67
  port = qa_config.get("rapi-port", default=constants.DEFAULT_RAPI_PORT)
68 68

  
69 69
  for uri, verify in uris:
70 70
    assert uri.startswith("/")

Also available in: Unified diff