Revision 802ed2aa

b/lib/daemon.py
712 712
                          default=constants.SYSLOG_USAGE,
713 713
                          choices=["no", "yes", "only"])
714 714

  
715
  family = ssconf.SimpleStore().GetPrimaryIPFamily()
716
  # family will default to AF_INET if there is no ssconf file (e.g. when
717
  # upgrading a cluster from 2.2 -> 2.3. This is intended, as Ganeti clusters
718
  # <= 2.2 can not be AF_INET6
715 719
  if daemon_name in constants.DAEMONS_PORTS:
716 720
    default_bind_address = constants.IP4_ADDRESS_ANY
717
    family = ssconf.SimpleStore().GetPrimaryIPFamily()
718
    # family will default to AF_INET if there is no ssconf file (e.g. when
719
    # upgrading a cluster from 2.2 -> 2.3. This is intended, as Ganeti clusters
720
    # <= 2.2 can not be AF_INET6
721 721
    if family == netutils.IP6Address.family:
722 722
      default_bind_address = constants.IP6_ADDRESS_ANY
723 723

  
......
731 731
                            help=("Bind address (default: '%s')" %
732 732
                                  default_bind_address),
733 733
                            default=default_bind_address, metavar="ADDRESS")
734
    optionparser.add_option("-i", "--interface", dest="bind_interface",
735
                            help=("Bind interface"), metavar="INTERFACE")
734 736

  
735 737
  if default_ssl_key is not None and default_ssl_cert is not None:
736 738
    optionparser.add_option("--no-ssl", dest="ssl",
......
753 755

  
754 756
  options, args = optionparser.parse_args()
755 757

  
758
  if getattr(options, "bind_interface", None) is not None:
759
    if options.bind_address != default_bind_address:
760
      msg = ("Can't specify both, bind address (%s) and bind interface (%s)" %
761
             (options.bind_address, options.bind_interface))
762
      print >> sys.stderr, msg
763
      sys.exit(constants.EXIT_FAILURE)
764
    interface_ip_addresses = \
765
      netutils.GetInterfaceIpAddresses(options.bind_interface)
766
    if family == netutils.IP6Address.family:
767
      if_addresses = interface_ip_addresses[constants.IP6_VERSION]
768
    else:
769
      if_addresses = interface_ip_addresses[constants.IP4_VERSION]
770
    if len(if_addresses) < 1:
771
      msg = "Failed to find IP for interface %s" % options.bind_interace
772
      print >> sys.stderr, msg
773
      sys.exit(constants.EXIT_FAILURE)
774
    options.bind_address = if_addresses[0]
775

  
756 776
  if getattr(options, "ssl", False):
757 777
    ssl_paths = {
758 778
      "certificate": options.ssl_cert,
b/lib/server/noded.py
1177 1177

  
1178 1178
  """
1179 1179
  parser = OptionParser(description="Ganeti node daemon",
1180
                        usage="%prog [-f] [-d] [-p port] [-b ADDRESS]",
1180
                        usage="%prog [-f] [-d] [-p port] [-b ADDRESS]\
1181
                              \ [-i INTERFACE]",
1181 1182
                        version="%%prog (ganeti) %s" %
1182 1183
                        constants.RELEASE_VERSION)
1183 1184
  parser.add_option("--no-mlock", dest="mlock",
b/lib/server/rapi.py
360 360

  
361 361
  """
362 362
  parser = optparse.OptionParser(description="Ganeti Remote API",
363
                                 usage="%prog [-f] [-d] [-p port] [-b ADDRESS]",
363
                                 usage="%prog [-f] [-d] [-p port] [-b ADDRESS]\
364
                                       \ [-i INTERFACE]",
364 365
                                 version="%%prog (ganeti) %s" %
365 366
                                 constants.RELEASE_VERSION)
366 367
  parser.add_option("--require-authentication", dest="reqauth",
b/man/ganeti-noded.rst
9 9
Synopsis
10 10
--------
11 11

  
12
**ganeti-noded** [-f] [-d] [-p *PORT*] [-b *ADDRESS*]
12
**ganeti-noded** [-f] [-d] [-p *PORT*] [-b *ADDRESS*] [-i *INTERFACE*]
13 13
[--no-mlock] [--syslog] [--no-ssl] [-K *SSL_KEY_FILE*] [-C *SSL_CERT_FILE*]
14 14

  
15 15
DESCRIPTION
......
35 35
interfaces, by default. The port can be overridden by an entry in the
36 36
services database (usually ``/etc/services``) or by passing the ``-p``
37 37
option.  The ``-b`` option can be used to specify the address to bind
38
to (defaults to ``0.0.0.0``).
38
to (defaults to ``0.0.0.0``); alternatively, the ``-i`` option can be
39
used to specify the interface to bind do.
39 40

  
40 41
Ganeti noded communication is protected via SSL, with a key
41 42
generated at cluster init time. This can be disabled with the
b/man/ganeti-rapi.rst
9 9
Synopsis
10 10
--------
11 11

  
12
| **ganeti-rapi** [-d] [-f] [-p *PORT] [-b *ADDRESS*]
12
| **ganeti-rapi** [-d] [-f] [-p *PORT] [-b *ADDRESS*] [-i *INTERFACE*]
13 13
| [\--no-ssl] [-K *SSL_KEY_FILE*] [-C *SSL_CERT_FILE*]
14 14
| [\--require-authentication]
15 15

  
......
28 28
system services database, or if not defined, to port 5080 by default.
29 29
The port can be overridded by passing the ``-p`` option. The ``-b``
30 30
option can be used to specify the address to bind to (defaults to
31
``0.0.0.0``).
31
``0.0.0.0``); alternatively, the ``-i`` option can be used to specify
32
the interface to bind do.
32 33

  
33 34
See the *Ganeti remote API* documentation for further information.
34 35

  

Also available in: Unified diff