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 2011/11/18 20:48:09 UTC
svn commit: r1203826 - in /incubator/tashi/trunk/src/tashi:
clustermanager/clustermanagerservice.py nodemanager/nodemanagerservice.py
nodemanager/vmcontrol/qemu.py
Author: stroucki
Date: Fri Nov 18 20:48:09 2011
New Revision: 1203826
URL: http://svn.apache.org/viewvc?rev=1203826&view=rev
Log:
qemu.py: receiving a VM can take a long time, so don't timeout before
getting a prompt back.
use migrate -i to properly handle COW disks.
nodemanagerservice.py: don't cause a network event if VM state is unchanged.
this should eliminate much chatter.
clustermanagerservice.py: don't cause a network event if VM state is unchanged.
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=1203826&r1=1203825&r2=1203826&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/clustermanager/clustermanagerservice.py (original)
+++ incubator/tashi/trunk/src/tashi/clustermanager/clustermanagerservice.py Fri Nov 18 20:48:09 2011
@@ -74,7 +74,12 @@ class ClusterManagerService(object):
def stateTransition(self, instance, old, cur):
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):
+ # don't do anything if we're already at current state
+ return
+
instance.state = cur
+ # pass something down to the NM?
def __now(self):
return time.time()
Modified: incubator/tashi/trunk/src/tashi/nodemanager/nodemanagerservice.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/tashi/nodemanager/nodemanagerservice.py?rev=1203826&r1=1203825&r2=1203826&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/nodemanager/nodemanagerservice.py (original)
+++ incubator/tashi/trunk/src/tashi/nodemanager/nodemanagerservice.py Fri Nov 18 20:48:09 2011
@@ -91,6 +91,12 @@ 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
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=1203826&r1=1203825&r2=1203826&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/nodemanager/vmcontrol/qemu.py (original)
+++ incubator/tashi/trunk/src/tashi/nodemanager/vmcontrol/qemu.py Fri Nov 18 20:48:09 2011
@@ -301,7 +301,8 @@ class Qemu(VmControlInterface):
res = self.consumeAvailable(child)
os.write(child.monitorFd, command + "\n")
if (expectPrompt):
- self.consumeUntil(child, command)
+ # XXXstroucki: receiving a vm can take a long time
+ self.consumeUntil(child, command, timeout=timeout)
res = self.consumeUntil(child, "(qemu) ", timeout=timeout)
return res
@@ -505,7 +506,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 +517,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