Bug 1256411 - [REST-API] changing vmPool name fails if template is not set
[REST-API] changing vmPool name fails if template is not set
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine (Show other bugs)
3.6.0
Unspecified Unspecified
medium Severity low
: ovirt-3.6.0-rc
: 3.6.0
Assigned To: Juan Hernández
sefi litmanovich
: Automation
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-08-24 09:59 EDT by sefi litmanovich
Modified: 2016-04-19 21:37 EDT (History)
10 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1256713 (view as bug list)
Environment:
Last Closed: 2016-04-19 21:37:45 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: Virt
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
oVirt gerrit 45289 master MERGED restapi: Locate VM data using pool id, not name Never
oVirt gerrit 45292 ovirt-engine-3.6 MERGED restapi: Locate VM data using pool id, not name Never

  None (edit)
Description sefi litmanovich 2015-08-24 09:59:00 EDT
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 05:35:36 EDT
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 05:37:01 EDT
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 06:21:12 EDT
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 09:42:42 EDT
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 10:57:02 EDT
yes, bug 1256713 (also you can see it in the 'clones' fields above)

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