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/07/11 21:25:53 UTC
svn commit: r1360409 -
/incubator/tashi/trunk/src/tashi/nodemanager/vmcontrol/qemu.py
Author: stroucki
Date: Wed Jul 11 21:25:52 2012
New Revision: 1360409
URL: http://svn.apache.org/viewvc?rev=1360409&view=rev
Log:
qemu: Address race condition on instantiation, where the cleanup
thread would remove a VM being born. Allow 5 seconds for the launch of
the kvm process.
Modified:
incubator/tashi/trunk/src/tashi/nodemanager/vmcontrol/qemu.py
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=1360409&r1=1360408&r2=1360409&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/nodemanager/vmcontrol/qemu.py (original)
+++ incubator/tashi/trunk/src/tashi/nodemanager/vmcontrol/qemu.py Wed Jul 11 21:25:52 2012
@@ -170,6 +170,17 @@ class Qemu(VmControlInterface):
for vmId in vmIds:
child = self.controlledVMs[vmId]
+
+ # check to see if the child was just started.
+ # Only try to check on it if startup was more
+ # than 5 seconds in the past
+ if "startTime" in child.__dict__:
+ if child.startTime + 5 < time.time():
+ del child.startTime
+ else:
+ log.info("Not processing vmId %d because it is newly started" % (vmId))
+ continue
+
instance = child.instance
name = instance.name
@@ -577,9 +588,15 @@ class Qemu(VmControlInterface):
child.ptyFile = None
child.vncPort = -1
child.instance.vmId = child.pid
+
+ # Add a token to this new child object so that
+ # we don't mistakenly clean up when matchHostPids
+ # runs and the child process hasn't exec'ed yet.
+ child.startTime = time.time()
+
self.__saveChildInfo(child)
- self.controlledVMs[child.pid] = child
log.info("Adding vmId %d" % (child.pid))
+ self.controlledVMs[child.pid] = child
return (child.pid, cmd)
def __getPtyInfo(self, child, issueContinue):