Merge "Make "availability zone" field optional for host aggregates"

This commit is contained in:
Jenkins 2015-09-03 02:05:49 +00:00 committed by Gerrit Code Review
commit e3f3d5dd09
3 changed files with 5 additions and 3 deletions

View File

@ -26,6 +26,7 @@ class UpdateAggregateForm(forms.SelfHandlingForm):
name = forms.CharField(label=_("Name"),
max_length=255)
availability_zone = forms.CharField(label=_("Availability Zone"),
required=False,
max_length=255)
def handle(self, request, data):

View File

@ -111,7 +111,7 @@ class CreateAggregateWorkflowTests(BaseAggregateWorkflowTests):
workflow_data = self._get_create_workflow_data(aggregate)
workflow_data['name'] = ''
workflow_data['availability_zone'] = ''
self._test_generic_create_aggregate(workflow_data, aggregate, 2,
self._test_generic_create_aggregate(workflow_data, aggregate, 1,
u'This field is required')
@test.create_stubs({api.nova: ('host_list',
@ -243,7 +243,7 @@ class AggregatesViewTests(test.BaseAdminViewTests):
aggregate = self.aggregates.first()
form_data = {'id': aggregate.id}
self._test_generic_update_aggregate(form_data, aggregate, 2,
self._test_generic_update_aggregate(form_data, aggregate, 1,
u'This field is required')

View File

@ -25,6 +25,7 @@ class SetAggregateInfoAction(workflows.Action):
max_length=255)
availability_zone = forms.CharField(label=_("Availability Zone"),
required=False,
max_length=255)
class Meta(object):
@ -186,7 +187,7 @@ class CreateAggregateWorkflow(workflows.Workflow):
api.nova.aggregate_create(
request,
name=context['name'],
availability_zone=context['availability_zone'])
availability_zone=context['availability_zone'] or None)
except Exception:
exceptions.handle(request, _('Unable to create host aggregate.'))
return False