direct-io.hg

changeset 12793:6a6748da2039

Diagnose bad config files.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Thu Dec 07 17:47:43 2006 +0000 (2006-12-07)
parents cf11417d7eb6
children 3859131c0b8b
files tools/python/xen/xm/main.py
line diff
     1.1 --- a/tools/python/xen/xm/main.py	Thu Dec 07 16:48:23 2006 +0000
     1.2 +++ b/tools/python/xen/xm/main.py	Thu Dec 07 17:47:43 2006 +0000
     1.3 @@ -335,17 +335,22 @@ all_commands = (domain_commands + host_c
     1.4  # Configuration File Parsing
     1.5  ##
     1.6  
     1.7 +config = None
     1.8  if os.path.isfile(XM_CONFIG_FILE):
     1.9 -    config = xml.dom.minidom.parse(XM_CONFIG_FILE)
    1.10 -else:
    1.11 -    config = None
    1.12 +    try:
    1.13 +        config = xml.dom.minidom.parse(XM_CONFIG_FILE)
    1.14 +    except:
    1.15 +        print >>sys.stderr, ('Ignoring invalid configuration file %s.' %
    1.16 +                             XM_CONFIG_FILE)
    1.17  
    1.18  def parseServer():
    1.19      if config:
    1.20          server = config.getElementsByTagName('server')
    1.21          if server:
    1.22              st = server[0].getAttribute('type')
    1.23 -            if st != SERVER_XEN_API:
    1.24 +            if st != SERVER_XEN_API and st != SERVER_LEGACY_XMLRPC:
    1.25 +                print >>sys.stderr, ('Invalid server type %s; using %s.' %
    1.26 +                                     (st, SERVER_LEGACY_XMLRPC))
    1.27                  st = SERVER_LEGACY_XMLRPC
    1.28              return (st, server[0].getAttribute('uri'))
    1.29