Martin Betak has uploaded a new change for review.

Change subject: webadmin: Change valid range for VmPool.MaxAssignedVmsPerUser
......................................................................

webadmin: Change valid range for VmPool.MaxAssignedVmsPerUser

Enable VmPools to have MaxAssignedVmsPerUser any value in
the range 1..Integer.INT_MAX.

This simplifies the validation and also enables to set this
property during the creation of the VmPool which was not
possible since the valid range was 1..AssignedVmsCount.

Change-Id: Ibf343108620e3625696711750f7e82416b7050e0
Signed-off-by: Martin Betak <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommonVmPoolWithVmsCommand.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmPool.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/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationMessages.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewPoolModelBehavior.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/PoolModelBehaviorBase.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
9 files changed, 7 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/00/17000/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommonVmPoolWithVmsCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommonVmPoolWithVmsCommand.java
index fb88a9c..4758cd4 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommonVmPoolWithVmsCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommonVmPoolWithVmsCommand.java
@@ -237,12 +237,6 @@
             return false;
         }
 
-        pool = getParameters().getVmPool();
-        if (pool.getMaxAssignedVmsPerUser() < 1 || 
pool.getMaxAssignedVmsPerUser() > pool.getAssignedVmsCount()) {
-            
addCanDoActionMessage(VdcBllMessages.VM_POOL_NUMBER_OF_ASSIGNED_VMS_OUT_OF_RANGE);
-            return false;
-        }
-
         return checkFreeSpaceAndTypeOnDestDomains();
     }
 
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmPool.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmPool.java
index de08fc3..1ebfa78 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmPool.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmPool.java
@@ -2,6 +2,7 @@
 
 import java.io.Serializable;
 
+import javax.validation.constraints.Min;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Pattern;
 import javax.validation.constraints.Size;
@@ -50,6 +51,7 @@
 
     private int vmPoolRunningCount = 1;
 
+    @Min(value = 1, message = 
"VALIDATION.VM_POOLS.NUMBER_OF_MAX_ASSIGNED_VMS_OUT_OF_RANGE")
     private int maxAssignedVmsPerUser = 1;
 
     public static final char MASK_CHARACTER = '?';
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 0b896f6..3be74a4 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
@@ -348,7 +348,6 @@
     VM_POOL_CANNOT_CREATE_FROM_BLANK_TEMPLATE(ErrorType.CONFLICT),
     VM_POOL_CANNOT_UPDATE_POOL_NOT_FOUND(ErrorType.BAD_PARAMETERS),
     VM_POOL_CANNOT_DECREASE_VMS_FROM_POOL(ErrorType.BAD_PARAMETERS),
-    VM_POOL_NUMBER_OF_ASSIGNED_VMS_OUT_OF_RANGE(ErrorType.CONFLICT),
     VM_POOL_CANNOT_ATTACH_TO_MORE_VMS_FROM_POOL(ErrorType.CONFLICT),
     ACTION_TYPE_FAILED_VM_FROM_POOL_CANNOT_BE_STATELESS(ErrorType.CONFLICT),
     DIRECTORY_COMPUTER_WITH_THE_SAME_NAME_ALREADY_EXITS(ErrorType.CONFLICT),
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 9c9264a..f042ae0 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
@@ -123,7 +123,6 @@
 VM_POOL_CANNOT_REMOVE_VM_POOL_WITH_VMS=Cannot remove VM-Pool. Detach VMs from 
VM-Pool first.
 VM_POOL_CANNOT_REMOVE_RUNNING_VM_FROM_POOL=Cannot detach VM from VM-Pool. VM 
is running.
 VM_POOL_CANNOT_ADD_RUNNING_VM_TO_POOL=Cannot attach VM to VM-Pool. VM is 
running.
-VM_POOL_NUMBER_OF_ASSIGNED_VMS_OUT_OF_RANGE=Number of max assigned VMs per 
user must be between 1 and the current size of the VM-Pool.
 VM_INVALID_SERVER_CLUSTER_ID=Invalid Host Cluster id.
 VMT_CANNOT_CREATE_TEMPLATE_FROM_DOWN_VM=Cannot ${action} ${type}. VM still 
running, stop the VM and try again.
 VMT_CANNOT_REMOVE_BLANK_TEMPLATE=Cannot ${action} ${type}. Removing Blank 
Template is not allowed.
@@ -633,6 +632,7 @@
 VALIDATION_STORAGE_CONNECTION_EMPTY_CONNECTION=${fieldName} field cannot be 
empty.
 VALIDATION.TAGS.INVALID_TAG_NAME=Invalid tag name. Only alphanumeric chars, 
'-' and '_' characters are valid
 VALIDATION.VM_POOLS.NAME.NOT_NULL=Pool name is required
+VALIDATION.VM_POOLS.NUMBER_OF_MAX_ASSIGNED_VMS_OUT_OF_RANGE=Number of max 
assigned VMs per user must be at least 1.
 VALIDATION.ROLES.NAME.NOT_NULL=Role name is required
 VALIDATION.ROLES.NAME.MAX=Role name must not exceed 126 characters
 VALIDATION.ROLES.NAME.INVALID=Role name must be formed of "a-z0-9A-Z" or "-_"
diff --git 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationMessages.java
 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationMessages.java
index 575c737..b81acb0 100644
--- 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationMessages.java
+++ 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationMessages.java
@@ -62,7 +62,7 @@
             + "pool'' the generated names will be: 
my01pool,my02pool,...my99pool")
     String poolNameHelp();
 
-    @DefaultMessage("Maximum number of VMs a single user can attach to from 
this pool. Accepted values: 1 to the Number of VMs that already exists in the 
Pool.")
+    @DefaultMessage("Maximum number of VMs a single user can attach to from 
this pool. This field must be at least 1.")
     String maxAssignedVmsPerUserHelp();
 
     @DefaultMessage("Free: {0} vCPU")
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewPoolModelBehavior.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewPoolModelBehavior.java
index 3ff82f2..43dcbe9 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewPoolModelBehavior.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewPoolModelBehavior.java
@@ -18,7 +18,6 @@
         super.initialize(systemTreeSelectedItem);
 
         getModel().getVmType().setIsChangable(true);
-        getModel().getMaxAssignedVmsPerUser().setIsChangable(false);
     }
 
     @Override
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/PoolModelBehaviorBase.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/PoolModelBehaviorBase.java
index 8794516..bba2966 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/PoolModelBehaviorBase.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/PoolModelBehaviorBase.java
@@ -301,7 +301,7 @@
                 new IValidation[]
                 {
                         new NotEmptyValidation(),
-                        new IntegerValidation(1, assignedVms)
+                        new IntegerValidation(1, Integer.MAX_VALUE)
                 });
 
         getModel().setIsGeneralTabValid(getModel().getIsGeneralTabValid()
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 63373a5..9315f9f 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
@@ -316,7 +316,6 @@
 USB_LEGACY_NOT_SUPPORTED_ON_LINUX_VMS=Legacy USB support is not available on 
Linux VMs.
 VM_POOL_CANNOT_CREATE_FROM_BLANK_TEMPLATE=VM-Pool must be based on  non-blank 
Template.
 VM_POOL_CANNOT_UPDATE_POOL_NOT_FOUND=Cannot edit VM-Pool properties - VM-Pool 
not found.
-VM_POOL_NUMBER_OF_ASSIGNED_VMS_OUT_OF_RANGE=Number of max assigned VMs per 
user must be between 1 and the current size of the pool.
 ACTION_TYPE_FAILED_VM_TASKS_ARE_ALREADY_RUNNING=Cannot ${action} ${type}. 
There are already asynchronous running tasks, please retry later.
 VM_CANNOT_SUSPENDE_HAS_RUNNING_TASKS=Cannot suspend VM. VM has asynchronous 
running tasks, please retry later.
 VM_CANNOT_SUSPEND_STATELESS_VM=Cannot suspend VM, VM is stateless.
@@ -659,6 +658,7 @@
 VALIDATION_VM_NETWORK_NAME_NOT_NULL=Interface name is required.
 VALIDATION.REPETITIVE.IP.IN.VDS=Invalid list of interfaces, two or more 
network interfaces have the same IP.
 VALIDATION_VDS_PORT_RANGE=The Port number must be between 1 and 65535.
+VALIDATION.VM_POOLS.NUMBER_OF_MAX_ASSIGNED_VMS_OUT_OF_RANGE=Number of max 
assigned VMs per user must be at least 1.
 ERROR_CANNOT_FIND_ISO_IMAGE_PATH=Invalid ISO image path
 ERROR_CANNOT_FIND_FLOPPY_IMAGE_PATH=Invalid Floppy image path
 VDS_ADD_STORAGE_SERVER_STATUS_MUST_BE_UP=Cannot add storage server connection 
when Host status is not up
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 839defb..0fae8d5 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
@@ -333,7 +333,6 @@
 USB_LEGACY_NOT_SUPPORTED_ON_LINUX_VMS=Legacy USB support is not available on 
Linux VMs.
 VM_POOL_CANNOT_CREATE_FROM_BLANK_TEMPLATE=VM-Pool must be based on  non-blank 
Template.
 VM_POOL_CANNOT_UPDATE_POOL_NOT_FOUND=Cannot edit VM-Pool properties - VM-Pool 
not found.
-VM_POOL_NUMBER_OF_ASSIGNED_VMS_OUT_OF_RANGE=Number of max assigned VMs per 
user must be between 1 and the current size of the VM-Pool.
 VM_POOL_CANNOT_ATTACH_TO_MORE_VMS_FROM_POOL=User is already attached to 
maximum number of VMs from this VM-Pool.
 ACTION_TYPE_FAILED_VM_TASKS_ARE_ALREADY_RUNNING=Cannot ${action} ${type}. 
There are already asynchronous running tasks, please retry later.
 VM_CANNOT_SUSPENDE_HAS_RUNNING_TASKS=Cannot suspend VM. VM has asynchronous 
running tasks, please retry later.
@@ -678,6 +677,7 @@
 VALIDATION_CONNECTIVITY_TIMEOUT_INVALID=Connectivity timeout is not valid. 
Timeout must be between 1 and 120.
 VALIDATION.REPETITIVE.IP.IN.VDS=Invalid list of interfaces, two or more 
network interfaces have the same IP.
 VALIDATION_VDS_PORT_RANGE=The Port number must be between 1 and 65535.
+VALIDATION.VM_POOLS.NUMBER_OF_MAX_ASSIGNED_VMS_OUT_OF_RANGE=Number of max 
assigned VMs per user must be at least 1.
 ERROR_CANNOT_FIND_ISO_IMAGE_PATH=Invalid ISO image path
 ERROR_CANNOT_FIND_FLOPPY_IMAGE_PATH=Invalid Floppy image path
 VDS_ADD_STORAGE_SERVER_STATUS_MUST_BE_UP=Cannot add storage server connection 
when Host status is not up


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

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

Reply via email to