From 2585e64cfd75de49e9dfbf8a545140d90b6d0cc6 Mon Sep 17 00:00:00 2001
From: catborise <catborise@gmail.com>
Date: Wed, 25 Jul 2018 09:33:06 +0300
Subject: [PATCH] While cloning volume it breaks if volume name is longer than
 20 char. It i more realistic longer than 20 char.

---
 instances/models.py |  2 +-
 storages/forms.py   | 14 +++++++-------
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/instances/models.py b/instances/models.py
index fa1ed40..d91370c 100644
--- a/instances/models.py
+++ b/instances/models.py
@@ -4,7 +4,7 @@ from computes.models import Compute
 
 class Instance(models.Model):
     compute = models.ForeignKey(Compute)
-    name = models.CharField(max_length=20)
+    name = models.CharField(max_length=120)
     uuid = models.CharField(max_length=36)
     is_template = models.BooleanField(default=False)
     created = models.DateField(auto_now_add=True)
diff --git a/storages/forms.py b/storages/forms.py
index a4a34bf..ca143e7 100644
--- a/storages/forms.py
+++ b/storages/forms.py
@@ -52,7 +52,7 @@ class AddStgPool(forms.Form):
 
 
 class AddImage(forms.Form):
-    name = forms.CharField(max_length=20)
+    name = forms.CharField(max_length=120)
     format = forms.ChoiceField(required=True, choices=(('qcow2', 'qcow2 (recommended)'),
                                                        ('qcow', 'qcow'),
                                                        ('raw', 'raw')))
@@ -64,14 +64,14 @@ class AddImage(forms.Form):
         have_symbol = re.match('^[a-zA-Z0-9._-]+$', name)
         if not have_symbol:
             raise forms.ValidationError(_('The image name must not contain any special characters'))
-        elif len(name) > 20:
-            raise forms.ValidationError(_('The image name must not exceed 20 characters'))
+        elif len(name) > 120:
+            raise forms.ValidationError(_('The image name must not exceed 120 characters'))
         return name
 
 
 class CloneImage(forms.Form):
-    name = forms.CharField(max_length=20)
-    image = forms.CharField(max_length=20)
+    name = forms.CharField(max_length=120)
+    image = forms.CharField(max_length=120)
     convert = forms.BooleanField(required=False)
     format = forms.ChoiceField(required=False, choices=(('qcow2', 'qcow2 (recommended)'),
                                                         ('qcow', 'qcow'),
@@ -83,6 +83,6 @@ class CloneImage(forms.Form):
         have_symbol = re.match('^[a-zA-Z0-9._-]+$', name)
         if not have_symbol:
             raise forms.ValidationError(_('The image name must not contain any special characters'))
-        elif len(name) > 20:
-            raise forms.ValidationError(_('The image name must not exceed 20 characters'))
+        elif len(name) > 120:
+            raise forms.ValidationError(_('The image name must not exceed 120 characters'))
         return name