replaced sliver.controllerNetwork with sliver.deployment
diff --git a/planetstack/core/admin.py b/planetstack/core/admin.py
index e2de8c8..8580177 100644
--- a/planetstack/core/admin.py
+++ b/planetstack/core/admin.py
@@ -340,7 +340,7 @@
class SliverInline(PlStackTabularInline):
model = Sliver
- fields = ['backend_status_icon', 'all_ips_string', 'instance_name', 'slice', 'controllerNetwork', 'flavor', 'image', 'node']
+ fields = ['backend_status_icon', 'all_ips_string', 'instance_name', 'slice', 'deployment', 'flavor', 'image', 'node']
extra = 0
readonly_fields = ['backend_status_icon', 'all_ips_string', 'instance_name']
suit_classes = 'suit-tab suit-tab-slivers'
@@ -349,10 +349,10 @@
return Sliver.select_by_user(request.user)
def formfield_for_foreignkey(self, db_field, request=None, **kwargs):
- if db_field.name == 'controllerNetwork':
+ if db_field.name == 'deployment':
kwargs['queryset'] = Deployment.select_by_acl(request.user)
kwargs['widget'] = forms.Select(attrs={'onChange': "sliver_deployment_changed(this);"})
- elif db_field.name == 'flavor':
+ if db_field.name == 'flavor':
kwargs['widget'] = forms.Select(attrs={'onChange': "sliver_flavor_changed(this);"})
field = super(SliverInline, self).formfield_for_foreignkey(db_field, request, **kwargs)
@@ -1075,7 +1075,7 @@
'ip': PlainTextWidget(),
'instance_name': PlainTextWidget(),
'slice': LinkedSelect,
- 'controllerNetwork': LinkedSelect,
+ 'deployment': LinkedSelect,
'node': LinkedSelect,
'image': LinkedSelect
}
@@ -1089,10 +1089,10 @@
class SliverAdmin(PlanetStackBaseAdmin):
form = SliverForm
fieldsets = [
- ('Sliver Details', {'fields': ['backend_status_text', 'slice', 'controllerNetwork', 'node', 'ip', 'instance_name', 'flavor', 'image', ], 'classes': ['suit-tab suit-tab-general'], })
+ ('Sliver Details', {'fields': ['backend_status_text', 'slice', 'deployment', 'node', 'ip', 'instance_name', 'flavor', 'image', ], 'classes': ['suit-tab suit-tab-general'], })
]
readonly_fields = ('backend_status_text', )
- list_display = ['backend_status_icon', 'ip', 'instance_name', 'slice', 'flavor', 'image', 'node', 'controllerNetwork']
+ list_display = ['backend_status_icon', 'ip', 'instance_name', 'slice', 'flavor', 'image', 'node', 'deployment']
list_display_links = ('backend_status_icon', 'ip',)
suit_form_tabs =(('general', 'Sliver Details'),
@@ -1101,7 +1101,7 @@
inlines = [TagInline]
- user_readonly_fields = ['slice', 'controllerNetwork', 'node', 'ip', 'instance_name', 'flavor', 'image']
+ user_readonly_fields = ['slice', 'deployment', 'node', 'ip', 'instance_name', 'flavor', 'image']
def formfield_for_foreignkey(self, db_field, request, **kwargs):
if db_field.name == 'slice':
diff --git a/planetstack/core/migrations/0001_initial.py b/planetstack/core/migrations/0001_initial.py
index 9612815..de0de8a 100644
--- a/planetstack/core/migrations/0001_initial.py
+++ b/planetstack/core/migrations/0001_initial.py
@@ -981,8 +981,8 @@
('ip', models.GenericIPAddressField(help_text=b'Sliver ip address', null=True, blank=True)),
('numberCores', models.IntegerField(default=0, help_text=b'Number of cores for sliver', verbose_name=b'Number of Cores')),
('userData', models.TextField(help_text=b'user_data passed to instance during creation', null=True, blank=True)),
- ('controllerNetwork', models.ForeignKey(related_name=b'sliver_controllerNetwork', verbose_name=b'controller', to='core.Controller')),
('creator', models.ForeignKey(related_name=b'slivers', blank=True, to=settings.AUTH_USER_MODEL, null=True)),
+ ('deployment', models.ForeignKey(related_name=b'sliver_deployment', verbose_name=b'deployment', to='core.Deployment')),
('flavor', models.ForeignKey(default=core.models.sliver.get_default_flavor, to='core.Flavor', help_text=b'Flavor of this instance')),
('image', models.ForeignKey(related_name=b'slivers', to='core.Image')),
('node', models.ForeignKey(related_name=b'slivers', to='core.Node')),
diff --git a/planetstack/core/models/sliver.py b/planetstack/core/models/sliver.py
index 059b5c0..de0ff84 100644
--- a/planetstack/core/models/sliver.py
+++ b/planetstack/core/models/sliver.py
@@ -88,8 +88,8 @@
#key = models.ForeignKey(Key, related_name='slivers')
creator = models.ForeignKey(User, related_name='slivers', blank=True, null=True)
slice = models.ForeignKey(Slice, related_name='slivers')
+ deployment = models.ForeignKey(Deployment, verbose_name='deployment', related_name='sliver_deployment')
node = models.ForeignKey(Node, related_name='slivers')
- controllerNetwork = models.ForeignKey(Controller, verbose_name='controller', related_name='sliver_controllerNetwork')
numberCores = models.IntegerField(verbose_name="Number of Cores", help_text="Number of cores for sliver", default=0)
flavor = models.ForeignKey(Flavor, help_text="Flavor of this instance", default=get_default_flavor)
tags = generic.GenericRelation(Tag)
@@ -109,7 +109,6 @@
self.name = self.slice.slicename
if not self.creator and hasattr(self, 'caller'):
self.creator = self.caller
- self.controllerNetwork = self.node.site_deployment.controller
# XXX smbaker - disabled for now, was causing fault in tenant view create slice
# if not self.controllerNetwork.test_acl(slice=self.slice):