Jakub Niedermertl has uploaded a new change for review.

Change subject: core: Prevent blank template sub-templates - backend
......................................................................

core: Prevent blank template sub-templates - backend

Change-Id: I88740116070f5cee438038be5a6375a2243acae6
Bug-Url: https://bugzilla.redhat.com/1205813
Signed-off-by: Jakub Niedermertl <jnied...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmTemplateCommand.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
M backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
3 files changed, 9 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/99/40499/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmTemplateCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmTemplateCommand.java
index f8469b0..f009b0a 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmTemplateCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmTemplateCommand.java
@@ -454,6 +454,10 @@
             }
         }
 
+        if (isTemplateVersion() && getBaseTemplate().isBlank()) {
+            return 
failCanDoAction(VdcBllMessages.BLANK_TEMPLATE_CANT_HAVE_SUBTEMPLATES);
+        }
+
         if (!setAndValidateDiskProfiles()) {
             return false;
         }
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
index 76dc60c..56d26ca 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
@@ -1227,7 +1227,9 @@
     VM_ICON_MIME_TYPE_DOESNT_MATCH_IMAGE_DATA,
     PROVIDED_VM_ICON_HAS_INVALID_DIMENSIONS,
     DATA_SIZE_OF_PROVIDED_VM_ICON_TOO_LARGE,
-    VM_ICON_BASE64_PART_MALFORMED;
+    VM_ICON_BASE64_PART_MALFORMED,
+
+    BLANK_TEMPLATE_CANT_HAVE_SUBTEMPLATES;
 
     private ErrorType messageType;
 
diff --git 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
index 29fd4ad..9e7c463 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
@@ -1426,3 +1426,5 @@
 PROVIDED_VM_ICON_HAS_INVALID_DIMENSIONS=Vm icon has invalid dimensions 
(${currentDimensions}). Allowed dimmension: ${allowedDimensions}
 DATA_SIZE_OF_PROVIDED_VM_ICON_TOO_LARGE=Data size of provided icon 
(${$currentSize}) is to big. Maximum allowd is ${$maxSize}
 VM_ICON_BASE64_PART_MALFORMED=Base64 part of vm icon is malformed.
+
+BLANK_TEMPLATE_CANT_HAVE_SUBTEMPLATES=Blank template can't have sub-templates.


-- 
To view, visit https://gerrit.ovirt.org/40499
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I88740116070f5cee438038be5a6375a2243acae6
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Jakub Niedermertl <jnied...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to