fixed typo in 'image' property, now 'VSGWTenant' instead of 'VMMETenant'
added 'image_name' property to vSGW Tenant model
you can now choose which VM you want for a given instance
in tosca using the 'image_name' property
Change-Id: Idfcd29f871f31464d1c6e0717f000d0d5f603286
diff --git a/xos/models.py b/xos/models.py
index b06b72f..e4f75a5 100644
--- a/xos/models.py
+++ b/xos/models.py
@@ -1,6 +1,6 @@
# models.py - vSGW Models
-from core.models import Service, TenantWithContainer
+from core.models import Service, TenantWithContainer, Image
from django.db import models, transaction
MCORD_KIND = 'EPC'
@@ -28,6 +28,7 @@
verbose_name = TENANT_NAME_VERBOSE
tenant_message = models.CharField(max_length=254, help_text="Tenant Message to Display")
+ image_name = models.CharField(max_length=254, help_text="Name of VM image")
def __init__(self, *args, **kwargs):
vsgw_service = VSGWService.get_service_objects().all()
@@ -43,6 +44,14 @@
self.cleanup_container()
super(VSGWTenant, self).delete(*args, **kwargs)
+ @property
+ def image(self):
+ img = self.image_name.strip()
+ if img.lower() != "default":
+ return Image.objects.get(name=img)
+ else:
+ return super(VSGWTenant, self).image
+
def model_policy_vsgwtenant(pk):
with transaction.atomic():
tenant = VSGWTenant.objects.select_for_update().filter(pk=pk)