merge Amisha's changes
diff --git a/planetstack/core/plus/views.py b/planetstack/core/plus/views.py
index 6af7e7d..663b735 100644
--- a/planetstack/core/plus/views.py
+++ b/planetstack/core/plus/views.py
@@ -86,7 +86,8 @@
tenantSliceDetails['image']=userSliceTableFormatter(getImageInfo(user))
tenantSliceDetails['network']=userSliceTableFormatter(getNetworkInfo(user))
tenantSliceDetails['deploymentSites']=userSliceTableFormatter(getDeploymentSites())
- tenantSliceDetails['sites'] = userSliceTableFormatter(getTenantSitesInfo());
+ tenantSliceDetails['sites'] = userSliceTableFormatter(getTenantSitesInfo())
+ tenantSliceDetails['mountDataSets'] = userSliceTableFormatter(getMountDataSets())
return tenantSliceDetails
@@ -108,7 +109,8 @@
print "equal",sliver.node.site.name
sliceSite[sliver.node.site.name] = sliceSite.get(sliver.node.site.name,0) + 1
sliceImage = sliver.image.name
- userSliceInfo.append({'sliceName': sliceName,'sliceServiceClass': sliceServiceClass,'preferredImage':preferredImage, 'sliceSite':sliceSite,'sliceImage':sliceImage,'numOfSlivers':numSliver})
+ numSites = len(sliceSite)
+ userSliceInfo.append({'sliceName': sliceName,'sliceServiceClass': sliceServiceClass,'preferredImage':preferredImage,'numOfSites':numSites, 'sliceSite':sliceSite,'sliceImage':sliceImage,'numOfSlivers':numSliver})
return userSliceInfo
def getTenantSitesInfo():
@@ -133,12 +135,21 @@
return sliceInfo
def getImageInfo(user):
- imageList = Image.objects.all()
+ #imageList = Image.objects.all()
+ imageList = ['Fedora 16 LXC rev 1.3','Hadoop','MPI']
imageInfo = []
for imageEntry in imageList:
- imageInfo.append({'Image':imageEntry.name})
+ #imageInfo.append({'Image':imageEntry.name})
+ imageInfo.append({'Image':imageEntry})
return imageInfo
+def getMountDataSets():
+ dataSetList = ['GenBank','LSST','LHC','NOAA','Measurement Lab','Common Crawl']
+ dataSetInfo = []
+ for entry in dataSetList:
+ dataSetInfo.append({'DataSet':entry})
+ return dataSetInfo
+
def getNetworkInfo(user):
#networkList = Network.objects.all()
networkList = ['Private Only','Private and Publicly Routable']
@@ -328,27 +339,35 @@
def slice_decrease_slivers(user, siteList, slice, count, noAct=False):
sitesChanged = {}
-
+ sliverList ={}
if siteList:
siteNames = [site.name for site in siteList]
else:
siteNames = None
for sliver in slice.slivers.all():
- if (count <= 0):
- break
+ if(not siteNames) or (sliver.node.site.name in siteNames):
+ node = sliver.node
+ sliverList[sliver.name]=node.name
- node = sliver.node
- if (not siteNames) or (node.site.name in siteNames):
- print "deleting sliver", sliver, "at node", node.name, "of site", node.site.name
- if not noAct:
- sliver.delete()
- count = count -1
-
- sitesChanged[node.site.name] = sitesChanged.get(node.site.name,0) - 1
-
+ for key in sliverList:
+ if count>0:
+ sliver = Sliver.objects.filter(name=key)
+ sliver.delete()
+ print "deleting sliver",sliverList[key],"at node",sliver.node.name
+ count=count-1
+ sitesChanged[node.site.name] = sitesChanged.get(node.site.name,0) - 1
+
return sitesChanged
+class TenantDeleteSliceView(View):
+ def post(self,request):
+ sliceName = request.POST.get("sliceName",None)
+ slice = Slice.objects.get(name=sliceName)
+ print slice, slice.id
+ sliceToDel=Slice(name=sliceName, id=slice.id)
+ sliceToDel.delete()
+
class TenantAddOrRemoveSliverView(View):
""" Add or remove slivers from a Slice