锡亮 马 has uploaded a new change for review.

Change subject: engine: Modify memory verify mode for synchronous mode in 
template and vm module.
......................................................................

engine: Modify memory verify mode for synchronous mode in template and vm 
module.

When add or edit vm and template, memory settings are invalid values can be 
saved.
Memory verify mode should not be asynchronous.

Signed-off-by: maxl <[email protected]>

Change-Id: Id0dd06b1af4a5e24c5f5d88d442466e5a2752e45
Signed-off-by: maxl <[email protected]>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java
1 file changed, 20 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/17/24217/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java
index 164633d..b8bcbfd 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java
@@ -2320,6 +2320,16 @@
         return null;
     }
 
+    private int _maxMemSize = 64000;
+
+    public int get_maxMemSize() {
+        return _maxMemSize;
+    }
+
+    public void set_maxMemSize(int _maxMemSize) {
+        this._maxMemSize = _maxMemSize;
+    }
+
     public boolean validate() {
         getDataCenterWithClustersList().validateSelectedItem(new IValidation[] 
{ new NotEmptyValidation() });
         getMemSize().validateEntity(new IValidation[] { new 
ByteSizeValidation() });
@@ -2363,13 +2373,18 @@
             asyncQuery.asyncCallback = new INewAsyncCallback() {
                 @Override
                 public void onSuccess(Object model, Object returnValue) {
-                    validateMemorySize(getMemSize(), 
(Integer)((VdcQueryReturnValue)returnValue).getReturnValue(), _minMemSize);
-                    if (!(((UnitVmModel)model).getBehavior() instanceof 
TemplateVmModelBehavior)) {
-                        // Minimum 'Physical Memory Guaranteed' is 1MB
-                        validateMemorySize(getMinAllocatedMemory(), 
getMemSize().getEntity(), 1);
-                    }
+                    
set_maxMemSize((Integer)((VdcQueryReturnValue)returnValue).getReturnValue());
                 }
             };
+            validateMemorySize(getMemSize(), get_maxMemSize(), _minMemSize);
+            if (!(getBehavior() instanceof TemplateVmModelBehavior)) {
+                // Minimum 'Physical Memory Guaranteed' is 1MB
+                if (getMemSize().getEntity() == 0) {
+                    validateMemorySize(getMinAllocatedMemory(), 
get_maxMemSize(), 1);
+                } else {
+                    validateMemorySize(getMinAllocatedMemory(), 
getMemSize().getEntity(), 1);
+                }
+            }
 
             if (getSelectedCluster() != null) {
                 AsyncDataProvider.getOsMaxRam(osType, 
getSelectedCluster().getcompatibility_version(), asyncQuery);


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

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

Reply via email to