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 st...@apache.org on 2012/06/11 21:52:11 UTC
svn commit: r1349038 - in /incubator/tashi/trunk/src/tashi:
clustermanager/clustermanagerservice.py nodemanager/nodemanagerservice.py
nodemanager/vmcontrol/qemu.py
Author: stroucki
Date: Mon Jun 11 21:52:10 2012
New Revision: 1349038
URL: http://svn.apache.org/viewvc?rev=1349038&view=rev
Log:
clustermanagerservice: in vmupdate, handle MigrateTrans->Exited transition explicitly
nodemanagerservice: name my threads
qemu: use self.controlledVMs in matchHostPids thread
qemu: let NM know of an exit regardless whether it was migrating out
Modified:
incubator/tashi/trunk/src/tashi/clustermanager/clustermanagerservice.py
incubator/tashi/trunk/src/tashi/nodemanager/nodemanagerservice.py
incubator/tashi/trunk/src/tashi/nodemanager/vmcontrol/qemu.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=1349038&r1=1349037&r2=1349038&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/clustermanager/clustermanagerservice.py (original)
+++ incubator/tashi/trunk/src/tashi/clustermanager/clustermanagerservice.py Mon Jun 11 21:52:10 2012
@@ -642,18 +642,24 @@ class ClusterManagerService(object):
if (instance.state == InstanceState.Exited):
# determine why a VM has exited
hostname = self.data.getHost(oldInstance.hostId).name
+
if (oldInstance.state not in [InstanceState.ShuttingDown, InstanceState.Destroying, InstanceState.Suspending]):
self.log.warning('Unexpected exit on %s of instance %s (vmId %d)' % (hostname, oldInstance.name, oldInstance.vmId))
+
if (oldInstance.state == InstanceState.Suspending):
self.__stateTransition(oldInstance, InstanceState.Suspending, InstanceState.Suspended)
oldInstance.hostId = None
oldInstance.vmId = None
self.data.releaseInstance(oldInstance)
+
+ if (oldInstance.state == InstanceState.MigrateTrans):
+ # Just await update from target host
+ self.data.releaseInstance(oldInstance)
+
else:
del self.instanceLastContactTime[oldInstance.id]
- self.log.worning("removing %s" % oldInstance)
self.data.removeInstance(oldInstance)
- self.log.warning("done remove %s" % oldInstance)
+
else:
if (instance.state):
# XXXstroucki does this matter?
Modified: incubator/tashi/trunk/src/tashi/nodemanager/nodemanagerservice.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/tashi/nodemanager/nodemanagerservice.py?rev=1349038&r1=1349037&r2=1349038&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/nodemanager/nodemanagerservice.py (original)
+++ incubator/tashi/trunk/src/tashi/nodemanager/nodemanagerservice.py Mon Jun 11 21:52:10 2012
@@ -78,8 +78,8 @@ class NodeManagerService(object):
self.id = self.cm.registerNodeManager(self.host, self.instances.values())
# start service threads
- threading.Thread(target=self.__registerWithClusterManager).start()
- threading.Thread(target=self.__statsThread).start()
+ threading.Thread(name="registerWithClusterManager", target=self.__registerWithClusterManager).start()
+ threading.Thread(name="statsThread", target=self.__statsThread).start()
def __initAccounting(self):
self.accountBuffer = []
Modified: incubator/tashi/trunk/src/tashi/nodemanager/vmcontrol/qemu.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/tashi/nodemanager/vmcontrol/qemu.py?rev=1349038&r1=1349037&r2=1349038&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/nodemanager/vmcontrol/qemu.py (original)
+++ incubator/tashi/trunk/src/tashi/nodemanager/vmcontrol/qemu.py Mon Jun 11 21:52:10 2012
@@ -162,14 +162,14 @@ 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 __matchHostPids(self, controlledVMs):
+ def __matchHostPids(self):
"""This is run in a separate polling thread and it must do things that are thread safe"""
- vmIds = controlledVMs.keys()
+ vmIds = self.controlledVMs.keys()
pids = self.__getHostPids()
for vmId in vmIds:
- child = controlledVMs[vmId]
+ child = self.controlledVMs[vmId]
instance = child.instance
name = instance.name
@@ -180,9 +180,9 @@ class Qemu(VmControlInterface):
# remove info file
os.unlink(self.INFO_DIR + "/%d"%(vmId))
- # XXXstroucki why not use self.controlledVMs
- # argument, so why modify this fn's formal?
- del controlledVMs[vmId]
+ # XXXstroucki python should handle
+ # locking here (?)
+ del self.controlledVMs[vmId]
# remove any stats (appropriate?)
try:
@@ -230,8 +230,11 @@ class Qemu(VmControlInterface):
# let the NM know
try:
- if (not child.migratingOut):
- self.nm.vmStateChange(vmId, None, InstanceState.Exited)
+ # XXXstroucki: we don't want to treat
+ # the source VM of a migration exiting
+ # as an actual
+ # exit, but the NM should probably know.
+ self.nm.vmStateChange(vmId, None, InstanceState.Exited)
except Exception:
log.exception("vmStateChange failed for VM %s" % (name))
else:
@@ -290,7 +293,7 @@ class Qemu(VmControlInterface):
while True:
try:
time.sleep(self.POLL_DELAY)
- self.__matchHostPids(self.controlledVMs)
+ self.__matchHostPids()
except:
log.exception("Exception in poolVMsLoop")