You are viewing a plain text version of this content. The canonical link for it is here.
Posted to tashi-commits@incubator.apache.org by mr...@apache.org on 2009/02/04 20:23:00 UTC

svn commit: r740860 - in /incubator/tashi/trunk: Makefile etc/TashiDefaults.cfg src/tashi/__init__.py src/tashi/clustermanager/clustermanagerservice.py src/tashi/nodemanager/nodemanagerservice.py src/tashi/thrift/services.thrift src/tashi/version.py

Author: mryan3
Date: Wed Feb  4 20:22:59 2009
New Revision: 740860

URL: http://svn.apache.org/viewvc?rev=740860&view=rev
Log:
Code to add version strings to hosts.
This allows the cluster manager to record that a host has a version mismatch.
That in turn allows the scheduler to avoid placing VMs on it.


Added:
    incubator/tashi/trunk/src/tashi/version.py
Modified:
    incubator/tashi/trunk/Makefile
    incubator/tashi/trunk/etc/TashiDefaults.cfg
    incubator/tashi/trunk/src/tashi/__init__.py
    incubator/tashi/trunk/src/tashi/clustermanager/clustermanagerservice.py
    incubator/tashi/trunk/src/tashi/nodemanager/nodemanagerservice.py
    incubator/tashi/trunk/src/tashi/thrift/services.thrift

Modified: incubator/tashi/trunk/Makefile
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/Makefile?rev=740860&r1=740859&r2=740860&view=diff
==============================================================================
--- incubator/tashi/trunk/Makefile (original)
+++ incubator/tashi/trunk/Makefile Wed Feb  4 20:22:59 2009
@@ -21,10 +21,10 @@
 .SILENT:
 
 # Explicit builds
-all: src/tashi/services bin src/utils/nmd
+default: src/tashi/services bin src/utils/nmd
 	@echo Done
 
-mryan3: src/tashi/services bin src/utils/nmd src/tags doc/html
+all: src/tashi/services bin src/utils/nmd src/tags doc/html
 	@echo Done
 
 doc: rmdoc doc/html
@@ -34,6 +34,9 @@
 	if [ `find . -name "*.pyc" | wc -l` -gt 0 ]; then echo Removing python byte-code...; rm `find . -name "*.pyc"`; fi
 	@echo Done
 
+version:
+	sed -i "s/version = .*/version = \"`date`\"/" src/tashi/version.py
+
 # Implicit builds
 src/utils/nmd: src/utils/Makefile src/utils/nmd.c
 	@echo Building nmd...

Modified: incubator/tashi/trunk/etc/TashiDefaults.cfg
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/etc/TashiDefaults.cfg?rev=740860&r1=740859&r2=740860&view=diff
==============================================================================
--- incubator/tashi/trunk/etc/TashiDefaults.cfg (original)
+++ incubator/tashi/trunk/etc/TashiDefaults.cfg Wed Feb  4 20:22:59 2009
@@ -27,6 +27,7 @@
 port = 9882
 expireHostTime = 30.0
 allowDecayed = 30.0
+allowMismatchedVersions = False
 ;bind = 0.0.0.0 ; not supported (Thrift is missing support to specify what to bind to!)
 
 [FromConfig]

Modified: incubator/tashi/trunk/src/tashi/__init__.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/tashi/__init__.py?rev=740860&r1=740859&r2=740860&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/__init__.py (original)
+++ incubator/tashi/trunk/src/tashi/__init__.py Wed Feb  4 20:22:59 2009
@@ -17,3 +17,4 @@
 
 from util import *
 from connectionmanager import ConnectionManager
+from version import version

Modified: incubator/tashi/trunk/src/tashi/clustermanager/clustermanagerservice.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/tashi/clustermanager/clustermanagerservice.py?rev=740860&r1=740859&r2=740860&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/clustermanager/clustermanagerservice.py (original)
+++ incubator/tashi/trunk/src/tashi/clustermanager/clustermanagerservice.py Wed Feb  4 20:22:59 2009
@@ -29,7 +29,7 @@
 from tashi.messaging.tashimessaging import TashiLogHandler
 from tashi.services.ttypes import Errors, InstanceState, HostState, TashiException
 from tashi.services import nodemanagerservice
-from tashi import boolean, convertExceptions, ConnectionManager, vmStates, timed
+from tashi import boolean, convertExceptions, ConnectionManager, vmStates, timed, version
 
 def RPC(oldFunc):
 	return convertExceptions(oldFunc)
@@ -50,6 +50,7 @@
 		self.decayedInstances = {}
 		self.expireHostTime = float(self.config.get('ClusterManagerService', 'expireHostTime'))
 		self.allowDecayed = float(self.config.get('ClusterManagerService', 'allowDecayed'))
+		self.allowMismatchedVersions = boolean(self.config.get('ClusterManagerService', 'allowMismatchedVersions'))
 		now = time.time()
 		for instance in self.data.getInstances().itervalues():
 			instanceId = instance.id
@@ -339,10 +340,15 @@
 			raise TashiException(d={'errno':Errors.NoSuchHostId, 'msg':'Host id and hostname mismatch'})
 		try:
 			self.lastContacted[host.id] = time.time()
+			oldHost.version = host.version
 			oldHost.memory = host.memory
 			oldHost.cores = host.cores
 			oldHost.up = True
 			oldHost.decayed = False
+			if (host.version != version and not self.allowMismatchedVersions):
+				oldHost.state = HostState.VersionMismatch
+			if (host.version == version and oldHost.state == HostState.VersionMismatch):
+				oldHost.state = HostState.Normal
 			for instance in instances:
 				try:
 					oldInstance = self.data.acquireInstance(instance.id)

Modified: incubator/tashi/trunk/src/tashi/nodemanager/nodemanagerservice.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/tashi/nodemanager/nodemanagerservice.py?rev=740860&r1=740859&r2=740860&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/nodemanager/nodemanagerservice.py (original)
+++ incubator/tashi/trunk/src/tashi/nodemanager/nodemanagerservice.py Wed Feb  4 20:22:59 2009
@@ -29,7 +29,7 @@
 from tashi.services.ttypes import ResumeVmRes, Host, HostState, InstanceState, TashiException, Errors, Instance
 from tashi.services import clustermanagerservice
 from tashi.nodemanager import RPC
-from tashi import boolean, vmStates, logged, ConnectionManager, timed
+from tashi import boolean, vmStates, logged, ConnectionManager, timed, version
 
 class NodeManagerService():
 	"""RPC handler for the NodeManager
@@ -120,6 +120,7 @@
 		host.cores = os.sysconf("SC_NPROCESSORS_ONLN")
 		host.up = True
 		host.decayed = False
+		host.version = version
 		return host
 	
 	def junk(self):

Modified: incubator/tashi/trunk/src/tashi/thrift/services.thrift
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/tashi/thrift/services.thrift?rev=740860&r1=740859&r2=740860&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/thrift/services.thrift (original)
+++ incubator/tashi/trunk/src/tashi/thrift/services.thrift Wed Feb  4 20:22:59 2009
@@ -48,7 +48,8 @@
 
 enum HostState {
 	Normal = 1,
-	Drained = 2
+	Drained = 2,
+	VersionMismatch = 3
 }
 
 exception TashiException {
@@ -63,7 +64,8 @@
 	4:bool decayed,
 	5:HostState state,
 	6:i32 memory,
-	7:i32 cores
+	7:i32 cores,
+	8:string version
 	// Other properties (disk?)
 }
 

Added: incubator/tashi/trunk/src/tashi/version.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/tashi/version.py?rev=740860&view=auto
==============================================================================
--- incubator/tashi/trunk/src/tashi/version.py (added)
+++ incubator/tashi/trunk/src/tashi/version.py Wed Feb  4 20:22:59 2009
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.    
+
+version = "Wed Feb  4 15:20:15 EST 2009"