ia64/xen-unstable

changeset 14429:1c94d9fcb7ef

Allow the xm configuration file location to be overridden with an
environment variable.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Thu Mar 15 21:44:20 2007 +0000 (2007-03-15)
parents b926f66f29ab
children edccebeea4a3
files tools/python/xen/xm/main.py
line diff
     1.1 --- a/tools/python/xen/xm/main.py	Thu Mar 15 16:54:00 2007 +0000
     1.2 +++ b/tools/python/xen/xm/main.py	Thu Mar 15 21:44:20 2007 +0000
     1.3 @@ -60,7 +60,8 @@ import XenAPI
     1.4  if not hasattr(getopt, 'gnu_getopt'):
     1.5      getopt.gnu_getopt = getopt.getopt
     1.6  
     1.7 -XM_CONFIG_FILE = '/etc/xen/xm-config.xml'
     1.8 +XM_CONFIG_FILE_ENVVAR = 'XM_CONFIG_FILE'
     1.9 +XM_CONFIG_FILE_DEFAULT = '/etc/xen/xm-config.xml'
    1.10  
    1.11  # Supported types of server
    1.12  SERVER_LEGACY_XMLRPC = 'LegacyXMLRPC'
    1.13 @@ -351,13 +352,14 @@ all_commands = (domain_commands + host_c
    1.14  # Configuration File Parsing
    1.15  ##
    1.16  
    1.17 +xmConfigFile = os.getenv(XM_CONFIG_FILE_ENVVAR, XM_CONFIG_FILE_DEFAULT)
    1.18  config = None
    1.19 -if os.path.isfile(XM_CONFIG_FILE):
    1.20 +if os.path.isfile(xmConfigFile):
    1.21      try:
    1.22 -        config = xml.dom.minidom.parse(XM_CONFIG_FILE)
    1.23 +        config = xml.dom.minidom.parse(xmConfigFile)
    1.24      except:
    1.25          print >>sys.stderr, ('Ignoring invalid configuration file %s.' %
    1.26 -                             XM_CONFIG_FILE)
    1.27 +                             xmConfigFile)
    1.28  
    1.29  def parseServer():
    1.30      if config: