Bug 1285446

Summary: Random sub-template of given name is used to create VM Pool via REST
Product: [oVirt] ovirt-engine Reporter: jniederm
Component: BLL.VirtAssignee: Marek Libra <mlibra>
Status: CLOSED CURRENTRELEASE QA Contact: sefi litmanovich <slitmano>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.0.0CC: bugs, gklein, juwu, mavital, mlibra, sbonazzo, tjelinek
Target Milestone: ovirt-4.0.0-alphaKeywords: Improvement
Target Release: 4.0.0Flags: rule-engine: ovirt-4.0.0+
gklein: testing_plan_complete-
rule-engine: planning_ack+
tjelinek: devel_ack+
mavital: testing_ack+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ovirt 4.0.0 alpha1 Doc Type: Enhancement
Doc Text:
When creating a virtual machine using the template name or Blank and not specifying the template version in the REST API, the latest template version is used. Prior to this enhancement, the template version, if not specified, was randomly selected.
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-05 07:44:11 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Virt RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description jniederm 2015-11-25 15:41:50 UTC
Description of problem:
Unspecified sub-template is chosen to create VM Pool when template is specified by name.

Version-Release number of selected component (if applicable):
4.0 master, commit 5e447e0

How reproducible:
Based on order of rows returned from DB

Steps to Reproduce:
1. Create multiple sub-versions of template "t1"
2. REST request
POST /ovirt-engine/api/vmpools HTTP/1.1
Host: localhost:8080
Authorization: Basic YWRtaW5AaW50ZXJuYWw6YQ==
Content-Type: application/xml

<vm_pool>
    <name>pool1</name>
    <cluster>
        <name>Default</name>
    </cluster>
    <template>
        <name>t1</name>
    </template>
</vm_pool>

Actual results:
Pool is created. However the sub-version of template that is picked to base vm pool on depends on order of records returned by "GetVmTemplateByVmtName" stored procedure.

Expected results:
Either the base template or the latest template is always selected.

Additional info:
see: org.ovirt.engine.api.restapi.resource.BackendVmPoolsResource#getVmTemplate

Comment 1 Tomas Jelinek 2015-12-16 08:42:35 UTC
If the template is specified by ID it will work as expected, thus setting target to 4.0

Comment 2 sefi litmanovich 2016-05-24 13:40:14 UTC
Verified with ovirt-engine-4.0.0-0.7.master.el7ev.noarch, vm pool gets the highest version of the template when given only template name in creation via REST.

Comment 3 Sandro Bonazzola 2016-07-05 07:44:11 UTC
oVirt 4.0.0 has been released, closing current release.