Omer Frenkel has uploaded a new change for review.

Change subject: core: get 32bit max mem config with default version
......................................................................

core: get 32bit max mem config with default version

currently getting the 32bit max memory config is done with the vm
cluster version, but the 32bit config has 'general' value and not
per-version, making this be not editable by users.

changing the call to use 'general' and not version-specific for 32bit.

Change-Id: I2c4f4921551ade089c3fb3b28352c4a7ab557b87
Signed-off-by: Omer Frenkel <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/RunVmValidator.java
M 
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/validator/RunVmValidatorTest.java
2 files changed, 9 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/06/37906/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/RunVmValidator.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/RunVmValidator.java
index 9d5dc52..70b5337 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/RunVmValidator.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/RunVmValidator.java
@@ -136,10 +136,14 @@
     }
 
     protected ValidationResult validateMemorySize(VM vm) {
-        final ConfigValues configKey = 
getOsRepository().get64bitOss().contains(vm.getOs())
-                ? ConfigValues.VM64BitMaxMemorySizeInMB
-                : ConfigValues.VM32BitMaxMemorySizeInMB;
-        final int maxSize = Config.getValue(configKey, 
vm.getVdsGroupCompatibilityVersion().getValue());
+        int maxSize;
+        if (getOsRepository().get64bitOss().contains(vm.getOs())) {
+            maxSize = Config.getValue(ConfigValues.VM64BitMaxMemorySizeInMB,
+                    vm.getVdsGroupCompatibilityVersion().getValue());
+        } else {
+            maxSize = Config.getValue(ConfigValues.VM32BitMaxMemorySizeInMB);
+        }
+
         if (vm.getMemSizeMb() > maxSize) {
             return new 
ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_MEMORY_EXCEEDS_SUPPORTED_LIMIT);
         }
diff --git 
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/validator/RunVmValidatorTest.java
 
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/validator/RunVmValidatorTest.java
index 556ca2e..552c636 100644
--- 
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/validator/RunVmValidatorTest.java
+++ 
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/validator/RunVmValidatorTest.java
@@ -52,7 +52,7 @@
             mockConfig(ConfigValues.VdsSelectionAlgorithm, "General", "0"),
             mockConfig(ConfigValues.PredefinedVMProperties, "3.0", "0"),
             mockConfig(ConfigValues.UserDefinedVMProperties, "3.0", "0"),
-            mockConfig(ConfigValues.VM32BitMaxMemorySizeInMB, "3.3", 
MEMORY_LIMIT_32_BIT),
+            mockConfig(ConfigValues.VM32BitMaxMemorySizeInMB, "general", 
MEMORY_LIMIT_32_BIT),
             mockConfig(ConfigValues.VM64BitMaxMemorySizeInMB, "3.3", 
MEMORY_LIMIT_64_BIT)
             );
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2c4f4921551ade089c3fb3b28352c4a7ab557b87
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Omer Frenkel <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to