Bug 1256411 - [REST-API] changing vmPool name fails if template is not set
Summary: [REST-API] changing vmPool name fails if template is not set
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine
Version: 3.6.0
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: ovirt-3.6.0-rc
: 3.6.0
Assignee: Juan Hernández
QA Contact: sefi litmanovich
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-08-24 13:59 UTC by sefi litmanovich
Modified: 2016-04-20 01:37 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1256713 (view as bug list)
Environment:
Last Closed: 2016-04-20 01:37:45 UTC
oVirt Team: Virt
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


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

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)


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