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/23 04:30:10 UTC
svn commit: r1292643 - in /incubator/tashi/branches/stroucki-registration:
./ src/tashi/client/ src/tashi/clustermanager/ src/tashi/clustermanager/data/
Author: stroucki
Date: Thu Feb 23 04:30:10 2012
New Revision: 1292643
URL: http://svn.apache.org/viewvc?rev=1292643&view=rev
Log:
update TODO
merge from trunk
Modified:
incubator/tashi/branches/stroucki-registration/ (props changed)
incubator/tashi/branches/stroucki-registration/Makefile
incubator/tashi/branches/stroucki-registration/TODO
incubator/tashi/branches/stroucki-registration/src/tashi/client/tashi-client.py
incubator/tashi/branches/stroucki-registration/src/tashi/clustermanager/clustermanagerservice.py
incubator/tashi/branches/stroucki-registration/src/tashi/clustermanager/data/datainterface.py
incubator/tashi/branches/stroucki-registration/src/tashi/clustermanager/data/ldapoverride.py
incubator/tashi/branches/stroucki-registration/src/tashi/clustermanager/data/pickled.py
Propchange: incubator/tashi/branches/stroucki-registration/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Feb 23 04:30:10 2012
@@ -1,4 +1,9 @@
/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
+/incubator/tashi/trunk:1241775-1292491
Modified: incubator/tashi/branches/stroucki-registration/Makefile
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/stroucki-registration/Makefile?rev=1292643&r1=1292642&r2=1292643&view=diff
==============================================================================
--- incubator/tashi/branches/stroucki-registration/Makefile (original)
+++ incubator/tashi/branches/stroucki-registration/Makefile Thu Feb 23 04:30:10 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/branches/stroucki-registration/TODO
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/stroucki-registration/TODO?rev=1292643&r1=1292642&r2=1292643&view=diff
==============================================================================
--- incubator/tashi/branches/stroucki-registration/TODO (original)
+++ incubator/tashi/branches/stroucki-registration/TODO Thu Feb 23 04:30:10 2012
@@ -1 +1,2 @@
-allow command line creation of hosts and networks
+allow command line creation of hosts and networks (and users possibly)
+allow command line deletion of hosts and networks (and users possibly)
Modified: incubator/tashi/branches/stroucki-registration/src/tashi/client/tashi-client.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/stroucki-registration/src/tashi/client/tashi-client.py?rev=1292643&r1=1292642&r2=1292643&view=diff
==============================================================================
--- incubator/tashi/branches/stroucki-registration/src/tashi/client/tashi-client.py (original)
+++ incubator/tashi/branches/stroucki-registration/src/tashi/client/tashi-client.py Thu Feb 23 04:30:10 2012
@@ -166,7 +166,7 @@ def getSlots(cores, memory):
continue
countbycores = int((h.cores - h.usedCores) / cores)
countbymemory = int((h.memory - h.usedMemory) / memory)
- count += min(countbycores, countbymemory)
+ count += max(0, min(countbycores, countbymemory))
print "%d" % (count),
print (lambda:"instances", lambda:"instance")[count == 1](),
Modified: incubator/tashi/branches/stroucki-registration/src/tashi/clustermanager/clustermanagerservice.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/stroucki-registration/src/tashi/clustermanager/clustermanagerservice.py?rev=1292643&r1=1292642&r2=1292643&view=diff
==============================================================================
--- incubator/tashi/branches/stroucki-registration/src/tashi/clustermanager/clustermanagerservice.py (original)
+++ incubator/tashi/branches/stroucki-registration/src/tashi/clustermanager/clustermanagerservice.py Thu Feb 23 04:30:10 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/branches/stroucki-registration/src/tashi/clustermanager/data/datainterface.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/stroucki-registration/src/tashi/clustermanager/data/datainterface.py?rev=1292643&r1=1292642&r2=1292643&view=diff
==============================================================================
--- incubator/tashi/branches/stroucki-registration/src/tashi/clustermanager/data/datainterface.py (original)
+++ incubator/tashi/branches/stroucki-registration/src/tashi/clustermanager/data/datainterface.py Thu Feb 23 04:30:10 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/branches/stroucki-registration/src/tashi/clustermanager/data/ldapoverride.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/stroucki-registration/src/tashi/clustermanager/data/ldapoverride.py?rev=1292643&r1=1292642&r2=1292643&view=diff
==============================================================================
--- incubator/tashi/branches/stroucki-registration/src/tashi/clustermanager/data/ldapoverride.py (original)
+++ incubator/tashi/branches/stroucki-registration/src/tashi/clustermanager/data/ldapoverride.py Thu Feb 23 04:30:10 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/branches/stroucki-registration/src/tashi/clustermanager/data/pickled.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/stroucki-registration/src/tashi/clustermanager/data/pickled.py?rev=1292643&r1=1292642&r2=1292643&view=diff
==============================================================================
--- incubator/tashi/branches/stroucki-registration/src/tashi/clustermanager/data/pickled.py (original)
+++ incubator/tashi/branches/stroucki-registration/src/tashi/clustermanager/data/pickled.py Thu Feb 23 04:30:10 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)