Renamed SliceDeployments --> SliceDeployment
diff --git a/planetstack/core/admin.py b/planetstack/core/admin.py
index 1ef4106..b26194a 100644
--- a/planetstack/core/admin.py
+++ b/planetstack/core/admin.py
@@ -748,8 +748,8 @@
raise forms.ValidationError('slice name must begin with %s' % site.login_base)
return cleaned_data
-class SliceDeploymentsInline(PlStackTabularInline):
- model = SliceDeployments
+class SliceDeploymentInline(PlStackTabularInline):
+ model = SliceDeployment
extra = 0
verbose_name = "Slice Deployment"
verbose_name_plural = "Slice Deployments"
@@ -765,7 +765,7 @@
list_display = ('backend_status_icon', 'name', 'site','serviceClass', 'slice_url', 'max_slivers')
list_display_links = ('backend_status_icon', 'name', )
inlines = [SlicePrivilegeInline,SliverInline, TagInline, ReservationInline,SliceNetworkInline]
- admin_inlines = [SliceDeploymentsInline]
+ admin_inlines = [SliceDeploymentInline]
user_readonly_fields = fieldList
diff --git a/planetstack/core/models/__init__.py b/planetstack/core/models/__init__.py
index 2070e16..b1175f1 100644
--- a/planetstack/core/models/__init__.py
+++ b/planetstack/core/models/__init__.py
@@ -5,14 +5,14 @@
from .service import ServiceAttribute
from .tag import Tag
from .role import Role
-from .site import Site,Deployment, DeploymentRole, DeploymentPrivilege, SiteDeployments
+from .site import Site,Deployment, DeploymentRole, DeploymentPrivilege, SiteDeployment
from .dashboard import DashboardView
from .user import User, UserDashboardView
from .serviceclass import ServiceClass
from .site import DeploymentLinkManager,DeploymentLinkDeletionManager
-from .slice import Slice, SliceDeployments
-from .site import SitePrivilege, SiteDeployments
-from .userdeployments import UserDeployments
+from .slice import Slice, SliceDeployment
+from .site import SitePrivilege, SiteDeployment
+from .userdeployments import UserDeployment
from .image import Image, ImageDeployments
from .node import Node
from .serviceresource import ServiceResource
diff --git a/planetstack/core/models/slice.py b/planetstack/core/models/slice.py
index ed10caf..e1fad4c 100644
--- a/planetstack/core/models/slice.py
+++ b/planetstack/core/models/slice.py
@@ -120,7 +120,7 @@
qs = SlicePrivilege.objects.filter(id__in=sp_ids)
return qs
-class SliceDeployments(PlCoreBase):
+class SliceDeployment(PlCoreBase):
objects = DeploymentLinkManager()
deleted_objects = DeploymentLinkDeletionManager()
@@ -136,8 +136,8 @@
@staticmethod
def select_by_user(user):
if user.is_admin:
- qs = SliceDeployments.objects.all()
+ qs = SliceDeployment.objects.all()
else:
slices = Slice.select_by_user(user)
- qs = SliceDeployments.objects.filter(slice__in=slices)
+ qs = SliceDeployment.objects.filter(slice__in=slices)
return qs
diff --git a/planetstack/ec2_observer/deleters/slice_deleter.py b/planetstack/ec2_observer/deleters/slice_deleter.py
index 90b58c3..e7c54e6 100644
--- a/planetstack/ec2_observer/deleters/slice_deleter.py
+++ b/planetstack/ec2_observer/deleters/slice_deleter.py
@@ -1,4 +1,4 @@
-from core.models import Slice, SliceDeployments, User
+from core.models import Slice, SliceDeployment, User
from observer.deleter import Deleter
from observer.deleters.slice_deployment_deleter import SliceDeploymentDeleter
from util.logger import Logger, logging
@@ -11,7 +11,7 @@
def call(self, pk):
slice = Slice.objects.get(pk=pk)
slice_deployment_deleter = SliceDeploymentDeleter()
- for slice_deployment in SliceDeployments.objects.filter(slice=slice):
+ for slice_deployment in SliceDeployment.objects.filter(slice=slice):
try:
slice_deployment_deleter(slice_deployment.id)
except:
diff --git a/planetstack/ec2_observer/deleters/slice_deployment_deleter.py b/planetstack/ec2_observer/deleters/slice_deployment_deleter.py
index 33e0836..31d26fb 100644
--- a/planetstack/ec2_observer/deleters/slice_deployment_deleter.py
+++ b/planetstack/ec2_observer/deleters/slice_deployment_deleter.py
@@ -1,12 +1,12 @@
-from core.models import Slice, SliceDeployments, User
+from core.models import Slice, SliceDeployment, User
from observer.deleter import Deleter
from openstack.driver import OpenStackDriver
class SliceDeploymentDeleter(Deleter):
- model='SliceDeployments'
+ model='SliceDeployment'
def call(self, pk):
- slice_deployment = SliceDeployments.objects.get(pk=pk)
+ slice_deployment = SliceDeployment.objects.get(pk=pk)
user = User.objects.get(id=slice_deployment.slice.creator.id)
driver = OpenStackDriver().admin_driver(deployment=slice_deployment.deployment.name)
client_driver = driver.client_driver(caller=user,
diff --git a/planetstack/ec2_observer/deleters/sliver_deleter.py b/planetstack/ec2_observer/deleters/sliver_deleter.py
index 097f0f7..732e535 100644
--- a/planetstack/ec2_observer/deleters/sliver_deleter.py
+++ b/planetstack/ec2_observer/deleters/sliver_deleter.py
@@ -1,4 +1,4 @@
-from core.models import Sliver, SliceDeployments
+from core.models import Sliver, SliceDeployment
from observer.deleter import Deleter
class SliverDeleter(Deleter):
diff --git a/planetstack/ec2_observer/steps/sync_slivers.py b/planetstack/ec2_observer/steps/sync_slivers.py
index a7b1dad..ed75438 100644
--- a/planetstack/ec2_observer/steps/sync_slivers.py
+++ b/planetstack/ec2_observer/steps/sync_slivers.py
@@ -30,7 +30,7 @@
my_slivers = []
for sliver in all_slivers:
- sd = SliceDeployments.objects.filter(Q(slice=sliver.slice))
+ sd = SliceDeployment.objects.filter(Q(slice=sliver.slice))
if (sd):
if (sd.deployment.name=='Amazon EC2'):
my_slivers.append(sliver)
diff --git a/planetstack/genapi.py b/planetstack/genapi.py
index efe42f7..51da3e9 100644
--- a/planetstack/genapi.py
+++ b/planetstack/genapi.py
@@ -129,8 +129,8 @@
url(r'plstackapi/reservations/$', ReservationList.as_view(), name='reservation-list'),
url(r'plstackapi/reservations/(?P<pk>[a-zA-Z0-9\-]+)/$', ReservationDetail.as_view(), name ='reservation-detail'),
- url(r'plstackapi/slice_deployments/$', SliceDeploymentsList.as_view(), name='slicedeployments-list'),
- url(r'plstackapi/slice_deployments/(?P<pk>[a-zA-Z0-9\-]+)/$', SliceDeploymentsDetail.as_view(), name ='slicedeployments-detail'),
+ url(r'plstackapi/slice_deployments/$', SliceDeploymentList.as_view(), name='slicedeployments-list'),
+ url(r'plstackapi/slice_deployments/(?P<pk>[a-zA-Z0-9\-]+)/$', SliceDeploymentDetail.as_view(), name ='slicedeployments-detail'),
url(r'plstackapi/siteprivileges/$', SitePrivilegeList.as_view(), name='siteprivilege-list'),
url(r'plstackapi/siteprivileges/(?P<pk>[a-zA-Z0-9\-]+)/$', SitePrivilegeDetail.as_view(), name ='siteprivilege-detail'),
@@ -925,18 +925,18 @@
-class SliceDeploymentsSerializer(serializers.HyperlinkedModelSerializer):
+class SliceDeploymentSerializer(serializers.HyperlinkedModelSerializer):
id = serializers.Field()
class Meta:
- model = SliceDeployments
+ model = SliceDeployment
fields = ('id','created','updated','enacted','backend_status','deleted','slice','deployment','tenant_id','network_id','router_id','subnet_id',)
-class SliceDeploymentsIdSerializer(serializers.ModelSerializer):
+class SliceDeploymentIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
class Meta:
- model = SliceDeployments
+ model = SliceDeployment
fields = ('id','created','updated','enacted','backend_status','deleted','slice','deployment','tenant_id','network_id','router_id','subnet_id',)
@@ -1250,13 +1250,13 @@
Reservation: ReservationSerializer,
- SliceDeployments: SliceDeploymentsSerializer,
+ SliceDeployment: SliceDeploymentSerializer,
SitePrivilege: SitePrivilegeSerializer,
PlanetStack: PlanetStackSerializer,
- UserDeployments: UserDeploymentsSerializer,
+ UserDeployment: UserDeploymentSerializer,
Account: AccountSerializer,
@@ -3133,10 +3133,10 @@
-class SliceDeploymentsList(generics.ListCreateAPIView):
- queryset = SliceDeployments.objects.select_related().all()
- serializer_class = SliceDeploymentsSerializer
- id_serializer_class = SliceDeploymentsIdSerializer
+class SliceDeploymentList(generics.ListCreateAPIView):
+ queryset = SliceDeployment.objects.select_related().all()
+ serializer_class = SliceDeploymentSerializer
+ id_serializer_class = SliceDeploymentIdSerializer
filter_backends = (filters.DjangoFilterBackend,)
filter_fields = ('id','created','updated','enacted','backend_status','deleted','slice','deployment','tenant_id','network_id','router_id','subnet_id',)
@@ -3148,27 +3148,27 @@
return self.serializer_class
def get_queryset(self):
- return SliceDeployments.select_by_user(self.request.user)
+ return SliceDeployment.select_by_user(self.request.user)
def create(self, request, *args, **kwargs):
- obj = SliceDeployments(**request.DATA)
+ obj = SliceDeployment(**request.DATA)
obj.caller = request.user
if obj.can_update(request.user):
- return super(SliceDeploymentsList, self).create(request, *args, **kwargs)
+ return super(SliceDeploymentList, self).create(request, *args, **kwargs)
else:
raise Exception("failed obj.can_update")
- ret = super(SliceDeploymentsList, self).create(request, *args, **kwargs)
+ ret = super(SliceDeploymentList, self).create(request, *args, **kwargs)
if (ret.status_code%100 != 200):
raise Exception(ret.data)
return ret
-class SliceDeploymentsDetail(PlanetStackRetrieveUpdateDestroyAPIView):
- queryset = SliceDeployments.objects.select_related().all()
- serializer_class = SliceDeploymentsSerializer
- id_serializer_class = SliceDeploymentsIdSerializer
+class SliceDeploymentDetail(PlanetStackRetrieveUpdateDestroyAPIView):
+ queryset = SliceDeployment.objects.select_related().all()
+ serializer_class = SliceDeploymentSerializer
+ id_serializer_class = SliceDeploymentIdSerializer
def get_serializer_class(self):
no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
@@ -3178,7 +3178,7 @@
return self.serializer_class
def get_queryset(self):
- return SliceDeployments.select_by_user(self.request.user)
+ return SliceDeployment.select_by_user(self.request.user)
# update() is handled by PlanetStackRetrieveUpdateDestroyAPIView
diff --git a/planetstack/model_policies/model_policy_Network.py b/planetstack/model_policies/model_policy_Network.py
index f48b25a..88c9f1d 100644
--- a/planetstack/model_policies/model_policy_Network.py
+++ b/planetstack/model_policies/model_policy_Network.py
@@ -1,11 +1,11 @@
from core.models import *
def handle(network):
- from core.models import SliceDeployments,NetworkDeployments
+ from core.models import SliceDeployment,NetworkDeployments
from collections import defaultdict
# network deployments are not visible to users. We must ensure
# networks are deployed at all deploymets available to their slices.
- slice_deployments = SliceDeployments.objects.all()
+ slice_deployments = SliceDeployment.objects.all()
slice_deploy_lookup = defaultdict(list)
for slice_deployment in slice_deployments:
slice_deploy_lookup[slice_deployment.slice].append(slice_deployment.deployment)
diff --git a/planetstack/model_policies/model_policy_Slice.py b/planetstack/model_policies/model_policy_Slice.py
index cf73aa0..7523e3e 100644
--- a/planetstack/model_policies/model_policy_Slice.py
+++ b/planetstack/model_policies/model_policy_Slice.py
@@ -1,13 +1,13 @@
def handle(slice):
- from core.models import SiteDeployments,SliceDeployments,Deployment,Network,NetworkSlice,NetworkTemplate
+ from core.models import SiteDeployment,SliceDeployment,Deployment,Network,NetworkSlice,NetworkTemplate
from collections import defaultdict
- site_deployments = SiteDeployments.objects.all()
+ site_deployments = SiteDeployment.objects.all()
site_deploy_lookup = defaultdict(list)
for site_deployment in site_deployments:
site_deploy_lookup[site_deployment.site].append(site_deployment.deployment)
- slice_deployments = SliceDeployments.objects.all()
+ slice_deployments = SliceDeployment.objects.all()
slice_deploy_lookup = defaultdict(list)
for slice_deployment in slice_deployments:
slice_deploy_lookup[slice_deployment.slice].append(slice_deployment.deployment)
@@ -19,7 +19,7 @@
for expected_deployment in expected_deployments:
if slice not in slice_deploy_lookup or \
expected_deployment not in slice_deploy_lookup[slice]:
- sd = SliceDeployments(slice=slice, deployment=expected_deployment)
+ sd = SliceDeployment(slice=slice, deployment=expected_deployment)
sd.save()
# make sure slice has at least 1 public and 1 private networkd
diff --git a/planetstack/openstack_observer/steps/sync_slice_deployments.py b/planetstack/openstack_observer/steps/sync_slice_deployments.py
index 97196d6..d7282c6 100644
--- a/planetstack/openstack_observer/steps/sync_slice_deployments.py
+++ b/planetstack/openstack_observer/steps/sync_slice_deployments.py
@@ -5,23 +5,23 @@
from django.db.models import F, Q
from planetstack.config import Config
from observer.openstacksyncstep import OpenStackSyncStep
-from core.models.site import Deployment, SiteDeployments
-from core.models.slice import Slice, SliceDeployments
-from core.models.userdeployments import UserDeployments
+from core.models.site import Deployment, SiteDeployment
+from core.models.slice import Slice, SliceDeployment
+from core.models.userdeployments import UserDeployment
from util.logger import Logger, logging
from observer.ansible import *
logger = Logger(level=logging.INFO)
-class SyncSliceDeployments(OpenStackSyncStep):
- provides=[SliceDeployments]
+class SyncSliceDeployment(OpenStackSyncStep):
+ provides=[SliceDeployment]
requested_interval=0
def fetch_pending(self, deleted):
if (deleted):
- return SliceDeployments.deleted_objects.all()
+ return SliceDeployment.deleted_objects.all()
else:
- return SliceDeployments.objects.filter(Q(enacted__lt=F('updated')) | Q(enacted=None))
+ return SliceDeployment.objects.filter(Q(enacted__lt=F('updated')) | Q(enacted=None))
def get_next_subnet(self, deployment=None):
# limit ourself to 10.0.x.x for now
diff --git a/planetstack/openstack_observer/steps/sync_slice_memberships.py b/planetstack/openstack_observer/steps/sync_slice_memberships.py
index b1cd223..9b7b40b 100644
--- a/planetstack/openstack_observer/steps/sync_slice_memberships.py
+++ b/planetstack/openstack_observer/steps/sync_slice_memberships.py
@@ -22,11 +22,11 @@
def sync_record(self, slice_memb):
# sync slice memberships at all slice deployments
logger.info("syncing slice privilege: %s %s" % (slice_memb.slice.name, slice_memb.user.email))
- slice_deployments = SliceDeployments.objects.filter(slice=slice_memb.slice)
+ slice_deployments = SliceDeployment.objects.filter(slice=slice_memb.slice)
for slice_deployment in slice_deployments:
if not slice_deployment.tenant_id:
continue
- user_deployments = UserDeployments.objects.filter(deployment=slice_deployment.deployment,
+ user_deployments = UserDeployment.objects.filter(deployment=slice_deployment.deployment,
user=slice_memb.user)
if user_deployments:
kuser_id = user_deployments[0].kuser_id
diff --git a/planetstack/openstack_observer/steps/sync_slices.py b/planetstack/openstack_observer/steps/sync_slices.py
index a6073b6..1b89ecd 100644
--- a/planetstack/openstack_observer/steps/sync_slices.py
+++ b/planetstack/openstack_observer/steps/sync_slices.py
@@ -15,14 +15,14 @@
requested_interval=0
def sync_record(self, slice):
- for slice_deployment in SliceDeployments.objects.filter(slice=slice):
+ for slice_deployment in SliceDeployment.objects.filter(slice=slice):
# bump the 'updated' timestamp and trigger observer to update
# slice across all deployments
slice_deployment.save()
def delete_record(self, slice):
- slice_deployment_deleter = SyncSliceDeployments().delete_record
- for slice_deployment in SliceDeployments.objects.filter(slice=slice):
+ slice_deployment_deleter = SyncSliceDeployment().delete_record
+ for slice_deployment in SliceDeployment.objects.filter(slice=slice):
try:
slice_deployment_deleter(slice_deployment)
except Exception,e:
diff --git a/planetstack/openstack_observer/steps/sync_slivers.py b/planetstack/openstack_observer/steps/sync_slivers.py
index 8237896..133c0e0 100644
--- a/planetstack/openstack_observer/steps/sync_slivers.py
+++ b/planetstack/openstack_observer/steps/sync_slivers.py
@@ -4,7 +4,7 @@
from planetstack.config import Config
from observer.openstacksyncstep import OpenStackSyncStep
from core.models.sliver import Sliver
-from core.models.slice import Slice, SlicePrivilege, SliceDeployments
+from core.models.slice import Slice, SlicePrivilege, SliceDeployment
from core.models.network import Network, NetworkSlice, NetworkDeployments
from util.logger import Logger, logging
from observer.ansible import *