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/05/25 19:39:13 UTC

svn commit: r778481 - /incubator/tashi/trunk/src/tashi/clustermanager/clustermanagerservice.py

Author: mryan3
Date: Mon May 25 19:39:13 2009
New Revision: 778481

URL: http://svn.apache.org/viewvc?rev=778481&view=rev
Log:
Minor improvements to normalize on the clustermanager -- this fixes the silent failure that occurs when a user specifies a hostname with a "_"


Modified:
    incubator/tashi/trunk/src/tashi/clustermanager/clustermanagerservice.py

Modified: incubator/tashi/trunk/src/tashi/clustermanager/clustermanagerservice.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/tashi/clustermanager/clustermanagerservice.py?rev=778481&r1=778480&r2=778481&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/clustermanager/clustermanagerservice.py (original)
+++ incubator/tashi/trunk/src/tashi/clustermanager/clustermanagerservice.py Mon May 25 19:39:13 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, version
+from tashi import boolean, convertExceptions, ConnectionManager, vmStates, timed, version, scrubString
 
 def RPC(oldFunc):
 	return convertExceptions(oldFunc)
@@ -158,9 +158,11 @@
 			time.sleep(sleepFor)
 	
 	def normalize(self, instance):
+		instance.id = None
 		instance.vmId = None
 		instance.hostId = None
 		instance.decayed = False
+		instance.name = scrubString(instance.name, allowed="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-.")
 		instance.state = InstanceState.Pending
 		# At some point, check userId
 		if (not self.allowDuplicateNames):
@@ -178,6 +180,9 @@
 		# Make sure disk spec is valid
 		# Make sure network spec is valid
 		# Ignore hints
+		for hint in instance.hints:
+			if (hint.startswith("__")):
+				del instance.hints[hint]
 		return instance
 	
 	@RPC