Bug 1256713 - [REST-API] changing vmPool name is possible through rest-api
[REST-API] changing vmPool name is possible through rest-api
Status: VERIFIED
Product: ovirt-engine
Classification: oVirt
Component: General (Show other bugs)
---
Unspecified Unspecified
medium Severity low (vote)
: ovirt-4.2.0
: pre-alpha
Assigned To: Shahar Havivi
Israel Pinto
: Automation
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-08-25 06:18 EDT by Omer Frenkel
Modified: 2017-08-15 06:43 EDT (History)
16 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1256411
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: Virt
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
shavivi: needinfo-
rule-engine: ovirt‑4.2+
rule-engine: planning_ack+
rule-engine: devel_ack+
mavital: testing_ack+


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
oVirt gerrit 73155 master MERGED core: update vm pool is not enforced by the engine. 2017-02-28 01:41 EST

  None (edit)
Description Omer Frenkel 2015-08-25 06:18:56 EDT
+++ This bug was initially created as a clone of Bug #1256411 +++

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:

--- Additional comment from Juan Hernández on 2015-08-25 12:35:36 IDT ---

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

--- Additional comment from Juan Hernández on 2015-08-25 12:37:01 IDT ---

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 1 Omer Frenkel 2015-08-25 06:22:59 EDT
please note, bug 1256411 fix the failure for updating vm-pool name without setting the template.

this bug is to disable the edit of vm-pool in the engine.
Comment 3 Red Hat Bugzilla Rules Engine 2015-11-30 14:13:25 EST
Target release should be placed once a package build is known to fix a issue. Since this bug is not modified, the target version has been reset. Please use target milestone to plan a fix for a oVirt release.
Comment 4 Moran Goldboim 2016-03-27 05:17:07 EDT
Postponing to next version due to capacity.
Comment 5 sefi litmanovich 2016-12-15 11:08:28 EST
Please note that the bug extends not only to the vm name, but to all it's properties. Currently any pool vm is editable completely via API where it should not the same as it's not in UI. Changing the bug's name.
Comment 6 Michal Skrivanek 2016-12-21 04:08:35 EST
The bug was not addressed in time for 4.1. Postponing to 4.2
Comment 7 sefi litmanovich 2017-02-27 08:06:48 EST
Changing the name of this bug again after it caused some confusion.
This bug was initially about changing the pool name via REST API which should be disabled.
I changed it to editing a vm from the pool via REST API which should also be disabled.. I was mistaking name of the pool with name of vm from the pool.
Comment 9 Israel Pinto 2017-08-15 06:43:28 EDT
Verify with:

Steps:
1. Create pool with 3 vms
2. Update vmpool name with REST API
With and without cluster and template 

Results:
Both ways update vmpool name not allowed.

PASS

More info:

Without cluster and template:
Request:
<vm_pool>
 <name>test-israel</name>
 <description/>
 <size>3</size>
 <prestarted_vms>0</prestarted_vms>
 <max_user_vms>1</max_user_vms>
</vm_pool>
Response:
<fault>
 <detail>[Cannot change VM-Pool name.]</detail>
 <reason>Operation Failed</reason>
</fault>
With cluster and template:
Request:
<vm_pool>
 <cluster id="ff4a2b05-5e0d-41f4-865a-7f4553d49480"/>
 <template id="9823fe6d-eadf-42cf-9949-69d82a3d4750"/>
 <name>test-israel</name>
 <description/>
 <size>3</size>
 <prestarted_vms>0</prestarted_vms>
 <max_user_vms>1</max_user_vms>
</vm_pool>
Response:
<fault>
 <detail>[Cannot change VM-Pool name.]</detail>
 <reason>Operation Failed</reason>
</fault>

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