Bug 1423468

Summary: the quota value of datacenter - verify for sane values
Product: [oVirt] ovirt-engine Reporter: Tony Wang <Sline798>
Component: Frontend.WebAdminAssignee: Tony Wang <Sline798>
Status: CLOSED CURRENTRELEASE QA Contact: Artyom <alukiano>
Severity: low Docs Contact:
Priority: unspecified    
Version: 4.1.1.2CC: bugs, dfediuck, lveyde, Sline798, tnisan
Target Milestone: ovirt-4.1.2Keywords: Triaged
Target Release: 4.1.2Flags: rule-engine: ovirt-4.1+
rule-engine: planning_ack+
dfediuck: devel_ack+
mavital: testing_ack+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
undefined
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-05-23 08:12:37 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: SLA RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Tony Wang 2017-02-17 11:47:40 UTC
Description of problem:
Set Quota to some special value cannot run VM.

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.Edit a DataCenter, set Quota Mode to "Audit"
2.Switch to the sub-tab of Quota, Add a Qouta
3.Input a name, and Click the button of 'Edit', popup the sub window of "Edit Quota"
4.Set Memory limit to 0 MB, and CPU limit to 1 vCPUS, Save the data
5.Save the Quota data.
6.New a VM, select the Quota of above Adding, set other abtributes of VM, Save the VM data.
7.Run this VM.

Actual results:
Cannot run this VM

Expected results:
If cannot run this VM, give some information or make some strict limitation to the quota's value.

Additional info:

Comment 1 Doron Fediuck 2017-02-19 11:14:33 UTC
Tony,
Audit should only warn (as opposed to enforcing mode).
Can you please provide the engine log?

Comment 2 Tony Wang 2017-02-20 07:18:16 UTC
When i do this operation, the engine log:

2017-02-20 19:43:11,751+08 INFO  [org.ovirt.engine.core.bll.RunVmCommand] (default task-2) [5656603e-294b-4bc7-afee-0c36bc00b5b6] Lock Acquired to object 'EngineLock:{exclusiveLocks='[22cd3033-06b0-4469-8236-a2f484dd6420=<VM, ACTION_TYPE_FAILED_OBJECT_LOCKED>]', sharedLocks='null'}'
2017-02-20 19:43:11,778+08 INFO  [org.ovirt.engine.core.vdsbroker.IsVmDuringInitiatingVDSCommand] (default task-2) [5656603e-294b-4bc7-afee-0c36bc00b5b6] START, IsVmDuringInitiatingVDSCommand( IsVmDuringInitiatingVDSCommandParameters:{runAsync='true', vmId='22cd3033-06b0-4469-8236-a2f484dd6420'}), log id: 1e6fdfa5
2017-02-20 19:43:11,779+08 INFO  [org.ovirt.engine.core.vdsbroker.IsVmDuringInitiatingVDSCommand] (default task-2) [5656603e-294b-4bc7-afee-0c36bc00b5b6] FINISH, IsVmDuringInitiatingVDSCommand, return: false, log id: 1e6fdfa5
2017-02-20 19:43:11,802+08 WARN  [org.ovirt.engine.core.bll.RunVmCommand] (default task-2) [5656603e-294b-4bc7-afee-0c36bc00b5b6] Validation of action 'RunVm' failed for user admin@internal-authz. Reasons: VAR__ACTION__RUN,VAR__TYPE__VM
2017-02-20 19:43:11,803+08 INFO  [org.ovirt.engine.core.bll.RunVmCommand] (default task-2) [5656603e-294b-4bc7-afee-0c36bc00b5b6] Lock freed to object 'EngineLock:{exclusiveLocks='[22cd3033-06b0-4469-8236-a2f484dd6420=<VM, ACTION_TYPE_FAILED_OBJECT_LOCKED>]', sharedLocks='null'}'

Here are some of my conclusions:

The basic reason: Use the IntegerValidation validate Long type value in EditQuotaClusterModel and EditQuotaStorageModel.

In the IntegerValidation, the validate(Object value) method need the value's type is Integer, but the LongEntityModelTextBoxEditor will provide a Long type value. Use IntegerValidation validate Long type value will cause some mistakes. 
Such as, the value 0 can pass the Validatioin, but in the QuotaManager, the checkQuotaClusterLimits(...) need the vCUPs > 0 and MemorySize > 0.

Comment 3 Tal Nisan 2017-03-02 09:36:24 UTC
Thanks for your contribution Tony!

Comment 4 Artyom 2017-04-26 14:08:26 UTC
Verified on rhevm-4.1.2-0.1.el7.noarch
UI does not allow to set memory 0 to the quota
Message:
"This field must contain a number greater than or equal to 1"