Bug 1423468 - the quota value of datacenter - verify for sane values
Summary: the quota value of datacenter - verify for sane values
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: Frontend.WebAdmin
Version: 4.1.1.2
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: ovirt-4.1.2
: 4.1.2
Assignee: Tony Wang
QA Contact: Artyom
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-02-17 11:47 UTC by Tony Wang
Modified: 2017-05-23 08:12 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: No Doc Update
Doc Text:
undefined
Clone Of:
Environment:
Last Closed: 2017-05-23 08:12:37 UTC
oVirt Team: SLA
Embargoed:
rule-engine: ovirt-4.1+
rule-engine: planning_ack+
dfediuck: devel_ack+
mavital: testing_ack+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 72669 0 master MERGED webadmin: Add specialized validation for Long values 2017-03-02 08:58:43 UTC
oVirt gerrit 73421 0 ovirt-engine-4.1 MERGED webadmin: Add specialized validation for Long values 2017-03-02 09:35:23 UTC

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"


Note You need to log in before you can comment on or make changes to this bug.