display count of ready slivers in tenant view
[plstackapi.git] / planetstack / core / xoslib / objects / sliceplus.py
index 94174b4..d3e618d 100644 (file)
@@ -19,6 +19,7 @@ class SlicePlus(Slice, PlusObjectMixin):
     def getSliceInfo(self, user=None):
         if not self._sliceInfo:
             used_sites = {}
+            ready_sites = {}
             used_deployments = {}
             sliverCount = 0
             sshCommands = []
@@ -33,6 +34,8 @@ class SlicePlus(Slice, PlusObjectMixin):
                     sshCommand = 'ssh -o "ProxyCommand ssh -q %s@%s" ubuntu@%s' % (sliver.instance_id, sliver.node.name, sliver.instance_name)
                     sshCommands.append(sshCommand);
 
+                    ready_sites[site.name] = ready_sites.get(site.name, 0) + 1
+
             users = {}
             for priv in SlicePrivilege.objects.filter(slice=self):
                 if not (priv.user.id in users.keys()):
@@ -51,6 +54,7 @@ class SlicePlus(Slice, PlusObjectMixin):
                     networkPorts = network.ports
 
             self._sliceInfo= {"sitesUsed": used_sites,
+                    "sitesReady": ready_sites,
                     "deploymentsUsed": used_deployments,
                     "sliverCount": sliverCount,
                     "siteCount": len(used_sites.keys()),
@@ -66,6 +70,14 @@ class SlicePlus(Slice, PlusObjectMixin):
 
         return self._sliceInfo
 
+    @property
+    def site_ready(self):
+        return self.getSliceInfo()["sitesReady"]
+
+    @site_ready.setter
+    def site_ready(self, value):
+        pass
+
     @property
     def site_allocation(self):
         return self._site_allocation