add blessed flavors and service classes to tenant view object
Scott Baker [Mon, 12 Jan 2015 21:37:01 +0000 (13:37 -0800)]
planetstack/core/xoslib/methods/tenantview.py

index dbf6ddc..596c082 100644 (file)
@@ -32,17 +32,32 @@ def getTenantViewDict(user):
         if good:
             blessed_images.append(image)
 
+    blessed_flavors=[]
+    for flavor in Flavor.objects.all():
+        good = False
+        for deployment in flavor.deployments.all():
+            if deployment.name in BLESSED_DEPLOYMENTS:
+                 good=True
+        if good:
+            blessed_flavors.append(flavor)
+
     volumes=[]
     for volume in Volume.objects.all():
         if not volume.private:\r
             volumes.append(volume)
 
+    blessed_service_classes = [ServiceClass.objects.get(name="Best Effort")]
+
     return {"id": 0,
             "blessed_deployment_names": BLESSED_DEPLOYMENTS,
             "blessed_site_names": [site.name for site in blessed_sites],
             "blessed_sites": [site.id for site in blessed_sites],
             "blessed_image_names": [image.name for image in blessed_images],
             "blessed_images": [image.id for image in blessed_images],
+            "blessed_flavor_names": [flavor.name for flavor in blessed_flavors],
+            "blessed_flavors": [flavor.id for flavor in blessed_flavors],
+            "blessed_service_class_names": [serviceclass.name for serviceclass in blessed_service_classes],
+            "blessed_service_classes": [serviceclass.id for serviceclass in blessed_service_classes],
             "public_volume_names": [volume.name for volume in volumes],
             "public_volumes": [volume.id for volume in volumes],
             "current_user_site_id": user.site.id,