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/02/22 20:12:20 UTC
svn commit: r1292488 - in /incubator/tashi/trunk: ./ Makefile
src/tashi/clustermanager/clustermanagerservice.py
src/tashi/clustermanager/data/datainterface.py
src/tashi/clustermanager/data/ldapoverride.py
src/tashi/clustermanager/data/pickled.py
Author: stroucki
Date: Wed Feb 22 20:12:20 2012
New Revision: 1292488
URL: http://svn.apache.org/viewvc?rev=1292488&view=rev
Log:
Merge stroucki-irpbugs back into trunk (but I'm getting multiple branches now?)
Modified:
incubator/tashi/trunk/ (props changed)
incubator/tashi/trunk/Makefile
incubator/tashi/trunk/src/tashi/clustermanager/clustermanagerservice.py
incubator/tashi/trunk/src/tashi/clustermanager/data/datainterface.py
incubator/tashi/trunk/src/tashi/clustermanager/data/ldapoverride.py
incubator/tashi/trunk/src/tashi/clustermanager/data/pickled.py
Propchange: incubator/tashi/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Feb 22 20:12:20 2012
@@ -1,5 +1,8 @@
/incubator/tashi/branches/cmu:1178106-1187632
+/incubator/tashi/branches/stable:1241774-1245856
+/incubator/tashi/branches/stablefix:1203848-1241770
/incubator/tashi/branches/stroucki-accounting:1221525-1241770
/incubator/tashi/branches/stroucki-accounting/branches/stroucki-accounting:1221525-1235607
+/incubator/tashi/branches/stroucki-irpbugs:1245857-1292484
/incubator/tashi/branches/stroucki-slotsbug:1244839-1245041
/incubator/tashi/branches/zoni-dev/trunk:1034098-1177646
Modified: incubator/tashi/trunk/Makefile
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/Makefile?rev=1292488&r1=1292487&r2=1292488&view=diff
==============================================================================
--- incubator/tashi/trunk/Makefile (original)
+++ incubator/tashi/trunk/Makefile Wed Feb 22 20:12:20 2012
@@ -33,6 +33,7 @@ package: src DISCLAIMER INSTALL LICENSE
mkdir apache-tashi
cp -rp doc etc Makefile src DISCLAIMER INSTALL LICENSE NOTICE README apache-tashi/
find apache-tashi -type d -name ".svn"|xargs rm -rf
+ chgrp -R incubator apache-tashi
tar zcf apache-tashi.tar.gz apache-tashi
rm -rf apache-tashi
Modified: incubator/tashi/trunk/src/tashi/clustermanager/clustermanagerservice.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/tashi/clustermanager/clustermanagerservice.py?rev=1292488&r1=1292487&r2=1292488&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/clustermanager/clustermanagerservice.py (original)
+++ incubator/tashi/trunk/src/tashi/clustermanager/clustermanagerservice.py Wed Feb 22 20:12:20 2012
@@ -269,18 +269,19 @@ class ClusterManagerService(object):
# iterate through all VMs I believe are active
for instanceId in self.instanceLastContactTime.keys():
- # Don't query non-running VMs. eg. if a VM
- # is suspended, and has no host, then there's
- # no one to ask
- if instance.state != InstanceState.Running and \
- instance.state != InstanceState.Activating and \
- instance.state != InstanceState.Orphaned:
- continue
# XXXstroucki should lock instance here?
if (self.instanceLastContactTime[instanceId] < (self.__now() - self.allowDecayed)):
try:
instance = self.data.acquireInstance(instanceId)
+ # Don't query non-running VMs. eg. if a VM
+ # is suspended, and has no host, then there's
+ # no one to ask
+ if instance.state != InstanceState.Running and \
+ instance.state != InstanceState.Activating and \
+ instance.state != InstanceState.Orphaned:
+ self.data.releaseInstance(instanceId)
+ continue
except:
continue
Modified: incubator/tashi/trunk/src/tashi/clustermanager/data/datainterface.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/tashi/clustermanager/data/datainterface.py?rev=1292488&r1=1292487&r2=1292488&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/clustermanager/data/datainterface.py (original)
+++ incubator/tashi/trunk/src/tashi/clustermanager/data/datainterface.py Wed Feb 22 20:12:20 2012
@@ -45,6 +45,9 @@ class DataInterface(object):
def getHost(self, id):
raise NotImplementedError
+
+ def getImages(self):
+ raise NotImplementedError
def getInstances(self):
raise NotImplementedError
Modified: incubator/tashi/trunk/src/tashi/clustermanager/data/ldapoverride.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/tashi/clustermanager/data/ldapoverride.py?rev=1292488&r1=1292487&r2=1292488&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/clustermanager/data/ldapoverride.py (original)
+++ incubator/tashi/trunk/src/tashi/clustermanager/data/ldapoverride.py Wed Feb 22 20:12:20 2012
@@ -17,9 +17,12 @@
import subprocess
import time
+#XXXstroucki getImages requires os?
+import os
+from tashi.rpycservices.rpyctypes import Errors, Network, Host, User, Instance, TashiException, LocalImages, DiskConfiguration, NetworkConfiguration
+from tashi.util import stringPartition, boolean, instantiateImplementation, humanReadable
from tashi.rpycservices.rpyctypes import User
from tashi.clustermanager.data import DataInterface
-from tashi.util import instantiateImplementation
class LdapOverride(DataInterface):
def __init__(self, config):
@@ -31,6 +34,7 @@ class LdapOverride(DataInterface):
self.nameKey = config.get("LdapOverride", "nameKey")
self.idKey = config.get("LdapOverride", "idKey")
self.ldapCommand = config.get("LdapOverride", "ldapCommand")
+ self.dfs = instantiateImplementation(config.get("ClusterManager", "dfs"), config)
def registerInstance(self, instance):
return self.baseDataObject.registerInstance(instance)
@@ -68,6 +72,17 @@ class LdapOverride(DataInterface):
def getNetwork(self, id):
return self.baseDataObject.getNetwork(id)
+ def getImages(self):
+ count = 0
+ myList = []
+ for i in self.dfs.list("images"):
+ myFile = self.dfs.getLocalHandle("images/" + i)
+ if os.path.isfile(myFile):
+ image = LocalImages(d={'id':count, 'imageName':i, 'imageSize':humanReadable(self.dfs.stat(myFile)[6])})
+ myList.append(image)
+ count += 1
+ return myList
+
def fetchFromLdap(self):
now = time.time()
if (now - self.lastUserUpdate > self.fetchThreshold):
Modified: incubator/tashi/trunk/src/tashi/clustermanager/data/pickled.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/tashi/clustermanager/data/pickled.py?rev=1292488&r1=1292487&r2=1292488&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/clustermanager/data/pickled.py (original)
+++ incubator/tashi/trunk/src/tashi/clustermanager/data/pickled.py Wed Feb 22 20:12:20 2012
@@ -39,14 +39,14 @@ class Pickled(FromConfig):
def cleanInstances(self):
ci = {}
- for i in self.instances.itervalues():
+ for ignore, i in self.instances.items():
i2 = Instance(d=i.__dict__)
ci[i2.id] = i2
return ci
def cleanHosts(self):
ch = {}
- for h in self.hosts.itervalues():
+ for ignore, h in self.hosts.items():
h2 = Host(d=h.__dict__)
ch[h2.id] = h2
return ch
@@ -67,11 +67,11 @@ class Pickled(FromConfig):
self.instances = instances
self.networks = networks
self.users = users
- for i in self.instances.itervalues():
+ for ignore, i in self.instances.items():
if (i.id >= self.maxInstanceId):
self.maxInstanceId = i.id + 1
i._lock = threading.Lock()
self.lockNames[i._lock] = "i%d" % (i.id)
- for h in self.hosts.itervalues():
+ for ignore, h in self.hosts.items():
h._lock = threading.Lock()
self.lockNames[h._lock] = "h%d" % (h.id)