ia64/xen-unstable

view tools/python/xen/xend/server/params.py @ 6552:a9873d384da4

Merge.
author adsharma@los-vmm.sc.intel.com
date Thu Aug 25 12:24:48 2005 -0700 (2005-08-25)
parents 112d44270733 fa0754a9f64f
children dfaf788ab18c
line source
1 #============================================================================
2 # This library is free software; you can redistribute it and/or
3 # modify it under the terms of version 2.1 of the GNU Lesser General Public
4 # License as published by the Free Software Foundation.
5 #
6 # This library is distributed in the hope that it will be useful,
7 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9 # Lesser General Public License for more details.
10 #
11 # You should have received a copy of the GNU Lesser General Public
12 # License along with this library; if not, write to the Free Software
13 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14 #============================================================================
15 # Copyright (C) 2004, 2005 Mike Wray <mike.wray@hp.com>
16 #============================================================================
18 import os
20 def getenv(var, val, conv=None):
21 """Get a value from the environment, with optional conversion.
23 @param var name of environment variable
24 @param val default value
25 @param conv conversion function to apply to env value
26 @return converted value or default
27 """
28 try:
29 v = os.getenv(var)
30 if v is None:
31 v = val
32 else:
33 print var, '=', v
34 if conv:
35 v = conv(v)
36 except:
37 v = val
38 return v
40 # The following parameters could be placed in a configuration file.
41 XEND_PID_FILE = '/var/run/xend.pid'
42 XEND_TRACE_FILE = '/var/log/xend.trace'
43 XEND_DEBUG_LOG = '/var/log/xend-debug.log'
44 XEND_USER = 'root'
45 XEND_DEBUG = getenv("XEND_DEBUG", 0, conv=int)
46 XEND_DAEMONIZE = getenv("XEND_DAEMONIZE", not XEND_DEBUG, conv=int)
48 XENSTORED_PID_FILE = '/var/run/xenstored.pid'
49 XENSTORED_RUN_DIR = '/var/run/xenstored'
50 XENSTORED_LIB_DIR = '/var/lib/xenstored'
51 XENSTORED_DEBUG = getenv("XENSTORED_DEBUG", 0, conv=int)