Arik Hadas has uploaded a new change for review.

Change subject: core: prevent guaranteed memory bigger than memory size
......................................................................

core: prevent guaranteed memory bigger than memory size

Change-Id: I75a4b997fc4d3fe2484fa4189ec6ca1e6cf01079
Bug-Url: https://bugzilla.redhat.com/1045131
Signed-off-by: Arik Hadas <aha...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmCommand.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
M 
frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
M 
frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
M 
frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
6 files changed, 11 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/75/25775/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmCommand.java
index ecd8c1e..33f1fc1 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmCommand.java
@@ -426,6 +426,10 @@
             return 
failCanDoAction(VdcBllMessages.VM_CANNOT_UPDATE_DEVICE_VM_NOT_DOWN, "$device 
VirtIO-SCSI");
         }
 
+        if (vmFromParams.getMinAllocatedMem() > vmFromParams.getMemSizeMb()) {
+            return 
failCanDoAction(VdcBllMessages.VM_MIN_MEMORY_CANNOT_EXCEED_VM_MEMORY);
+        }
+
         return true;
     }
 
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 6ca8dd4..f1b2f77 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
@@ -345,6 +345,7 @@
     VM_TEMPLATE_IMAGE_LAST_DOMAIN(ErrorType.CONFLICT),
     VM_CANNOT_UPDATE_ILLEGAL_FIELD(ErrorType.BAD_PARAMETERS),
     VM_CANNOT_UPDATE_DEVICE_VM_NOT_DOWN(ErrorType.BAD_PARAMETERS),
+    VM_MIN_MEMORY_CANNOT_EXCEED_VM_MEMORY(ErrorType.BAD_PARAMETERS),
     MAC_POOL_NOT_ENOUGH_MAC_ADDRESSES(ErrorType.CONFLICT),
     VM_CANNOT_MOVE_TO_CLUSTER_IN_OTHER_STORAGE_POOL(ErrorType.CONFLICT),
     VM_CLUSTER_IS_NOT_VALID(ErrorType.BAD_PARAMETERS),
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 f15b551..c28b417 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
@@ -30,6 +30,7 @@
 VM_NAME_CANNOT_BE_EMPTY=VM Name cannot be empty.
 VM_CANNOT_UPDATE_ILLEGAL_FIELD=There was an attempt to change VM values while 
the VM is not down. Please shut down the VM in order to modify these properties.
 VM_CANNOT_UPDATE_DEVICE_VM_NOT_DOWN=Failed updating the properties of the VM. 
VM should be in status Down in order to change the ${device} device.
+VM_MIN_MEMORY_CANNOT_EXCEED_VM_MEMORY=Physical Memory Guaranteed cannot exceed 
VM Memory Size.
 VM_CANNOT_RUN_FROM_NETWORK_WITHOUT_NETWORK=VM is configured to be 'Network 
bootable', but no Network Interface is configured.\n\
 Alternatives:\n\
        -Select a different boot device (using the 'Run Once' command or 'Edit 
VM' command on Boot Option Sub-Tab).\n\
diff --git 
a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
 
b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
index b2ed4b2..67f0e8f 100644
--- 
a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
+++ 
b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
@@ -94,6 +94,9 @@
     @DefaultStringValue("Failed updating the properties of the VM. VM should 
be in status Down in order to change the ${device} device.")
     String VM_CANNOT_UPDATE_DEVICE_VM_NOT_DOWN();
 
+    @DefaultStringValue("Physical Memory Guaranteed cannot exceed VM Memory 
Size")
+    String VM_MIN_MEMORY_CANNOT_EXCEED_VM_MEMORY();
+
     @DefaultStringValue("VM is configured to be 'Network bootable', but no 
Network Interface is configured.\nAlternatives:\n-Select a different boot 
device (using the 'Run Once' command or 'Edit VM' command on Boot Option 
Sub-Tab).\n-Configure Network Interface and rerun the VM.")
     String VM_CANNOT_RUN_FROM_NETWORK_WITHOUT_NETWORK();
 
diff --git 
a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
 
b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
index 4205cfe..89e5051 100644
--- 
a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
+++ 
b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
@@ -30,6 +30,7 @@
 VM_NAME_CANNOT_BE_EMPTY=VM Name cannot be empty.
 VM_CANNOT_UPDATE_ILLEGAL_FIELD=There was an attempt to change VM values while 
the VM is not down. Please shut down the VM in order to modify these properties.
 VM_CANNOT_UPDATE_DEVICE_VM_NOT_DOWN=Failed updating the properties of the VM. 
VM should be in status Down in order to change the ${device} device.
+VM_MIN_MEMORY_CANNOT_EXCEED_VM_MEMORY=Physical Memory Guaranteed cannot exceed 
VM Memory Size.
 VM_CANNOT_RUN_FROM_NETWORK_WITHOUT_NETWORK=VM is configured to be 'Network 
bootable', but no Network Interface is configured.\n\
 Alternatives:\n\
        -Select a different boot device (using the 'Run Once' command or 'Edit 
VM' command on Boot Option Sub-Tab).\n\
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
 
b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
index 5427b22..4ff272a 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
+++ 
b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
@@ -30,6 +30,7 @@
 VM_NAME_CANNOT_BE_EMPTY=VM Name cannot be empty.
 VM_CANNOT_UPDATE_ILLEGAL_FIELD=There was an attempt to change VM values while 
the VM is not down. Please shut down the VM in order to modify these properties.
 VM_CANNOT_UPDATE_DEVICE_VM_NOT_DOWN=Failed updating the properties of the VM. 
VM should be in status Down in order to change the ${device} device.
+VM_MIN_MEMORY_CANNOT_EXCEED_VM_MEMORY=Physical Memory Guaranteed cannot exceed 
VM Memory Size.
 VM_CANNOT_RUN_FROM_NETWORK_WITHOUT_NETWORK=VM is configured to be 'Network 
bootable', but no Network Interface is configured.\n\
 Alternatives:\n\
        -Select a different boot device (using the 'Run Once' command or 'Edit 
VM' command on Boot Option Sub-Tab).\n\


-- 
To view, visit http://gerrit.ovirt.org/25775
To unsubscribe, visit http://gerrit.ovirt.org/settings

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

Reply via email to