Properly populate cluster id in instance grow

The form to add an instance to grow a cluster had a hidden cluster_id
field that was not being populated.

The cache uses this cluster_id to keep track of the instances which
are used to grow the cluster.

Properly added the code to correctly populate the field.

Change-Id: Ie9a1e481aeb4c1ae015ae66835392b9534fbee05
Closes-Bug: #1611468
This commit is contained in:
Ali Adil 2016-08-09 15:50:41 -04:00
parent acb3d96ef0
commit 0d15ccb29e
2 changed files with 6 additions and 1 deletions

View File

@ -346,7 +346,7 @@ class ClusterAddInstanceForm(forms.SelfHandlingForm):
def __init__(self, request, *args, **kwargs): def __init__(self, request, *args, **kwargs):
super(ClusterAddInstanceForm, self).__init__(request, *args, **kwargs) super(ClusterAddInstanceForm, self).__init__(request, *args, **kwargs)
self.fields['cluster_id'].initial = kwargs['initial']['cluster_id']
self.fields['flavor'].choices = self.populate_flavor_choices(request) self.fields['flavor'].choices = self.populate_flavor_choices(request)
@memoized.memoized_method @memoized.memoized_method

View File

@ -190,6 +190,11 @@ class ClusterAddInstancesView(horizon_forms.ModalFormView):
context['submit_url'] = reverse(self.submit_url, args=args) context['submit_url'] = reverse(self.submit_url, args=args)
return context return context
def get_initial(self):
initial = super(ClusterAddInstancesView, self).get_initial()
initial['cluster_id'] = self.kwargs['cluster_id']
return initial
def get_success_url(self): def get_success_url(self):
return reverse(self.success_url, args=[self.kwargs['cluster_id']]) return reverse(self.success_url, args=[self.kwargs['cluster_id']])