incubator-tashi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Cipar <jci...@cs.cmu.edu>
Subject Re: Remove environment variables
Date Thu, 15 Jan 2009 20:40:48 GMT
I realized that attachments don't work.  Here is the patch:

Index: trunk/src/tashi/agents/examplepolicy.py
===================================================================
--- trunk/src/tashi/agents/examplepolicy.py	(revision 734779)
+++ trunk/src/tashi/agents/examplepolicy.py	(working copy)
@@ -77,9 +77,11 @@
  				time.sleep(2)

  def createClient():
-	host = os.getenv('TASHI_CM_HOST', 'localhost')
-	port = os.getenv('TASHI_CM_PORT', '9882')
-	timeout = float(os.getenv('TASHI_CM_TIMEOUT', '5000.0'))
+        (config,configFiles) = getConfig(["Client"])
+        host = config.get('ClusterManagerService', 'host')
+        port = config.get('ClusterManagerService', 'port')
+        timeout = float(config.get('Client', 'timeout'))
+
  	socket = TSocket(host, int(port))
  	socket.setTimeout(timeout)
  	transport = TBufferedTransport(socket)
Index: trunk/src/tashi/client/client.py
===================================================================
--- trunk/src/tashi/client/client.py	(revision 734779)
+++ trunk/src/tashi/client/client.py	(working copy)
@@ -28,6 +28,8 @@
  from tashi.services import clustermanagerservice
  from tashi import vmStates

+from tashi.util import getConfig
+
  def makeHTMLTable(list):
  	(stdin_r, stdin_w) = os.pipe()
  	pipe = os.popen("tput cols")
@@ -146,9 +148,12 @@
  		for m in methods:
  			os.unlink(m)
  		sys.exit(0)
-	host = os.getenv('TASHI_CM_HOST', 'localhost')
-	port = os.getenv('TASHI_CM_PORT', '9882')
-	timeout = float(os.getenv('TASHI_CM_TIMEOUT', '5000.0'))
+
+        (config,configFiles) = getConfig(["Client"])
+        host = config.get('ClusterManagerService', 'host')
+        port = config.get('ClusterManagerService', 'port')
+        timeout = float(config.get('Client', 'timeout'))
+
  	socket = TSocket(host, int(port))
  	socket.setTimeout(timeout)
  	transport = TBufferedTransport(socket)
Index: trunk/etc/TashiDefaults.cfg
===================================================================
--- trunk/etc/TashiDefaults.cfg	(revision 734779)
+++ trunk/etc/TashiDefaults.cfg	(working copy)
@@ -57,6 +57,10 @@
  clusterManagerPort = 9882
  ;bind = 0.0.0.0 ; not supported (Thrift is missing support to  
specify what to bind to!)

+# Client configuration
+[Client]
+timeout = 5000.0
+
  [Qemu]
  qemuBin = /usr/local/bin/qemu-system-x86_64
  infoDir = /var/tmp/VmControlQemu/


Mime
View raw message