Changed DeploymentNetwork to Deployment, adjusted initial_json to include service class json, modified admin screens to only show appropriate topLevel objects (with the exception of Key), added in showAll var to make it easier when developing to showAll the objects in Admin. Removed Django_Evolution objects from admin interface.
diff --git a/planetstack/core/admin.py b/planetstack/core/admin.py
index 6e7bbb6..9c7cc54 100644
--- a/planetstack/core/admin.py
+++ b/planetstack/core/admin.py
@@ -11,6 +11,7 @@
from django.contrib.auth.forms import ReadOnlyPasswordHashField
from django.contrib.auth.signals import user_logged_in
from django.utils import timezone
+import django_evolution
class ReadonlyTabularInline(admin.TabularInline):
@@ -104,7 +105,7 @@
list_display = ('role_type',)
-class DeploymentNetworkAdminForm(forms.ModelForm):
+class DeploymentAdminForm(forms.ModelForm):
sites = forms.ModelMultipleChoiceField(
queryset=Site.objects.all(),
required=False,
@@ -113,16 +114,16 @@
)
)
class Meta:
- model = DeploymentNetwork
+ model = Deployment
def __init__(self, *args, **kwargs):
- super(DeploymentNetworkAdminForm, self).__init__(*args, **kwargs)
+ super(DeploymentAdminForm, self).__init__(*args, **kwargs)
if self.instance and self.instance.pk:
self.fields['sites'].initial = self.instance.sites.all()
def save(self, commit=True):
- deploymentNetwork = super(DeploymentNetworkAdminForm, self).save(commit=False)
+ deploymentNetwork = super(DeploymentAdminForm, self).save(commit=False)
if commit:
deploymentNetwork.save()
@@ -132,8 +133,8 @@
return deploymentNetwork
-class DeploymentNetworkAdmin(PlanetStackBaseAdmin):
- form = DeploymentNetworkAdminForm
+class DeploymentAdmin(PlanetStackBaseAdmin):
+ form = DeploymentAdminForm
inlines = [NodeInline,SliverInline]
def get_formsets(self, request, obj=None):
@@ -302,8 +303,8 @@
fields = ['image_id', 'name', 'disk_format', 'container_format']
class NodeAdmin(admin.ModelAdmin):
- list_display = ('name', 'site', 'deploymentNetwork')
- list_filter = ('deploymentNetwork',)
+ list_display = ('name', 'site', 'deployment')
+ list_filter = ('deployment',)
class SliverForm(forms.ModelForm):
@@ -583,17 +584,30 @@
# unregister the Group model from admin.
admin.site.unregister(Group)
+#Do not show django evolution in the admin interface
+from django_evolution.models import Version, Evolution
+admin.site.unregister(Version)
+admin.site.unregister(Evolution)
+
+
+# When debugging it is often easier to see all the classes, but for regular use
+# only the top-levels should be displayed
+showAll = False
+
+admin.site.register(Deployment, DeploymentAdmin)
admin.site.register(Site, SiteAdmin)
-admin.site.register(SitePrivilege, SitePrivilegeAdmin)
admin.site.register(Slice, SliceAdmin)
-admin.site.register(SliceMembership, SliceMembershipAdmin)
#admin.site.register(Subnet)
-admin.site.register(Image, ImageAdmin)
-admin.site.register(Node, NodeAdmin)
-admin.site.register(Sliver, SliverAdmin)
admin.site.register(Key, KeyAdmin)
-admin.site.register(Role, RoleAdmin)
-admin.site.register(DeploymentNetwork, DeploymentNetworkAdmin)
-admin.site.register(ServiceClass, ServiceClassAdmin)
-admin.site.register(Reservation, ReservationAdmin)
+
+
+if showAll:
+ admin.site.register(Node, NodeAdmin)
+ admin.site.register(SliceMembership, SliceMembershipAdmin)
+ admin.site.register(SitePrivilege, SitePrivilegeAdmin)
+ admin.site.register(Role, RoleAdmin)
+ admin.site.register(Sliver, SliverAdmin)
+ admin.site.register(ServiceClass, ServiceClassAdmin)
+ admin.site.register(Reservation, ReservationAdmin)
+ admin.site.register(Image, ImageAdmin)
diff --git a/planetstack/core/api/deployment_networks.py b/planetstack/core/api/deployment_networks.py
index fcd2145..ee1f68e 100644
--- a/planetstack/core/api/deployment_networks.py
+++ b/planetstack/core/api/deployment_networks.py
@@ -1,16 +1,16 @@
from types import StringTypes
-from core.models import DeploymentNetwork
+from core.models import Deployment
from django.contrib.auth import authenticate
def _get_deployment_networks(filter):
if isinstance(filter, StringTypes) and filter.isdigit():
filter = int(filter)
if isinstance(filter, int):
- deployment_networks = DeploymentNetwork.objects.filter(id=filter)
+ deployment_networks = Deployment.objects.filter(id=filter)
elif isinstance(filter, StringTypes):
- deployment_networks = DeploymentNetwork.objects.filter(name=filter)
+ deployment_networks = Deployment.objects.filter(name=filter)
elif isinstance(filter, dict):
- deployment_networks = DeploymentNetwork.objects.filter(**filter)
+ deployment_networks = Deployment.objects.filter(**filter)
else:
deployment_networks = []
return deployment_networks
@@ -18,7 +18,7 @@
def add_deployment_network(auth, name):
user = authenticate(username=auth.get('username'),
password=auth.get('password'))
- deployment = DeploymentNetwork(name=name)
+ deployment = Deployment(name=name)
deployment.save()
return deployment
diff --git a/planetstack/core/fixtures/initial_data.json b/planetstack/core/fixtures/initial_data.json
index 638b00d..a126e8f 100644
--- a/planetstack/core/fixtures/initial_data.json
+++ b/planetstack/core/fixtures/initial_data.json
@@ -1,7 +1,7 @@
[
{
"pk": 1,
- "model": "core.deploymentnetwork",
+ "model": "core.deployment",
"fields": {
"updated": "2013-04-03T22:57:09.331Z",
"name": "VICCI",
@@ -10,7 +10,7 @@
},
{
"pk": 2,
- "model": "core.deploymentnetwork",
+ "model": "core.deployment",
"fields": {
"updated": "2013-04-03T22:57:15.013Z",
"name": "VINI",
@@ -19,7 +19,7 @@
},
{
"pk": 3,
- "model": "core.deploymentnetwork",
+ "model": "core.deployment",
"fields": {
"updated": "2013-04-03T22:57:23.015Z",
"name": "PlanetLab Classic",
@@ -28,7 +28,7 @@
},
{
"pk": 4,
- "model": "core.deploymentnetwork",
+ "model": "core.deployment",
"fields": {
"updated": "2013-04-03T22:57:29.569Z",
"name": "GENI",
@@ -163,5 +163,164 @@
"deployments": [],
"abbreviated_name": ""
}
+},
+{
+ "pk": 1,
+ "model": "core.user",
+ "fields": {
+ "firstname": "PA",
+ "user_url": null,
+ "lastname": "DMIN",
+ "is_active": true,
+ "site": null,
+ "phone": null,
+ "kuser_id": null,
+ "is_staff": true,
+ "last_login": "2013-05-28T00:10:27.088Z",
+ "key": null,
+ "timezone": "America/New_York",
+ "is_admin": true,
+ "password": "pbkdf2_sha256$10000$uMW3Svx8sYju$Olv9L2iY9WX+eUBsEHtcArU+Jc8P3eLUqt643gb6wVU=",
+ "email": "padmin@vicci.org"
+ }
+},
+{
+ "pk": 1,
+ "model": "core.serviceclass",
+ "fields": {
+ "updated": "2013-05-10T23:30:52.931Z",
+ "membershipFee": 0,
+ "membershipFeeMonths": 0,
+ "created": "2013-05-10T23:30:52.931Z",
+ "upgradeFrom": [
+ 2,
+ 3
+ ],
+ "commitment": 0,
+ "name": "Best Effort",
+ "upgradeRequiresApproval": false,
+ "description": "Best Effort"
+ }
+},
+{
+ "pk": 2,
+ "model": "core.serviceclass",
+ "fields": {
+ "updated": "2013-05-10T23:35:51.694Z",
+ "membershipFee": 100,
+ "membershipFeeMonths": 1,
+ "created": "2013-05-10T23:33:24.930Z",
+ "upgradeFrom": [
+ 1,
+ 3
+ ],
+ "commitment": 365,
+ "name": "Silver",
+ "upgradeRequiresApproval": false,
+ "description": "Silver"
+ }
+},
+{
+ "pk": 3,
+ "model": "core.serviceclass",
+ "fields": {
+ "updated": "2013-05-10T23:34:01.320Z",
+ "membershipFee": 18000,
+ "membershipFeeMonths": 12,
+ "created": "2013-05-10T23:34:01.320Z",
+ "upgradeFrom": [
+ 1,
+ 2
+ ],
+ "commitment": 365,
+ "name": "Gold",
+ "upgradeRequiresApproval": false,
+ "description": "Gold"
+ }
+},
+{
+ "pk": 1,
+ "model": "core.serviceresource",
+ "fields": {
+ "updated": "2013-05-10T23:44:50.862Z",
+ "name": "Cycles",
+ "bucketMaxSize": 0,
+ "created": "2013-05-10T23:37:09.312Z",
+ "serviceClass": 1,
+ "maxUnitsDeployment": 0,
+ "bucketInRate": 0,
+ "cost": 7,
+ "calendarReservable": false,
+ "maxDuration": 0,
+ "maxUnitsNode": 0
+ }
+},
+{
+ "pk": 2,
+ "model": "core.serviceresource",
+ "fields": {
+ "updated": "2013-05-10T23:44:39.936Z",
+ "name": "Cycles",
+ "bucketMaxSize": 0,
+ "created": "2013-05-10T23:44:39.936Z",
+ "serviceClass": 2,
+ "maxUnitsDeployment": 0,
+ "bucketInRate": 0,
+ "cost": 7,
+ "calendarReservable": false,
+ "maxDuration": 0,
+ "maxUnitsNode": 0
+ }
+},
+{
+ "pk": 3,
+ "model": "core.serviceresource",
+ "fields": {
+ "updated": "2013-05-10T23:45:16.137Z",
+ "name": "Cycles",
+ "bucketMaxSize": 0,
+ "created": "2013-05-10T23:45:16.137Z",
+ "serviceClass": 3,
+ "maxUnitsDeployment": 0,
+ "bucketInRate": 0,
+ "cost": 7,
+ "calendarReservable": false,
+ "maxDuration": 0,
+ "maxUnitsNode": 0
+ }
+},
+{
+ "pk": 4,
+ "model": "core.serviceresource",
+ "fields": {
+ "updated": "2013-05-10T23:47:39.033Z",
+ "name": "numberCores",
+ "bucketMaxSize": 210,
+ "created": "2013-05-10T23:46:33.201Z",
+ "serviceClass": 2,
+ "maxUnitsDeployment": 210,
+ "bucketInRate": 10,
+ "cost": 7,
+ "calendarReservable": true,
+ "maxDuration": 168,
+ "maxUnitsNode": 6
+ }
+},
+{
+ "pk": 5,
+ "model": "core.serviceresource",
+ "fields": {
+ "updated": "2013-05-10T23:47:31.771Z",
+ "name": "numberCores",
+ "bucketMaxSize": 0,
+ "created": "2013-05-10T23:47:31.770Z",
+ "serviceClass": 3,
+ "maxUnitsDeployment": 210,
+ "bucketInRate": 0,
+ "cost": 0,
+ "calendarReservable": true,
+ "maxDuration": 8760,
+ "maxUnitsNode": 6
+ }
}
]
diff --git a/planetstack/core/models/__init__.py b/planetstack/core/models/__init__.py
index 56a67ba..90bb089 100644
--- a/planetstack/core/models/__init__.py
+++ b/planetstack/core/models/__init__.py
@@ -1,5 +1,5 @@
from .plcorebase import PlCoreBase
-from .deploymentnetwork import DeploymentNetwork
+from .deployment import Deployment
from .site import Site
from .site import SitePrivilege
from .image import Image
diff --git a/planetstack/core/models/deployment.py b/planetstack/core/models/deployment.py
index 4068ee9..d38115f 100644
--- a/planetstack/core/models/deployment.py
+++ b/planetstack/core/models/deployment.py
@@ -4,8 +4,8 @@
# Create your models here.
-class DeploymentNetwork(PlCoreBase):
- name = models.CharField(max_length=200, unique=True, help_text="Name of the Deployment Network")
+class Deployment(PlCoreBase):
+ name = models.CharField(max_length=200, unique=True, help_text="Name of the Deployment")
def __unicode__(self): return u'%s' % (self.name)
diff --git a/planetstack/core/models/node.py b/planetstack/core/models/node.py
index a249628..fcc3a6a 100644
--- a/planetstack/core/models/node.py
+++ b/planetstack/core/models/node.py
@@ -2,13 +2,13 @@
from django.db import models
from core.models import PlCoreBase
from core.models import Site
-from core.models import DeploymentNetwork
+from core.models import Deployment
# Create your models here.
class Node(PlCoreBase):
name = models.CharField(max_length=200, unique=True, help_text="Name of the Node")
site = models.ForeignKey(Site, related_name='nodes')
- deploymentNetwork = models.ForeignKey(DeploymentNetwork, related_name='nodes')
+ deployment = models.ForeignKey(Deployment, related_name='nodes')
def __unicode__(self): return u'%s' % (self.name)
diff --git a/planetstack/core/models/serviceclass.py b/planetstack/core/models/serviceclass.py
index aa6b75d..ce3eaee 100644
--- a/planetstack/core/models/serviceclass.py
+++ b/planetstack/core/models/serviceclass.py
@@ -2,7 +2,7 @@
from django.db import models
from core.models import PlCoreBase
from core.models import Site
-from core.models import DeploymentNetwork
+from core.models import Deployment
# Create your models here.
diff --git a/planetstack/core/models/serviceresource.py b/planetstack/core/models/serviceresource.py
index 3b25ffe..e849425 100644
--- a/planetstack/core/models/serviceresource.py
+++ b/planetstack/core/models/serviceresource.py
@@ -2,7 +2,7 @@
from django.db import models
from core.models import PlCoreBase
from core.models import Site
-from core.models import DeploymentNetwork
+from core.models import Deployment
from core.models import ServiceClass
# Create your models here.
diff --git a/planetstack/core/models/site.py b/planetstack/core/models/site.py
index 8626a0d..db4b1ef 100644
--- a/planetstack/core/models/site.py
+++ b/planetstack/core/models/site.py
@@ -1,7 +1,7 @@
import os
from django.db import models
from core.models import PlCoreBase
-from core.models import DeploymentNetwork
+from core.models import Deployment
class Site(PlCoreBase):
@@ -15,7 +15,7 @@
is_public = models.BooleanField(default=True, help_text="Indicates the visibility of this site to other members")
abbreviated_name = models.CharField(max_length=80)
- deployments = models.ManyToManyField(DeploymentNetwork, blank=True, related_name='sites')
+ deployments = models.ManyToManyField(Deployment, blank=True, related_name='sites')
def __unicode__(self): return u'%s' % (self.name)
diff --git a/planetstack/core/models/slice.py b/planetstack/core/models/slice.py
index c5edddb..cc7dcce 100644
--- a/planetstack/core/models/slice.py
+++ b/planetstack/core/models/slice.py
@@ -4,7 +4,7 @@
from core.models import Site
from core.models import User
from core.models import Role
-from core.models import DeploymentNetwork
+from core.models import Deployment
from core.models import ServiceClass
# Create your models here.
diff --git a/planetstack/core/models/sliver.py b/planetstack/core/models/sliver.py
index ff074a6..03fa1d8 100644
--- a/planetstack/core/models/sliver.py
+++ b/planetstack/core/models/sliver.py
@@ -7,7 +7,7 @@
from core.models import Slice
from core.models import Node
from core.models import Site
-from core.models import DeploymentNetwork
+from core.models import Deployment
# Create your models here.
class Sliver(PlCoreBase):
@@ -19,7 +19,7 @@
key = models.ForeignKey(Key, related_name='slivers')
slice = models.ForeignKey(Slice, related_name='slivers')
node = models.ForeignKey(Node, related_name='slivers')
- deploymentNetwork = models.ForeignKey(DeploymentNetwork, verbose_name='deployment', related_name='sliver_deploymentNetwork')
+ deploymentNetwork = models.ForeignKey(Deployment, verbose_name='deployment', related_name='sliver_deploymentNetwork')
numberCores = models.IntegerField(verbose_name="Number of Cores", help_text="Number of cores for sliver", default=0)
diff --git a/planetstack/core/serializers.py b/planetstack/core/serializers.py
index bc4dd01..447bac4 100644
--- a/planetstack/core/serializers.py
+++ b/planetstack/core/serializers.py
@@ -123,13 +123,13 @@
'site',
'role')
-class DeploymentNetworkSerializer(serializers.HyperlinkedModelSerializer):
+class DeploymentSerializer(serializers.HyperlinkedModelSerializer):
# HyperlinkedModelSerializer doesn't include the id by default
id = serializers.Field()
sites = serializers.HyperlinkedRelatedField(view_name='deploymentnetwork-detail')
class Meta:
- model = DeploymentNetwork
+ model = Deployment
fields = ('id',
'name',
'sites'
@@ -189,7 +189,7 @@
SliceMembership: SliceMembershipSerializer,
Node: NodeSerializer,
Sliver: SliverSerializer,
- DeploymentNetwork: DeploymentNetworkSerializer,
+ Deployment: DeploymentSerializer,
Image: ImageSerializer,
None: None,
}
diff --git a/planetstack/core/views/deployment_networks.py b/planetstack/core/views/deployment_networks.py
index 63220a4..ef569ac 100644
--- a/planetstack/core/views/deployment_networks.py
+++ b/planetstack/core/views/deployment_networks.py
@@ -4,11 +4,11 @@
from rest_framework import status
from core.api.deployment_networks import add_deployment_network, delete_deployment_network, get_deployment_networks
-from core.serializers import DeploymentNetworkSerializer
+from core.serializers import DeploymentSerializer
from util.request import parse_request
-class DeploymentNetworkListCreate(APIView):
+class DeploymentListCreate(APIView):
"""
List all deployment networks or create a new role.
"""
@@ -20,15 +20,15 @@
elif 'deploymentNetwork' in data:
deployment = add_deployment_network(data['auth'], data['deploymentNetwork'].get('name'))
- serializer = DeploymentNetworkSerializer(deployment)
+ serializer = DeploymentSerializer(deployment)
return Response(serializer.data, status=status.HTTP_201_CREATED)
else:
deployment_networks = get_deployment_networks(data['auth'])
- serializer = DeploymentNetworkSerializer(deployment_networks, many=True)
+ serializer = DeploymentSerializer(deployment_networks, many=True)
return Response(serializer.data)
-class DeploymentNetworkRetrieveUpdateDestroy(APIView):
+class DeploymentRetrieveUpdateDestroy(APIView):
"""
Retrieve, update or delete a deployment network
"""
@@ -41,7 +41,7 @@
deployment_networks = get_deployment_networks(data['auth'], pk)
if not deployment_networks:
return Response(status=status.HTTP_404_NOT_FOUND)
- serializer = DeploymentNetworkSerializer(deployment_networks[0])
+ serializer = DeploymentSerializer(deployment_networks[0])
return Response(serializer.data)
def put(self, request, pk, format=None):
diff --git a/planetstack/openstack/manager.py b/planetstack/openstack/manager.py
index b4697ce..4ddd7f6 100644
--- a/planetstack/openstack/manager.py
+++ b/planetstack/openstack/manager.py
@@ -1,5 +1,5 @@
import os
-os.environ.setdefault("DJANGO_SETTINGS_MODULE", "planetstack.settings")
+#os.environ.setdefault("DJANGO_SETTINGS_MODULE", "planetstack.settings")
import string
import random
@@ -256,7 +256,7 @@
if 'viccidev10' not in node.name:
nodes_dict[node.name] = node
- deployment = DeploymentNetwork.objects.filter(name='VICCI')[0]
+ deployment = Deployment.objects.filter(name='VICCI')[0]
login_bases = ['princeton', 'stanford', 'gt', 'uw', 'mpisws']
sites = Site.objects.filter(login_base__in=login_bases)
# collect nova nodes:
diff --git a/planetstack/planetstack/settings.py b/planetstack/planetstack/settings.py
index 29e6285..fc56262 100644
--- a/planetstack/planetstack/settings.py
+++ b/planetstack/planetstack/settings.py
@@ -131,8 +131,8 @@
'django.contrib.admindocs',
'rest_framework',
'django_extensions',
- 'core',
'django_evolution',
+ 'core',
)
# A sample logging configuration. The only tangible logging
diff --git a/planetstack/planetstack/urls.py b/planetstack/planetstack/urls.py
index dbe9f49..3b2e128 100644
--- a/planetstack/planetstack/urls.py
+++ b/planetstack/planetstack/urls.py
@@ -10,7 +10,7 @@
from core.views.slice_memberships import SliceMembershipListCreate, SliceMembershipRetrieveUpdateDestroy
from core.views.slivers import SliverListCreate, SliverRetrieveUpdateDestroy
from core.views.keys import KeyListCreate, KeyRetrieveUpdateDestroy
-from core.views.deployment_networks import DeploymentNetworkListCreate, DeploymentNetworkRetrieveUpdateDestroy
+from core.views.deployment_networks import DeploymentListCreate, DeploymentRetrieveUpdateDestroy
from core.views.images import ImageListCreate, ImageRetrieveUpdateDestroy
from core.views.nodes import NodeListCreate, NodeRetrieveUpdateDestroy
from core.models import Site
@@ -59,8 +59,8 @@
url(r'^plstackapi/nodes/$', NodeListCreate.as_view(), name='node-list'),
url(r'^plstackapi/nodes/(?P<pk>[a-zA-Z0-9_\-]+)/$', NodeRetrieveUpdateDestroy.as_view(), name='node-detail'),
- url(r'^plstackapi/deploymentnetworks/$', DeploymentNetworkListCreate.as_view(), name='deploymentnetwork-list'),
- url(r'^plstackapi/deploymentnetworks/(?P<pk>[a-zA-Z0-9\-]+)/$', DeploymentNetworkRetrieveUpdateDestroy.as_view(), name='deploymentnetwork-detail'),
+ url(r'^plstackapi/deploymentnetworks/$', DeploymentListCreate.as_view(), name='deploymentnetwork-list'),
+ url(r'^plstackapi/deploymentnetworks/(?P<pk>[a-zA-Z0-9\-]+)/$', DeploymentRetrieveUpdateDestroy.as_view(), name='deploymentnetwork-detail'),
url(r'^plstackapi/images/$', ImageListCreate.as_view(), name='image-list'),
url(r'^plstackapi/images/(?P<pk>[a-zA-Z0-9_\-]+)/$', ImageRetrieveUpdateDestroy.as_view(), name='image-detail'),