service images now determined from slice.default_image
diff --git a/xos/core/admin.py b/xos/core/admin.py
index a0fd3cb..6d16fc9 100644
--- a/xos/core/admin.py
+++ b/xos/core/admin.py
@@ -1224,7 +1224,7 @@
class SliceAdmin(XOSBaseAdmin):
form = SliceForm
fieldList = ['backend_status_text', 'site', 'name', 'serviceClass', 'enabled',
- 'description', 'service', 'slice_url', 'max_instances', "default_isolation", "network"]
+ 'description', 'service', 'slice_url', 'max_instances', "default_isolation", "default_image", "network"]
fieldsets = [('Slice Details', {'fields': fieldList, 'classes': [
'suit-tab suit-tab-general']}), ]
readonly_fields = ('backend_status_text', )
diff --git a/xos/core/models/service.py b/xos/core/models/service.py
index 4bac02c..3d38f73 100644
--- a/xos/core/models/service.py
+++ b/xos/core/models/service.py
@@ -531,13 +531,6 @@
# This scheduler picks a VM in the slice with the fewest containers inside
# of it. If no VMs are suitable, then it creates a VM.
- # this is a hack and should be replaced by something smarter...
- LOOK_FOR_IMAGES = ["ubuntu-vcpe4", # ONOS demo machine -- preferred vcpe image
- "Ubuntu 14.04 LTS", # portal
- "Ubuntu-14.04-LTS", # ONOS demo machine
- "trusty-server-multi-nic", # CloudLab
- ]
-
MAX_VM_PER_CONTAINER = 10
def __init__(self, slice):
@@ -547,14 +540,11 @@
def image(self):
from core.models import Image
- look_for_images = self.LOOK_FOR_IMAGES
- for image_name in look_for_images:
- images = Image.objects.filter(name=image_name)
- if images:
- return images[0]
+ # If slice has default_image set then use it
+ if self.slice.default_image:
+ return self.slice.default_image
- raise XOSProgrammingError(
- "No ContainerVM image (looked for %s)" % str(look_for_images))
+ raise XOPSProgrammingError("Please set a default image for %s" % self.slice.name)
def make_new_instance(self):
from core.models import Instance, Flavor
@@ -603,15 +593,6 @@
class TenantWithContainer(Tenant):
""" A tenant that manages a container """
- # this is a hack and should be replaced by something smarter...
- LOOK_FOR_IMAGES = ["ubuntu-vcpe4", # ONOS demo machine -- preferred vcpe image
- "Ubuntu 14.04 LTS", # portal
- "Ubuntu-14.04-LTS", # ONOS demo machine
- "trusty-server-multi-nic", # CloudLab
- ]
-
- LOOK_FOR_CONTAINER_IMAGES = ["docker-vcpe"]
-
class Meta:
proxy = True
@@ -694,18 +675,11 @@
raise XOSProgrammingError("provider service has no slice")
slice = slice[0]
- if slice.default_isolation in ["container", "container_vm"]:
- look_for_images = self.LOOK_FOR_CONTAINER_IMAGES
- else:
- look_for_images = self.LOOK_FOR_IMAGES
+ # If slice has default_image set then use it
+ if slice.default_image:
+ return slice.default_image
- for image_name in look_for_images:
- images = Image.objects.filter(name=image_name)
- if images:
- return images[0]
-
- raise XOSProgrammingError(
- "No VPCE image (looked for %s)" % str(look_for_images))
+ raise XOPSProgrammingError("Please set a default image for %s" % self.slice.name)
def save_instance(self, instance):
# Override this function to do custom pre-save or post-save processing,