All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] configuration params
@ 2005-06-10 15:10 aq
  0 siblings, 0 replies; only message in thread
From: aq @ 2005-06-10 15:10 UTC (permalink / raw)
  To: Xen Dev

[-- Attachment #1: Type: text/plain, Size: 394 bytes --]

Some hidden & constant configuration parameters are scattered. This
patch puts them all into one place: params.py.

Signed-off-by: Nguyen Anh Quynh <aquynh@gmail.com>

# diffstat params.patch 
 XendRoot.py            |   28 ++++++++++++++--------------
 server/params.py       |   12 ++++++++++++
 xenstore/xsresource.py |    3 ++-
 3 files changed, 28 insertions(+), 15 deletions(-)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: params.patch --]
[-- Type: text/x-patch; name="params.patch", Size: 4784 bytes --]

===== tools/python/xen/xend/XendRoot.py 1.30 vs edited =====
--- 1.30/tools/python/xen/xend/XendRoot.py	2005-06-09 04:01:09 -05:00
+++ edited/tools/python/xen/xend/XendRoot.py	2005-06-11 00:00:30 -05:00
@@ -16,6 +16,7 @@
 import EventServer
 from XendLogging import XendLogging
 from XendError import XendError
+from xen.xend.server import params
 
 # Initial create of the event server.
 eserver = EventServer.instance()
@@ -26,28 +27,28 @@
     """Root of the management classes."""
 
     """Default path to the config file."""
-    config_default = "/etc/xen/xend-config.sxp"
+    config_default = params.XEND_CONFIG
 
     """Environment variable used to override config_default."""
-    config_var     = "XEND_CONFIG"
+    config_var = params.XEND_CONFIG_ENV
 
     """Where network control scripts live."""
-    network_script_dir = "/etc/xen/scripts"
+    network_script_dir = params.XEN_NETWORK_SCRIPT_DIR
 
     """Where block control scripts live."""
-    block_script_dir = "/etc/xen/scripts"
+    block_script_dir = params.XEN_BLOCK_SCRIPT_DIR
 
     """Default path to the log file. """
-    logfile_default = "/var/log/xend.log"
+    logfile_default = params.XEND_LOG
 
     """Default level of information to be logged."""
-    loglevel_default = 'DEBUG'
+    loglevel_default = params.XEND_LOGLEVEL
 
     """Default for the flag indicating whether xend should run an http server."""
     xend_http_server_default = 'no'
 
     """Default interface address xend listens at. """
-    xend_address_default      = ''
+    xend_address_default = ''
 
     """Default for the flag indicating whether xend should run a relocation server."""
     xend_relocation_server_default = 'yes'
@@ -56,25 +57,25 @@
     xend_relocation_address_default = ''
 
     """Default port xend serves HTTP at. """
-    xend_port_default         = '8000'
+    xend_port_default = params.XEND_PORT
 
     """Default port xend serves events at. """
-    xend_event_port_default   = '8001'
+    xend_event_port_default = params.XEND_EVENT_PORT
 
     """Default port xend serves relocation at. """
-    xend_relocation_port_default = '8002'
+    xend_relocation_port_default = params.XEND_RELOCATION_PORT
 
     """Default for the flag indicating whether xend should run a unix-domain server."""
     xend_unix_server_default = 'yes'
 
     """Default path the unix-domain server listens at."""
-    xend_unix_path_default = '/var/lib/xend/xend-socket'
+    xend_unix_path_default = params.XEND_UNIX_PATH
 
     """Default interface address xend listens at for consoles."""
-    console_address_default   = 'localhost'
+    console_address_default = 'localhost'
 
     """Default port xend serves consoles at. """
-    console_port_base_default = '9600'
+    console_port_base_default = params.CONSOLE_PORT_BASE
 
     components = {}
 
@@ -173,7 +174,6 @@
         loglevel = self.get_config_value("loglevel", self.loglevel_default)
         self.logging = XendLogging(logfile, level=loglevel)
 
-        from xen.xend.server import params
         if params.XEND_DEBUG:
             self.logging.addLogStderr()
 
===== tools/python/xen/xend/server/params.py 1.12 vs edited =====
--- 1.12/tools/python/xen/xend/server/params.py	2005-06-07 08:18:24 -05:00
+++ edited/tools/python/xen/xend/server/params.py	2005-06-11 00:00:30 -05:00
@@ -27,8 +27,20 @@
 XEND_USER          = 'root'
 XEND_DEBUG         = getenv("XEND_DEBUG",     0, conv=int)
 XEND_DAEMONIZE     = getenv("XEND_DAEMONIZE", not XEND_DEBUG, conv=int)
+XEND_CONFIG = "/etc/xen/xend-config.sxp"
+XEND_CONFIG_ENV = "XEND_CONFIG"
+XEN_NETWORK_SCRIPT_DIR = "/etc/xen/scripts"
+XEN_BLOCK_SCRIPT_DIR = "/etc/xen/scripts"
+XEND_LOG = "/var/log/xend.log"
+XEND_LOGLEVEL = 'DEBUG'
+XEND_PORT = '8000'
+XEND_EVENT_PORT = '8001'
+XEND_RELOCATION_PORT = '8002'
+XEND_UNIX_PATH = '/var/lib/xend/xend-socket'
+CONSOLE_PORT_BASE = '9600'
 
 XENSTORED_PID_FILE = '/var/run/xenstored.pid'
 XENSTORED_RUN_DIR  = '/var/run/xenstored'
 XENSTORED_LIB_DIR  = '/var/lib/xenstored'
 XENSTORED_DEBUG    = getenv("XENSTORED_DEBUG", 0, conv=int)
+XENSTORED_PORT = 8003
===== tools/python/xen/xend/xenstore/xsresource.py 1.1 vs edited =====
--- 1.1/tools/python/xen/xend/xenstore/xsresource.py	2005-06-07 08:36:00 -05:00
+++ edited/tools/python/xen/xend/xenstore/xsresource.py	2005-06-11 00:00:30 -05:00
@@ -12,6 +12,7 @@
 from xen.web.SrvDir import SrvDir
 from xen.xend.Args import FormFn
 from xen.xend.xenstore import XenNode
+from xen.xend.server import params
 
 def pathurl(req):
     url = req.prePathURL()
@@ -131,6 +132,6 @@
     root = SrvDir()
     root.putChild('xenstore', DBRootResource())
     interface = ''
-    port = 8003
+    port = params.XENSTORED_PORT
     server = HttpServer(root=root, interface=interface, port=port)
     server.run()

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-06-10 15:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-10 15:10 [PATCH] configuration params aq

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.