Bug 1379802

Summary: VmPool creation won't honor template's quota
Product: [oVirt] ovirt-engine Reporter: nicolas
Component: Backend.CoreAssignee: Andrej Krejcir <akrejcir>
Status: CLOSED CURRENTRELEASE QA Contact: sefi litmanovich <slitmano>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 3.6.7CC: akrejcir, bugs, juan.hernandez, nicolas
Target Milestone: ovirt-4.0.5Keywords: ZStream
Target Release: 4.0.5.1Flags: msivak: ovirt-4.0.z?
rule-engine: planning_ack?
msivak: devel_ack+
rule-engine: testing_ack+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-01-18 07:35:38 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:
Attachments:
Description Flags
Debug log of the vmpool.add() call none

Description nicolas 2016-09-27 17:15:35 UTC
Description of problem:

When deploying a VmPool using the Python-SDK interface, the Quota is replaced by the first available one in the list of Quotas instead of using the one's that set in the template.

  pool = params.VmPool(name='TEST', cluster=api.clusters.get(name='Whatever'), template=api.templates.get(id='f377eb7f-885c-4443-9b0c-bf6ba8e34c21'), max_user_vms=1, size=1, type_='manual')
  api.vmpools.add(pool)

Template with the specified ID has a quota called 'X', when deploying the pool the quota is overridden by the first available in the list of quotas instead of 'X'.

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

3.6.7.0

How reproducible:

Always

Comment 1 Juan Hernández 2016-09-27 17:51:55 UTC
I believe that the SDK isn't the source of this problem. However, to verify that I would need to see what is the request sent by the SDK when you run that script. Can you add the "debug=True" parameter to the constructor of the API object, run the script and share the ouptut?

Note that the output will contain the HTTP "Authorization" header, including your user name and password. Make sure to remove it before sharing.

In addition I'd suggest to avoid setting the "cluster" and "template" parameters to the objects obtained from "api.clusters.get" and "api.templates.get", as then you will be sending to the server the complete representation of these objects, when you only need the id/name. Try to do the following instead:

  cluster = api.clusters.get(name='...')
  template = api.templates.gete(name='...')
  pool = params.VmPool(
    name='TEST',
    cluster=params.Cluster(id=cluster.get_id()),
    template=params.Template(id=template.get_id()),
    ...
  )

Comment 2 nicolas 2016-09-27 18:02:47 UTC
Created attachment 1205289 [details]
Debug log of the vmpool.add() call

Log attached.

Comment 3 Juan Hernández 2016-09-27 18:29:48 UTC
Thanks, that confirms that the SDK isn't the cause of the problem, as it is sending the expected request. I'am moving the bug to the backend component and to the SLA team for further investigation.

Comment 4 nicolas 2016-09-27 19:20:46 UTC
Just to clarify (FWIW): Our oVirt engine version is 4.0.3, but due to compatibility reasons regarding an app, our Python-SDK version is 3.6.7.

Comment 5 Andrej Krejcir 2016-09-29 12:47:27 UTC
Currently, REST api ignores template's quota.

Comment 6 sefi litmanovich 2016-10-31 16:49:21 UTC
Hi Verified with rhevm-4.0.5.4-0.1.el7ev.noarch according the following flow:

1. Create 3 qoutas in DC - a,b,z
2. Set the qouta mode in DC to audit*
3. Edit a template in the DC and set qouta to 'z'
4. Create a vm pool from the template via API (I wasn't sure if at the end it has something to do with API or not).

Result:
The vm pool and all vms in it are set t qouta 'z' as expected.

*
Is this the correct flow?
What was the qouta mode on the DC when the template was created?
and when the vm pool was created?

Comment 7 nicolas 2016-10-31 17:28:04 UTC
The VMpools don't have to be created via the API, the problem just happens when *moving* the disk of a VM that is part of a VMpool via the API.

In any moment the quota mode has been 'audit': Both at template creation time and the VM creation time.

Otherwise the flow is correct.

Comment 8 nicolas 2016-10-31 17:35:25 UTC
Argh, sorry, disregard the first line in the last comment, I mixed up two BZ.

The correct sentence is: As per my tests, yes, the VMpool is created via the Python SDK (thus using the API). That is when it doesn't honor the Quota. When the VMpool is created via the webadmin the Quota is respected.