Add empty name check to volume types
As cinder doesn't allow creating volume types with empty name, so add a check for that on horizon. Change-Id: Ie795e54952e92dd9a198306306ffead0cc84ca99 Closes-Bug: #1357586
This commit is contained in:
parent
4a6458366c
commit
0c70bf4204
|
@ -168,6 +168,13 @@ class UnmanageVolume(forms.SelfHandlingForm):
|
|||
class CreateVolumeType(forms.SelfHandlingForm):
|
||||
name = forms.CharField(max_length=255, label=_("Name"))
|
||||
|
||||
def clean_name(self):
|
||||
cleaned_name = self.cleaned_data['name']
|
||||
if len(cleaned_name.strip()) == 0:
|
||||
raise ValidationError(_('Volume type name can not be empty.'))
|
||||
|
||||
return cleaned_name
|
||||
|
||||
def handle(self, request, data):
|
||||
try:
|
||||
# Remove any new lines in the public key
|
||||
|
|
Loading…
Reference in New Issue