ia64/xen-unstable

changeset 14645:121fb4046945

Fix the xen-api-server option parsing, so that we default to listening on
all interfaces when only a port is given.

This was broken by cset 14601:966c65f0ddba.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Thu Mar 29 15:22:02 2007 +0100 (2007-03-29)
parents 6314d433d042
children 414735d45904
files tools/python/xen/xend/server/SrvServer.py
line diff
     1.1 --- a/tools/python/xen/xend/server/SrvServer.py	Thu Mar 29 15:10:26 2007 +0100
     1.2 +++ b/tools/python/xen/xend/server/SrvServer.py	Thu Mar 29 15:22:02 2007 +0100
     1.3 @@ -188,21 +188,22 @@ def _loadConfig(servers, root, reload):
     1.4              for server_cfg in api_cfg:
     1.5                  # Parse the xen-api-server config
     1.6                  
     1.7 -                host = 'localhost'
     1.8 -                port = 0
     1.9 -                use_tcp = False
    1.10                  ssl_key_file = None
    1.11                  ssl_cert_file = None
    1.12                  auth_method = XendAPI.AUTH_NONE
    1.13                  hosts_allowed = None
    1.14                  
    1.15                  host_addr = server_cfg[0].split(':', 1)
    1.16 -                if len(host_addr) == 1 and host_addr[0].lower() == 'unix':
    1.17 -                    use_tcp = False
    1.18 -                elif len(host_addr) == 1:
    1.19 -                    use_tcp = True
    1.20 -                    port = int(host_addr[0])
    1.21 -                elif len(host_addr) == 2:
    1.22 +                if len(host_addr) == 1:
    1.23 +                    if host_addr[0].lower() == 'unix':
    1.24 +                        use_tcp = False
    1.25 +                        host = 'localhost'
    1.26 +                        port = 0
    1.27 +                    else:
    1.28 +                        use_tcp = True
    1.29 +                        host = ''
    1.30 +                        port = int(host_addr[0])
    1.31 +                else:
    1.32                      use_tcp = True
    1.33                      host = str(host_addr[0])
    1.34                      port = int(host_addr[1])
    1.35 @@ -213,7 +214,6 @@ def _loadConfig(servers, root, reload):
    1.36  
    1.37                  if len(server_cfg) > 2:
    1.38                      hosts_allowed = server_cfg[2] or None
    1.39 -                
    1.40  
    1.41                  if len(server_cfg) > 4:
    1.42                      # SSL key and cert file