Bug 1643520 - RESTAPI Not able to remove the QoS from a disk profile
Summary: RESTAPI Not able to remove the QoS from a disk profile
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine
Version: 4.2.5
Hardware: All
OS: Linux
medium
medium
Target Milestone: ovirt-4.4.1
: 4.3.0
Assignee: Lucia Jelinkova
QA Contact: Evelina Shames
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-10-26 12:50 UTC by Ron van der Wees
Modified: 2023-10-06 17:58 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Before this update, when updating a disk profile using the REST API, sending an empty QoS tag `<qos />` had no effect. Consequently, it was not possible to remove QoS from the disk profile using the REST API. This update resolves this issue, and now sending an empty QoS tag (`<qos />`) removes QoS from the disk profile.
Clone Of:
Environment:
Last Closed: 2020-09-23 16:11:04 UTC
oVirt Team: Virt
Target Upstream Version:
Embargoed:
lsvaty: testing_plan_complete-


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHV-37542 0 None None None 2022-07-09 12:56:24 UTC
Red Hat Knowledge Base (Solution) 3668041 0 None None None 2018-10-26 13:07:33 UTC
Red Hat Product Errata RHSA-2020:3807 0 None None None 2020-09-23 16:11:39 UTC
oVirt gerrit 100309 0 'None' MERGED restapi: Allow to remove QoS from a disk profile 2020-09-21 19:05:13 UTC

Description Ron van der Wees 2018-10-26 12:50:46 UTC
Description of problem:

By default, the QoS on a Disk Profile is set to "[Unlimited]". When a specific
profile is configured, its not possible to remove it (read: set it back to
"[Unlimited]") using the API.

Version-Release number of selected component (if applicable):
ovirt-engine-restapi-4.2.5.2-0.1.el7ev.noarch

How reproducible:
Always

Steps to Reproduce:
1. Under Compute -> Data Center -> Default -> QoS
   create a "Storage" QoS with some limits
2. Use the API to set the QoS to an existing Disk Profile
   # curl -k --header 'Accept: application/xml' --request 'PUT' --header 'Content-Type: application/xml' --data '
   <disk_profile>
     <qos id="<qosuuid>"/>
   </disk_profile>
   ' -u 'admin@internal' \
   'https://rhvm.example.com/ovirt-engine/api/diskprofiles/<diskprofileuuid>' 
3. Try removing it with:
   # curl -k --header 'Accept: application/xml' --request 'PUT' --header 'Content-Type: application/xml' --data '
   <disk_profile>
     <qos/>
   </disk_profile>
   ' -u 'admin@internal' \
   'https://rhvm.example.com/ovirt-engine/api/diskprofiles/<diskprofileuuid>'


Actual results:
Reading back the same Disk Profile still contains an ID for the QoS:
# curl -k --header 'Accept: application/xml' --request 'GET' -u 'admin@internal' \
'https://rhvm.example.com/ovirt-engine/api/diskprofiles'
    ...
    <disk_profile href="/ovirt-engine/api/diskprofiles/31311c34-911d-4cfe-ba84-75b0ede0d118" id="31311c34-911d-4cfe-ba84-75b0ede0d118">
      <name>Data1</name>
      <link href="/ovirt-engine/api/diskprofiles/31311c34-911d-4cfe-ba84-75b0ede0d118/permissions" rel="permissions"/>
      <qos href="/ovirt-engine/api/datacenters/1d9f9f52-a611-11e8-b40b-00163e4663ae/qoss/1b8c9ecb-ed09-44d2-8d78-280bbf20995c" id="1b8c9ecb-ed09-44d2-8d78-280bbf20995c"/>
      <storage_domain href="/ovirt-engine/api/storagedomains/e345a3da-805e-4206-8f91-41e309bce10b" id="e345a3da-805e-4206-8f91-41e309bce10b"/>
    </disk_profile>
    ...


Expected results:
The QoS to be empty.


Additional info:
In the webUI it is possible to set it back to "[Unlimited]".

Step 3 in the reproducer does not return an error. Sending this:
<disk_profile>
  <qos id=””/>
</disk_profile>

or similar calls results in a syntax error.

Comment 1 Tal Nisan 2018-10-28 14:57:34 UTC
Martin, I recall there was a way to do it, is the syntax of the request correct though?

Comment 2 Tal Nisan 2018-11-15 12:12:54 UTC
Ryan, do you have any idea here?

Comment 3 Ryan Barry 2018-11-15 13:31:29 UTC
I'd expect this to be, basically:

DELETE https://rhvm.example.com/ovirt-engine/api/diskprofiles/<diskprofileuuid>/qos

But I'll test

Comment 4 Tal Nisan 2018-12-10 09:52:39 UTC
Any news Ryan?

Comment 5 Ryan Barry 2018-12-10 13:34:21 UTC
After testing, there doesn't actually seem to be a way to unset this -- DELETE throws an exception which is logged but not sent back (same as trying to delete the entire disk profile). Unsetting <data_center /> under the QOS itself also doesn't seem to work.

Short of deleting the QOS entirely, I can't find another way to do this.

curl -k --header 'Accept: application/xml' --request 'DELETE' -u 'admin@internal' https://engine-root.ovirt.org/ovirt-engine/api/datacenters/123/qoss/123

The REST API mapper for DiskProfile needs to provide a way to unset this.

Comment 6 Sandro Bonazzola 2019-01-28 09:39:41 UTC
This bug has not been marked as blocker for oVirt 4.3.0.
Since we are releasing it tomorrow, January 29th, this bug has been re-targeted to 4.3.1.

Comment 8 Lucia Jelinkova 2019-05-27 12:27:42 UTC
I've pushed a patch to fix this to Gerrit - the empty tag <qos /> now removes the qos. However, I am wondering if this could break some existing scripts.

WDYT?

Comment 9 Ryan Barry 2019-05-27 13:04:42 UTC
It's a holiday in the US, so I won't get a chance to look until tomorrow, but thoughts on this change for Ansible, Martin?

Comment 10 Ondra Machacek 2019-05-28 09:03:16 UTC
It doesn't break Ansible or old scripts. The patch looks OK.

Comment 11 Daniel Gur 2019-08-28 13:13:29 UTC
sync2jira

Comment 12 Daniel Gur 2019-08-28 13:17:42 UTC
sync2jira

Comment 13 Evelina Shames 2019-12-30 09:06:28 UTC
Verified on engine-4.4.0-0.13.master.el7.

Comment 19 errata-xmlrpc 2020-09-23 16:11:04 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: Red Hat Virtualization security, bug fix, and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2020:3807


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