Bug 1256411

Summary: [REST-API] changing vmPool name fails if template is not set
Product: Red Hat Enterprise Virtualization Manager Reporter: sefi litmanovich <slitmano>
Component: ovirt-engineAssignee: Juan Hernández <juan.hernandez>
Status: CLOSED CURRENTRELEASE QA Contact: sefi litmanovich <slitmano>
Severity: low Docs Contact:
Priority: medium    
Version: 3.6.0CC: bazulay, gklein, juan.hernandez, lsurette, mavital, michal.skrivanek, rbalakri, Rhev-m-bugs, srevivo, ykaul
Target Milestone: ovirt-3.6.0-rcKeywords: Automation
Target Release: 3.6.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1256713 (view as bug list) Environment:
Last Closed: 2016-04-20 01:37:45 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 sefi litmanovich 2015-08-24 13:59:00 UTC
Description of problem:

During automated testing we change a vmPool's name. This option is supposed to be blocked and it is blocked on UI.
Furthermore another small thing which I find strange is a difference between the results of the same update with a slightly different body message:

say my template's name is 'test'

1. if I try the name like this:

HEADERS:
"Content-Type: application/xml" 
"Accept: application/x-virt-viewer" 

PUT https://{engine_ip}/ovirt-engine/api/vmpools/{vm_pool_id}/

body:

<vmpool href= "/ovirt-engine/api/vmpools/{vm_pool_id}" id="{vm_pool_id}">
<actions>
<link href= "/ovirt-engine/api/vmpools/{vm_pool_id}/allocatevm" rel="allocatevm"/>
</actions>
<name>test-sefi</name>
<description/>
<link href= "/ovirt-engine/api/vmpools/{vm_pool_id}/permissions" rel="permissions"/>
<size>3</size>
<cluster href= "/ovirt-engine/api/clusters/{cluster_id}" id="{cluster_id}"/>
<template href= "/ovirt-engine/api/templates/{template_id}" id="{template_id}"/>
<prestarted_vms>0</prestarted_vms>
<max_user_vms>1</max_user_vms>
</vmpool>

the name of the pool changes to 'test-sefi' as opposed to expected behaviour.

2. if I chang the body message so it doesn't include the cluster_id and template_id, like so:

body:

<vmpool href= "/ovirt-engine/api/vmpools/{vm_pool_id}" id="{vm_pool_id}">
<actions>
<link href= "/ovirt-engine/api/vmpools/{vm_pool_id}/allocatevm" rel="allocatevm"/>
</actions>
<name>test-sefi</name>
<description/>
<link href= "/ovirt-engine/api/vmpools/{vm_pool_id}/permissions" rel="permissions"/>
<size>3</size>
<prestarted_vms>0</prestarted_vms>
<max_user_vms>1</max_user_vms>
</vmpool>

I get status code 404:

<fault>
<reason>Operation Failed</reason>
<detail>Entity not found: Vms: pool=test-sefi</detail>
</fault>

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

rhevm-3.6.0-0.12.master.el6

How reproducible:

always

Steps to Reproduce:

1. Create pool with name 'test'.
2. try to change name as mentioned above (1)

Actual results:

Name of the vmPool changes.

Expected results:

operation should fail with informative message explaining that vmPool name cannot be changed.

Additional info:

Comment 1 Juan Hernández 2015-08-25 09:35:36 UTC
When a the template isn't given as part of the request the RESTAPI has to find it, and in order to do so it has to locate the VM data of the pool. To do this it uses the name of the pool. If the name of the pool is modified in the same requests the RESTAPI uses the new name instead of the old one. This needs to be fixed:

  restapi: Locate VM data using pool id, not name
  https://gerrit.ovirt.org/45289

Comment 2 Juan Hernández 2015-08-25 09:37:01 UTC
I think that the issue described in the previous comment should be fixed in 3.6, consider re-targeting the bug.

Making the name editable or not is outside of the scope of the RESTAPI.

Comment 3 Omer Frenkel 2015-08-25 10:21:12 UTC
ok, i am splitting this bug to 2:
this bug will focus on failure to update vm-pool while changing the name without setting the template. - target to 3.6

and a new bug to focus on disable changing vm-pool name, on the backend for 4.0

Comment 4 sefi litmanovich 2015-09-20 13:42:42 UTC
Verified with rhevm-3.6.0-0.16.master.el6.noarch according to the description.
Verification refers to changing pool name without setting the template.

As for the second bz omer mentioned, was it opened?

Comment 5 Omer Frenkel 2015-09-20 14:57:02 UTC
yes, bug 1256713 (also you can see it in the 'clones' fields above)