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/12 20:42:31 UTC
svn commit: r1349512 - in /incubator/tashi/trunk/src/tashi:
client/tashi-client.py clustermanager/clustermanagerservice.py
Author: stroucki
Date: Tue Jun 12 20:42:31 2012
New Revision: 1349512
URL: http://svn.apache.org/viewvc?rev=1349512&view=rev
Log:
tashi-client: fix syntax
tashi-client: add arguments for setHostState to convertArgs
clustermanagerservice: use hostId we get from the client
Modified:
incubator/tashi/trunk/src/tashi/client/tashi-client.py
incubator/tashi/trunk/src/tashi/clustermanager/clustermanagerservice.py
Modified: incubator/tashi/trunk/src/tashi/client/tashi-client.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/tashi/client/tashi-client.py?rev=1349512&r1=1349511&r2=1349512&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/client/tashi-client.py (original)
+++ incubator/tashi/trunk/src/tashi/client/tashi-client.py Tue Jun 12 20:42:31 2012
@@ -57,9 +57,9 @@ def checkHid(host):
try:
hostId = int(host)
except:
- for h in hosts
- if (h.name == host):
- hostId = h.id
+ for h in hosts:
+ if (h.name == host):
+ hostId = h.id
if (hostId is None):
raise ValueError("Unknown host %s" % (str(instance)))
@@ -301,6 +301,7 @@ convertArgs = {
'unregisterHost' : '[hostId]',
'getSlots' : '[cores, memory]',
'copyImage' : '[src, dst]',
+'setHostState' : '[host, state]',
}
# Descriptions
Modified: incubator/tashi/trunk/src/tashi/clustermanager/clustermanagerservice.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/tashi/clustermanager/clustermanagerservice.py?rev=1349512&r1=1349511&r2=1349512&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/clustermanager/clustermanagerservice.py (original)
+++ incubator/tashi/trunk/src/tashi/clustermanager/clustermanagerservice.py Tue Jun 12 20:42:31 2012
@@ -575,12 +575,8 @@ class ClusterManagerService(object):
if hostState is None:
return "%s is not a valid host state" % state
- else:
- hostList = [h for h in self.data.getHosts().itervalues() if h.id == hostId]
- if (len(hostList) != 1):
- raise TashiException(d={'errno':Errors.NoSuchHost, 'msg':'A host with name %s is not identifiable' % (host.name)})
- host.id = hostList[0].id
- host = self.data.acquireHost(host.id)
+
+ host = self.data.acquireHost(hostId)
try:
host.state = hostState
finally: