removing refrences to flavor
diff --git a/plstackapi/core/admin.py b/plstackapi/core/admin.py
index 90b1963..b45e571 100644
--- a/plstackapi/core/admin.py
+++ b/plstackapi/core/admin.py
@@ -31,7 +31,7 @@
class SliverInline(admin.TabularInline):
model = Sliver
- fields = ['ip', 'name', 'slice', 'flavor', 'image', 'key', 'node', 'deploymentNetwork']
+ fields = ['ip', 'name', 'slice', 'image', 'key', 'node', 'deploymentNetwork']
extra = 0
class SiteInline(admin.TabularInline):
@@ -228,9 +228,9 @@
class SliverAdmin(PlanetStackBaseAdmin):
form = SliverForm
fieldsets = [
- ('Sliver', {'fields': ['ip', 'name', 'slice', 'flavor', 'image', 'key', 'node', 'deploymentNetwork']})
+ ('Sliver', {'fields': ['ip', 'name', 'slice', 'image', 'key', 'node', 'deploymentNetwork']})
]
- list_display = ['ip', 'name', 'slice', 'flavor', 'image', 'key', 'node', 'deploymentNetwork']
+ list_display = ['ip', 'name', 'slice', 'image', 'key', 'node', 'deploymentNetwork']
def save_model(self, request, obj, form, change):
# update openstack connection to use this sliver's slice/tenant
@@ -340,7 +340,6 @@
admin.site.register(Image, ImageAdmin)
admin.site.register(Node, NodeAdmin)
admin.site.register(Sliver, SliverAdmin)
-admin.site.register(Flavor)
admin.site.register(Key, KeyAdmin)
admin.site.register(Role, RoleAdmin)
admin.site.register(DeploymentNetwork, DeploymentNetworkAdmin)
diff --git a/plstackapi/core/api/flavors.py b/plstackapi/core/api/flavors.py
deleted file mode 100644
index 94c38eb..0000000
--- a/plstackapi/core/api/flavors.py
+++ /dev/null
@@ -1,34 +0,0 @@
-from types import StringTypes
-from plstackapi.openstack.client import OpenStackClient
-from plstackapi.openstack.driver import OpenStackDriver
-from plstackapi.core.api.auth import auth_check
-from plstackapi.core.models import Flavor
-
-def _get_flavors(filter):
- if isinstance(filter, StringTypes) and filter.isdigit():
- filter = int(filter)
- if isinstance(filter, int):
- flavors = Flavor.objects.filter(id=filter)
- elif isinstance(filter, StringTypes):
- flavors = Flavor.objects.filter(name=filter)
- elif isinstance(filter, dict):
- flavors = Flavor.objects.filter(**filter)
- else:
- flavors = []
- return flavors
-
-def add_flavor(auth, fields={}):
- """not implemented"""
- return
-
-def delete_flavor(auth, filter={}):
- """not implemented"""
- return 1
-
-def get_flavors(auth, filter={}):
- auth_check(auth)
- flavors = _get_flavors(filter)
- return flavors
-
-
-
diff --git a/plstackapi/core/api/slivers.py b/plstackapi/core/api/slivers.py
index a5b3084..da5d17f 100644
--- a/plstackapi/core/api/slivers.py
+++ b/plstackapi/core/api/slivers.py
@@ -3,7 +3,6 @@
from plstackapi.openstack.driver import OpenStackDriver
from plstackapi.core.api.auth import auth_check
from plstackapi.core.models import Sliver, Slice
-from plstackapi.core.api.flavors import _get_flavors
from plstackapi.core.api.images import _get_images
from plstackapi.core.api.keys import _get_keys
from plstackapi.core.api.slices import _get_slices
@@ -27,8 +26,6 @@
def add_sliver(auth, fields):
driver = OpenStackDriver(client = auth_check(auth))
- flavors = _get_flavors(fields.get('flavor'))
- if flavors: fields['flavor'] = flavors[0]
images = _get_images(fields.get('image'))
if images: fields['image'] = images[0]
keys = _get_keys(fields.get('key'))
@@ -44,7 +41,6 @@
# create quantum sliver
instance = driver.spawn_instance(name=sliver.name,
key_name = sliver.key.name,
- flavor_id = sliver.flavor.flavor_id,
image_id = sliver.image.image_id,
hostname = sliver.node.name )
diff --git a/plstackapi/core/api_root.py b/plstackapi/core/api_root.py
index 583e7c4..61e76da 100644
--- a/plstackapi/core/api_root.py
+++ b/plstackapi/core/api_root.py
@@ -15,5 +15,4 @@
'subnets': reverse('subnet-list', request=request, format=format),
'slivers': reverse('sliver-list', request=request, format=format),
'images': reverse('image-list', request=request, format=format),
- 'flavors': reverse('flavor-list', request=request, format=format),
})
diff --git a/plstackapi/core/models/sliver.py b/plstackapi/core/models/sliver.py
index 29858a4..ba308f5 100644
--- a/plstackapi/core/models/sliver.py
+++ b/plstackapi/core/models/sliver.py
@@ -2,7 +2,6 @@
from django.db import models
from django.core import exceptions
from plstackapi.core.models import PlCoreBase
-from plstackapi.core.models import Flavor
from plstackapi.core.models import Image
from plstackapi.core.models import Key
from plstackapi.core.models import Slice
diff --git a/plstackapi/core/urls.py b/plstackapi/core/urls.py
index 9493a06..0696c31 100644
--- a/plstackapi/core/urls.py
+++ b/plstackapi/core/urls.py
@@ -13,7 +13,6 @@
from plstackapi.core.views.keys import KeyListCreate, KeyRetrieveUpdateDestroy
from plstackapi.core.views.deployment_networks import DeploymentNetworkListCreate, DeploymentNetworkRetrieveUpdateDestroy
from plstackapi.core.views.images import ImageListCreate, ImageRetrieveUpdateDestroy
-from plstackapi.core.views.flavors import FlavorListCreate, FlavorRetrieveUpdateDestroy
from plstackapi.core.views.nodes import NodeListCreate, NodeRetrieveUpdateDestroy
from plstackapi.core.models import Site
from plstackapi.core.api_root import api_root
@@ -70,8 +69,6 @@
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'),
- url(r'^plstackapi/flavors/$', FlavorListCreate.as_view(), name='flavor-list'),
- url(r'^plstackapi/flavors/(?P<pk>[a-zA-Z0-9_]+)/$', FlavorRetrieveUpdateDestroy.as_view(), name='flavor-detail'),
#Adding in rest_framework urls
url(r'^plstackapi/', include('rest_framework.urls', namespace='rest_framework')),
diff --git a/plstackapi/core/views/flavors.py b/plstackapi/core/views/flavors.py
deleted file mode 100644
index 0e06c8e..0000000
--- a/plstackapi/core/views/flavors.py
+++ /dev/null
@@ -1,55 +0,0 @@
-from django.http import Http404
-from rest_framework.views import APIView
-from rest_framework.response import Response
-from rest_framework import status
-
-from plstackapi.core.api.flavors import add_flavor, delete_flavor, get_flavors
-from plstackapi.core.serializers import FlavorSerializer
-from plstackapi.util.request import parse_request
-
-
-class FlavorListCreate(APIView):
- """
- List all flavors or create a new flavor.
- """
-
- def post(self, request, format = None):
- data = parse_request(request.DATA)
- if 'auth' not in data:
- return Response(status=status.HTTP_400_BAD_REQUEST)
- elif 'flavor' in data:
- """Not Implemented"""
- return Response(status=status.HTTP_404_NOT_FOUND)
- else:
- flavors = get_flavors(data['auth'])
- serializer = FlavorSerializer(flavors, many=True)
- return Response(serializer.data)
-
-
-class FlavorRetrieveUpdateDestroy(APIView):
- """
- Retrieve, update or delete an flavor
- """
-
- def post(self, request, pk, format=None):
- """Retrieve an flavor """
- data = parse_request(request.DATA)
- if 'auth' not in data:
- return Response(status=status.HTTP_400_BAD_REQUEST)
- flavors = get_flavors(data['auth'], pk)
- if not flavors:
- return Response(status=status.HTTP_404_NOT_FOUND)
- serializer = FlavorSerializer(flavors[0])
- return Response(serializer.data)
-
- def put(self, request, pk, format=None):
- """update flavor not implemnted"""
- return Response(status=status.HTTP_404_NOT_FOUND)
-
- def delete(self, request, pk, format=None):
- """delete flavor not implemnted"""
- return Response(status=status.HTTP_404_NOT_FOUND)
-
-
-
-
diff --git a/plstackapi/openstack/manager.py b/plstackapi/openstack/manager.py
index 342b08e..68d4dbb 100644
--- a/plstackapi/openstack/manager.py
+++ b/plstackapi/openstack/manager.py
@@ -49,35 +49,6 @@
old_node_names = set(nodes_dict.keys()).difference(compute_nodes_dict.keys())
Node.objects.filter(name__in=old_node_names).delete()
- def refresh_flavors(self):
- # collect local flavors
- from plstackapi.core.models import Flavor
- flavors = Flavor.objects.all()
- flavors_dict = {}
- for flavor in flavors:
- flavors_dict[flavor.name] = flavor
-
- # collect nova falvors
- nova_flavors = self.client.nova.flavors.list()
- nova_flavors_dict = {}
- for nova_flavor in nova_flavors:
- nova_flavors_dict[nova_flavor.name] = nova_flavor
-
- # add new flavors
- new_flavor_names = set(nova_flavors_dict.keys()).difference(flavors_dict.keys())
- for name in new_flavor_names:
-
- flavor = Flavor(flavor_id=nova_flavors_dict[name].id,
- name=nova_flavors_dict[name].name,
- memory_mb=nova_flavors_dict[name].ram,
- disk_gb=nova_flavors_dict[name].disk,
- vcpus=nova_flavors_dict[name].vcpus)
- flavor.save()
-
- # remove old flavors
- old_flavor_names = set(flavors_dict.keys()).difference(nova_flavors_dict.keys())
- Flavor.objects.filter(name__in=old_flavor_names).delete()
-
def refresh_images(self):
# collect local images
from plstackapi.core.models import Image