From f38f3b0d04decd094983aab02c795c392d47138c Mon Sep 17 00:00:00 2001 From: Tony Mack Date: Mon, 29 Sep 2014 16:10:52 -0400 Subject: [PATCH] added availability_zone field to Deployment model --- planetstack/core/admin.py | 11 ++++++++++- planetstack/core/models/site.py | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/planetstack/core/admin.py b/planetstack/core/admin.py index 1d64d9c..6fcc3f9 100644 --- a/planetstack/core/admin.py +++ b/planetstack/core/admin.py @@ -535,7 +535,7 @@ class SiteAssocInline(PlStackTabularInline): class DeploymentAdmin(PlanetStackBaseAdmin): model = Deployment - fieldList = ['backend_status_text', 'name', 'sites', 'images', 'flavors', 'accessControl'] + fieldList = ['backend_status_text', 'name', 'availability_zone', 'sites', 'images', 'flavors', 'accessControl'] fieldsets = [(None, {'fields': fieldList, 'classes':['suit-tab suit-tab-sites']})] inlines = [DeploymentPrivilegeInline,NodeInline,TagInline] # ,ImageDeploymentsInline] list_display = ['backend_status_icon', 'name'] @@ -700,6 +700,15 @@ class SliceForm(forms.ModelForm): 'service': LinkedSelect } + def clean(self): + cleaned_data = super(SliceForm, self).clean() + name = cleaned_data.get('name') + site_id = cleaned_data.get('site') + site = Slice.objects.get(id=site_id) + if not name.startswith(site.login_base): + raise forms.ValidationError('slice name must begin with %s' % site.login_base) + return cleaned_data + class SliceAdmin(PlanetStackBaseAdmin): form = SliceForm fieldList = ['backend_status_text', 'site', 'name', 'serviceClass', 'enabled','description', 'service', 'slice_url', 'max_slivers'] diff --git a/planetstack/core/models/site.py b/planetstack/core/models/site.py index 67f38aa..160b426 100644 --- a/planetstack/core/models/site.py +++ b/planetstack/core/models/site.py @@ -174,6 +174,7 @@ class Deployment(PlCoreBase): admin_tenant = models.CharField(max_length=200, null=True, blank=True, help_text="Name of the tenant the admin user belongs to") auth_url = models.CharField(max_length=200, null=True, blank=True, help_text="Auth url for the deployment") backend_type = models.CharField(max_length=200, null=True, blank=True, help_text="Type of deployment, e.g. EC2, OpenStack, or OpenStack version") + availability_zone = models.CharField(max_length=200, null=True, blank=True, help_text="OpenStack availability zone") # smbaker: the default of 'allow all' is intended for evolutions of existing # deployments. When new deployments are created via the GUI, they are -- 2.43.0