Bug 1419520 - Detaching all vms from a pool via REST API doesn't remove the pool
Summary: Detaching all vms from a pool via REST API doesn't remove the pool
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: RestAPI
Version: 4.1.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ovirt-4.1.1
: 4.1.1.3
Assignee: Shahar Havivi
QA Contact: sefi litmanovich
URL:
Whiteboard:
Depends On:
Blocks: 1378331
TreeView+ depends on / blocked
 
Reported: 2017-02-06 12:02 UTC by sefi litmanovich
Modified: 2017-04-21 09:43 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-04-21 09:43:15 UTC
oVirt Team: Virt
Embargoed:
rule-engine: ovirt-4.1+
rule-engine: exception+
rule-engine: planning_ack+
tjelinek: devel_ack+
mavital: testing_ack+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 72354 0 master MERGED core: remove pool when last VM detached 2017-02-16 13:25:23 UTC
oVirt gerrit 72440 0 ovirt-engine-4.1 MERGED core: remove pool when last VM detached 2017-02-17 10:09:09 UTC

Description sefi litmanovich 2017-02-06 12:02:23 UTC
Description of problem:
When detaching all the vms from a vm pool via UI the pool itself is automatically deleted as well.
This behaviour doesn't occur when detaching the last vm in the pool via REST API, in this case the pool will remain empty in the system.

Version-Release number of selected component (if applicable):
rhevm-4.1.0.4-0.1.el7

How reproducible:
always

Steps to Reproduce:
1. Create a vm pool with any amount of vms.
2. Detach all the vms (or only the last remaining one) from the pool via REST API:

https://{engine_url}/ovirt-engine/api/vms/{vm_id}/detach

body:

<action>
    <async>false</async>
    <grace_period>
        <expiry>10</expiry>
    </grace_period>
</action>

Actual results:
Vms are detached from the pool, but the pool itself keep remaining in the system.

Expected results:
Vms are detached from the pool and the pool itself is removed from the system.

Additional info:

Comment 1 Tomas Jelinek 2017-02-07 09:57:43 UTC
It does not sound like it but there is a pretty hard requirement of having only pools which have at least one VM. If this requirement is not fulfilled, the frontends start to fall apart throwing various exceptions such as
https://bugzilla.redhat.com/1378331 and https://bugzilla.redhat.com/show_bug.cgi?id=1378331

and Im pretty sure one could find more.

Fixing this issue should be as easy as changing:
new RemoveVmFromPoolParameters(guid, false, true),
to
new RemoveVmFromPoolParameters(guid, true, true),

in BackendVmResource.detach() method so I think it is safe to backport it.

Comment 2 sefi litmanovich 2017-02-23 12:10:37 UTC
Hi, is this patch included in latest build? I was able to re produce on rhevm-4.1.1.2-0.1.el7.noarch. If not please move to modified.

Comment 3 Shahar Havivi 2017-02-23 12:46:12 UTC
according to the log it suppose to be in 4.1.1
lets check it on your setup

Comment 4 Shahar Havivi 2017-02-23 12:53:04 UTC
it didn't make it for 4.1.1.2

Comment 5 sefi litmanovich 2017-03-06 12:22:24 UTC
Verified with rhevm-4.1.1.3-0.1.el7


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