incubator-tashi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strou...@apache.org
Subject svn commit: r1203836 - in /incubator/tashi: branches/cmu/src/tashi/agents/ branches/cmu/src/tashi/clustermanager/ branches/cmu/src/tashi/nodemanager/ branches/cmu/src/tashi/nodemanager/vmcontrol/ trunk/
Date Fri, 18 Nov 2011 21:03:23 GMT
Author: stroucki
Date: Fri Nov 18 21:03:23 2011
New Revision: 1203836

URL: http://svn.apache.org/viewvc?rev=1203836&view=rev
Log:
remove old branch stablefix

Removed:
    incubator/tashi/trunk/
Modified:
    incubator/tashi/branches/cmu/src/tashi/agents/dhcpdns.py
    incubator/tashi/branches/cmu/src/tashi/agents/locality-server.py
    incubator/tashi/branches/cmu/src/tashi/agents/primitive.py
    incubator/tashi/branches/cmu/src/tashi/clustermanager/clustermanager.py
    incubator/tashi/branches/cmu/src/tashi/clustermanager/clustermanagerservice.py
    incubator/tashi/branches/cmu/src/tashi/nodemanager/nodemanager.py
    incubator/tashi/branches/cmu/src/tashi/nodemanager/nodemanagerservice.py
    incubator/tashi/branches/cmu/src/tashi/nodemanager/vmcontrol/qemu.py
    incubator/tashi/branches/cmu/src/tashi/nodemanager/vmcontrol/vmcontrolinterface.py

Modified: incubator/tashi/branches/cmu/src/tashi/agents/dhcpdns.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/cmu/src/tashi/agents/dhcpdns.py?rev=1203836&r1=1203835&r2=1203836&view=diff
==============================================================================
--- incubator/tashi/branches/cmu/src/tashi/agents/dhcpdns.py (original)
+++ incubator/tashi/branches/cmu/src/tashi/agents/dhcpdns.py Fri Nov 18 21:03:23 2011
@@ -28,7 +28,8 @@ from tashi import boolean
 class DhcpDns(InstanceHook):
 	def __init__(self, config, client, post=False):
 		InstanceHook.__init__(self, config, client, post)
-		self.dnsKeyFile = self.config.get('DhcpDns', 'dnsKeyFile')
+		self.dnsKeyName = self.config.get('DhcpDns', 'dnsKeyName')
+		self.dnsSecretKey = self.config.get('DhcpDns', 'dnsSecretKey')
 		self.dnsServer = self.config.get('DhcpDns', 'dnsServer')
 		self.dnsDomain = self.config.get('DhcpDns', 'dnsDomain')
 		self.dnsExpire = int(self.config.get('DhcpDns', 'dnsExpire'))
@@ -153,14 +154,12 @@ class DhcpDns(InstanceHook):
 			self.removeDns(name)
 		except:
 			pass
-		if (self.dnsKeyFile != ""):
-			cmd = "nsupdate -k %s" % (self.dnsKeyFile)
-		else:
-			cmd = "nsupdate"
+		cmd = "nsupdate"
 		child = subprocess.Popen(args=cmd.split(), stdin=subprocess.PIPE, stdout=subprocess.PIPE)
 		try:
 			(stdin, stdout) = (child.stdin, child.stdout)
 			stdin.write("server %s\n" % (self.dnsServer))
+			stdin.write("key %s %s\n" % (self.dnsKeyName, self.dnsSecretKey))
 			stdin.write("update add %s.%s %d A %s\n" % (name, self.dnsDomain, self.dnsExpire, ip))
 			stdin.write("\n")
 			if (self.reverseDns):
@@ -181,14 +180,12 @@ class DhcpDns(InstanceHook):
 				(pid, status) = os.waitpid(child.pid, os.WNOHANG)
 	
 	def removeDns(self, name):
-		if (self.dnsKeyFile != ""):
-			cmd = "nsupdate -k %s" % (self.dnsKeyFile)
-		else:
-			cmd = "nsupdate"
+		cmd = "nsupdate"
 		child = subprocess.Popen(args=cmd.split(), stdin=subprocess.PIPE, stdout=subprocess.PIPE)
 		try:
 			(stdin, stdout) = (child.stdin, child.stdout)
 			stdin.write("server %s\n" % (self.dnsServer))
+			stdin.write("key %s %s\n" % (self.dnsKeyName, self.dnsSecretKey))
 			if (self.reverseDns):
 				ip = socket.gethostbyname(name)
 				ipSegments = map(int, ip.split("."))

Modified: incubator/tashi/branches/cmu/src/tashi/agents/locality-server.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/cmu/src/tashi/agents/locality-server.py?rev=1203836&r1=1203835&r2=1203836&view=diff
==============================================================================
--- incubator/tashi/branches/cmu/src/tashi/agents/locality-server.py (original)
+++ incubator/tashi/branches/cmu/src/tashi/agents/locality-server.py Fri Nov 18 21:03:23 2011
@@ -1,5 +1,4 @@
 #!/usr/bin/python
-
 # 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

Modified: incubator/tashi/branches/cmu/src/tashi/agents/primitive.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/cmu/src/tashi/agents/primitive.py?rev=1203836&r1=1203835&r2=1203836&view=diff
==============================================================================
--- incubator/tashi/branches/cmu/src/tashi/agents/primitive.py (original)
+++ incubator/tashi/branches/cmu/src/tashi/agents/primitive.py Fri Nov 18 21:03:23 2011
@@ -146,6 +146,11 @@ class Primitive(object):
 					# XXXstroucki if it's down, find another machine
 					if (h.up == False):
 						continue
+
+					#  If the host not in normal operating state, 
+					#  find another machine
+					if (h.state != HostState.Normal):
+						continue
 		
 					# if it's reserved, see if we can use it
 					if ((len(h.reserved) > 0) and inst.userId not in h.reserved):

Modified: incubator/tashi/branches/cmu/src/tashi/clustermanager/clustermanager.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/cmu/src/tashi/clustermanager/clustermanager.py?rev=1203836&r1=1203835&r2=1203836&view=diff
==============================================================================
--- incubator/tashi/branches/cmu/src/tashi/clustermanager/clustermanager.py (original)
+++ incubator/tashi/branches/cmu/src/tashi/clustermanager/clustermanager.py Fri Nov 18 21:03:23
2011
@@ -30,7 +30,7 @@ import tashi
 
 from tashi.rpycservices import rpycservices
 from rpyc.utils.server import ThreadedServer
-from rpyc.utils.authenticators import VdbAuthenticator
+from rpyc.utils.authenticators import TlsliteVdbAuthenticator
 
 def startClusterManager(config):
 	global service, data
@@ -47,7 +47,7 @@ def startClusterManager(config):
 				users[user.name] = user.passwd
 		users[config.get('AllowedUsers', 'nodeManagerUser')] = config.get('AllowedUsers', 'nodeManagerPassword')
 		users[config.get('AllowedUsers', 'agentUser')] = config.get('AllowedUsers', 'agentPassword')
-		authenticator = VdbAuthenticator.from_dict(users)
+		authenticator = TlsliteVdbAuthenticator.from_dict(users)
 		t = ThreadedServer(service=rpycservices.ManagerService, hostname='0.0.0.0', port=int(config.get('ClusterManagerService',
'port')), auto_register=False, authenticator=authenticator)
 	else:
 		t = ThreadedServer(service=rpycservices.ManagerService, hostname='0.0.0.0', port=int(config.get('ClusterManagerService',
'port')), auto_register=False)

Modified: incubator/tashi/branches/cmu/src/tashi/clustermanager/clustermanagerservice.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/cmu/src/tashi/clustermanager/clustermanagerservice.py?rev=1203836&r1=1203835&r2=1203836&view=diff
==============================================================================
--- incubator/tashi/branches/cmu/src/tashi/clustermanager/clustermanagerservice.py (original)
+++ incubator/tashi/branches/cmu/src/tashi/clustermanager/clustermanagerservice.py Fri Nov
18 21:03:23 2011
@@ -72,11 +72,19 @@ class ClusterManagerService(object):
 		threading.Thread(target=self.monitorCluster).start()
 
 	def stateTransition(self, instance, old, cur):
-		if cur == InstanceState.Running:
-			self.log.exception("%d was made running here" % instance.id)
 		if (old and instance.state != old):
 			raise TashiException(d={'errno':Errors.IncorrectVmState,'msg':"VmState is not %s - it
is %s" % (vmStates[old], vmStates[instance.state])})
+		if (instance.state == cur):
+			return
+
 		instance.state = cur
+		try:
+			host = self.data.getHost(instance.hostId)
+			vmId = instance.vmId
+			self.proxy[host.name].vmStateChange(vmId, old, cur)
+		except:
+			#XXXstroucki append to a list?
+			pass
 
 	def __now(self):
 		return time.time()
@@ -341,6 +349,8 @@ class ClusterManagerService(object):
 		except:
 			self.data.releaseInstance(instance)
 			raise
+		from pprint import pformat
+		self.log.info("A: %s" % (pformat(instance)))
 		self.stateTransition(instance, InstanceState.Running, InstanceState.MigratePrep)
 		self.data.releaseInstance(instance)
 		try:
@@ -349,11 +359,14 @@ class ClusterManagerService(object):
 			self.proxy[sourceHost.name].prepSourceVm(instance.vmId)
 			self.log.info("migrateVm: Calling prepReceiveVm on target host %s" % targetHost.name)
 			cookie = self.proxy[targetHost.name].prepReceiveVm(instance, sourceHost)
+			self.log.info("Debug: here")
 		except Exception, e:
 			self.log.exception('prepReceiveVm failed')
 			raise
 		instance = self.data.acquireInstance(instance.id)
+		self.log.info("B: %s" % (pformat(instance)))
 		self.stateTransition(instance, InstanceState.MigratePrep, InstanceState.MigrateTrans)
+		self.log.info("C: %s" % (pformat(instance)))
 		self.data.releaseInstance(instance)
 		try:
 			# Send the VM
@@ -370,6 +383,7 @@ class ClusterManagerService(object):
 		try:
 			# Notify the target
 			vmId = self.proxy[targetHost.name].receiveVm(instance, cookie)
+			self.log.info("D: %s notified" % targetHost.name)
 		except Exception, e:
 			self.log.exception('receiveVm failed')
 			raise

Modified: incubator/tashi/branches/cmu/src/tashi/nodemanager/nodemanager.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/cmu/src/tashi/nodemanager/nodemanager.py?rev=1203836&r1=1203835&r2=1203836&view=diff
==============================================================================
--- incubator/tashi/branches/cmu/src/tashi/nodemanager/nodemanager.py (original)
+++ incubator/tashi/branches/cmu/src/tashi/nodemanager/nodemanager.py Fri Nov 18 21:03:23
2011
@@ -28,7 +28,7 @@ from tashi import boolean
 
 from tashi.rpycservices import rpycservices
 from rpyc.utils.server import ThreadedServer
-from rpyc.utils.authenticators import VdbAuthenticator
+from rpyc.utils.authenticators import TlsliteVdbAuthenticator
 
 @signalHandler(signal.SIGTERM)
 def handleSIGTERM(signalNumber, stackFrame):
@@ -51,7 +51,7 @@ def main():
 	if boolean(config.get("Security", "authAndEncrypt")):
 		users = {}
 		users[config.get('AllowedUsers', 'clusterManagerUser')] = config.get('AllowedUsers', 'clusterManagerPassword')
-		authenticator = VdbAuthenticator.from_dict(users)
+		authenticator = TlsliteVdbAuthenticator.from_dict(users)
 		t = ThreadedServer(service=rpycservices.ManagerService, hostname='0.0.0.0', port=int(config.get('NodeManagerService',
'port')), auto_register=False, authenticator=authenticator)
 	else:
 		t = ThreadedServer(service=rpycservices.ManagerService, hostname='0.0.0.0', port=int(config.get('NodeManagerService',
'port')), auto_register=False)

Modified: incubator/tashi/branches/cmu/src/tashi/nodemanager/nodemanagerservice.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/cmu/src/tashi/nodemanager/nodemanagerservice.py?rev=1203836&r1=1203835&r2=1203836&view=diff
==============================================================================
--- incubator/tashi/branches/cmu/src/tashi/nodemanager/nodemanagerservice.py (original)
+++ incubator/tashi/branches/cmu/src/tashi/nodemanager/nodemanagerservice.py Fri Nov 18 21:03:23
2011
@@ -91,17 +91,19 @@ class NodeManagerService(object):
 			self.log.warning('VM state was %s, call indicated %s' % (vmStates[instance.state], vmStates[old]))
 		if (cur == InstanceState.Exited):
 			del self.instances[vmId]
+			return True
+
+		if (instance.state == cur):
+			# don't do anything if state is what it should be
+			return True
+
 		instance.state = cur
 		newInst = Instance(d={'state':cur})
 		success = lambda: None
-		try:
-			cm = ConnectionManager(self.username, self.password, self.cmPort)[self.cmHost]
-			cm.vmUpdate(instance.id, newInst, old)
-		except Exception, e:
-			self.log.exception('RPC failed for vmUpdate on CM')
-			self.notifyCM.append((instance.id, newInst, old, success))
-		else:
-			success()
+		self.notifyCM.append((instance.id, newInst, old, success))
+		self.setInstance(instance)
+
+		success()
 		return True
 	
 	def backupVmInfoAndFlushNotifyCM(self):
@@ -179,6 +181,9 @@ class NodeManagerService(object):
 		if (instance is None):
 			raise TashiException(d={'errno':Errors.NoSuchVmId,'msg':"There is no vmId %d on this host"
% (vmId)})
 		return instance
+
+	def setInstance(self, instance):
+		self.vmm.setInstance(instance)
 	
 	def instantiateVm(self, instance):
 		vmId = self.vmm.instantiateVm(instance)
@@ -245,6 +250,8 @@ class NodeManagerService(object):
 		instance.vmId = vmId
 		self.instances[vmId] = instance
 		newInstance = Instance(d={'id':instance.id,'state':instance.state,'vmId':instance.vmId,'hostId':instance.hostId})
+		import pprint
+		self.log.info("Debug: %s" % (pprint.pformat(newInstance)))
 		success = lambda: None
 		try:
 			cm.vmUpdate(newInstance.id, newInstance, InstanceState.MigrateTrans)

Modified: incubator/tashi/branches/cmu/src/tashi/nodemanager/vmcontrol/qemu.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/cmu/src/tashi/nodemanager/vmcontrol/qemu.py?rev=1203836&r1=1203835&r2=1203836&view=diff
==============================================================================
--- incubator/tashi/branches/cmu/src/tashi/nodemanager/vmcontrol/qemu.py (original)
+++ incubator/tashi/branches/cmu/src/tashi/nodemanager/vmcontrol/qemu.py Fri Nov 18 21:03:23
2011
@@ -140,6 +140,13 @@ class Qemu(VmControlInterface):
 		"""Will return a dict of instances by vmId to the caller"""
 		return dict((x, self.controlledVMs[x].instance) for x in self.controlledVMs.keys())
 
+	def setInstance(self, instance):
+		"""Sets data in an instance object"""
+		vmId = instance.vmId
+		child = self.getChildFromPid(vmId)
+                child.instance = instance
+                self.saveChildInfo(child)
+
 	def matchSystemPids(self, controlledVMs):
 		"""This is run in a separate polling thread and it must do things that are thread safe"""
 		if self.nm is None:
@@ -301,7 +308,7 @@ class Qemu(VmControlInterface):
 		res = self.consumeAvailable(child)
 		os.write(child.monitorFd, command + "\n")
 		if (expectPrompt):
-			self.consumeUntil(child, command)
+			self.consumeUntil(child, command, timeout=timeout)
 			res = self.consumeUntil(child, "(qemu) ", timeout=timeout)
 		return res
 
@@ -339,8 +346,8 @@ class Qemu(VmControlInterface):
 		cmd = "head -n 1 /proc/meminfo"		
 		memoryStr = subprocess.Popen(cmd.split(), executable=cmd.split()[0], stdout=subprocess.PIPE).stdout.read().strip().split()
 		if (memoryStr[2] == "kB"):
-			# XXXstroucki should have parameter for reserved mem
-			host.memory = (int(memoryStr[1])/1024) - 512
+                        # XXXstroucki should have parameter for reserved mem
+                        host.memory = (int(memoryStr[1])/1024) - 512
 		else:
 			log.warning('Unable to determine amount of physical memory - reporting 0')
 			host.memory = 0
@@ -505,7 +512,8 @@ class Qemu(VmControlInterface):
 		child.monitor = os.fdopen(child.monitorFd)
 		self.saveChildInfo(child)
 		if (issueContinue):
-			self.enterCommand(child, "c")
+			#XXXstroucki: receiving a vm can take a long time
+			self.enterCommand(child, "c", timeout=None)
 	
 	def stopVm(self, vmId, target, stopFirst):
 		"""Universal function to stop a VM -- used by suspendVM, migrateVM """
@@ -515,7 +523,7 @@ class Qemu(VmControlInterface):
 		if (target):
 			retry = self.migrationRetries
 			while (retry > 0):
-				res = self.enterCommand(child, "migrate %s" % (target), timeout=self.migrateTimeout)
+				res = self.enterCommand(child, "migrate -i %s" % (target), timeout=self.migrateTimeout)
 				retry = retry - 1
 				if (res.find("migration failed") == -1):
 					retry = -1
@@ -562,6 +570,7 @@ class Qemu(VmControlInterface):
 		(vmId, cmd) = self.startVm(instance, "exec:zcat %s" % (fn))
 		child = self.getChildFromPid(vmId)
 		child.cmd = cmd
+		self.saveChildInfo(child)
 		return vmId
 	
 	def prepReceiveVm(self, instance, source):

Modified: incubator/tashi/branches/cmu/src/tashi/nodemanager/vmcontrol/vmcontrolinterface.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/cmu/src/tashi/nodemanager/vmcontrol/vmcontrolinterface.py?rev=1203836&r1=1203835&r2=1203836&view=diff
==============================================================================
--- incubator/tashi/branches/cmu/src/tashi/nodemanager/vmcontrol/vmcontrolinterface.py (original)
+++ incubator/tashi/branches/cmu/src/tashi/nodemanager/vmcontrol/vmcontrolinterface.py Fri
Nov 18 21:03:23 2011
@@ -31,6 +31,10 @@ class VmControlInterface(object):
         def getInstances(self):
                 """Will return a dict of instances by vmId to the caller"""
 		raise NotImplementedError
+
+        def setInstance(self, instance):
+                """Sets data in an instance object"""
+		raise NotImplementedError
 	
 	def instantiateVm(self, instance):
 		"""Takes an InstanceConfiguration, creates a VM based on it, 



Mime
View raw message