Bug 1805119 - Unable to retire a VM via REST
Summary: Unable to retire a VM via REST
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: API
Version: 5.10.15
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: GA
: 5.11.5
Assignee: drew uhlmann
QA Contact: Parthvi Vala
Red Hat CloudForms Documentation
URL:
Whiteboard:
: 1834819 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-02-20 10:02 UTC by Parthvi Vala
Modified: 2023-10-06 19:14 UTC (History)
8 users (show)

Fixed In Version: 5.11.5.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-05-05 13:43:11 UTC
Category: Bug
Cloudforms Team: CFME Core
Target Upstream Version:
Embargoed:
pm-rhel: cfme-5.11.z+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:2020 0 None None None 2020-05-05 13:43:21 UTC

Description Parthvi Vala 2020-02-20 10:02:06 UTC
Description of problem:
Unable to retire a VM via REST api

Version-Release number of selected component (if applicable):
5.10.15

How reproducible:
Always

Steps to Reproduce:
1. Provision a VM.
2. Retire the VM via REST API.


Actual results:
1.
2. VM summary table shows the retirement has initialized but it does not retire.

Expected results:
1.
2. VM should retire.


Additional info:
The bug exists on 5.11 as well, last working version for 5.11 is 5.11.0.28

Comment 3 drew uhlmann 2020-02-20 14:29:20 UTC
Couple issues here:

Per Parthvi's message about the call she's using:
POST https://whatever/api/vms/# {'action': 'retire'}

is the old call, and won't work. 
Issue 1 is that our docs need an update (https://www.manageiq.org/docs/reference/latest/api/examples/retire_service), the correct action needs to be request_retire. 
There's a recent talk topic about that: http://talk.manageiq.org/t/retirement-as-a-request/4797

There's still a bug here, but that call won't work today anyway.

Comment 6 Parthvi Vala 2020-02-21 09:12:59 UTC
Hi Drew, I understand the call is old, but I even tried with the new call `request_retire` but it didn't work either.

Comment 15 CFME Bot 2020-02-26 14:00:27 UTC
New commit detected on ManageIQ/manageiq/master:

https://github.com/ManageIQ/manageiq/commit/8b8f58be45b7f1db318820f3587ff95b4e2ef2af
commit 8b8f58be45b7f1db318820f3587ff95b4e2ef2af
Author:     d-m-u <drewuhlmann>
AuthorDate: Thu Feb 20 15:15:04 2020 +0000
Commit:     d-m-u <drewuhlmann>
CommitDate: Thu Feb 20 15:15:04 2020 +0000

    Call instance method for vm retire queueing

    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1805119

    Introduced in https://github.com/ManageIQ/manageiq-api/pull/662

 app/models/vm_or_template.rb | 4 +
 1 file changed, 4 insertions(+)

Comment 16 drew uhlmann 2020-02-26 14:01:45 UTC
Urps it's not in post yet, https://github.com/ManageIQ/manageiq-api/pull/743 needs to be merged first

Comment 17 drew uhlmann 2020-02-26 14:03:05 UTC
Okay all good here. Thanks Parthvi, this was a good catch.

Comment 18 CFME Bot 2020-02-26 14:07:02 UTC
New commit detected on ManageIQ/manageiq-api/master:

https://github.com/ManageIQ/manageiq-api/commit/13f33f060210ddcb811e42bba9557c9b179f1fee
commit 13f33f060210ddcb811e42bba9557c9b179f1fee
Author:     d-m-u <drewuhlmann>
AuthorDate: Thu Feb 20 15:14:46 2020 +0000
Commit:     d-m-u <drewuhlmann>
CommitDate: Thu Feb 20 15:14:46 2020 +0000

    Add user id argument for vm retire queueing to match the backend method

    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1805119

    Introduced in https://github.com/ManageIQ/manageiq-api/pull/662

 app/controllers/api/vms_controller.rb | 2 +-
 spec/requests/vms_spec.rb | 16 +
 2 files changed, 17 insertions(+), 1 deletion(-)

Comment 19 CFME Bot 2020-03-19 20:50:21 UTC
New commit detected on ManageIQ/manageiq/ivanchuk:

https://github.com/ManageIQ/manageiq/commit/398fb5dcb82a36cf271869238ad58e55205c5e3c
commit 398fb5dcb82a36cf271869238ad58e55205c5e3c
Author:     Adam Grare <agrare>
AuthorDate: Wed Feb 26 13:56:51 2020 +0000
Commit:     Adam Grare <agrare>
CommitDate: Wed Feb 26 13:56:51 2020 +0000

    Merge pull request #19855 from d-m-u/adding_instance_retire_for_queueing_retirement_vm_calls

     Call instance method for vm retire queuing

    (cherry picked from commit 9a0b7c3b206f662b4794ca0099bce2a7768f179f)

    https://bugzilla.redhat.com/show_bug.cgi?id=1805119

 app/models/vm_or_template.rb | 4 +
 1 file changed, 4 insertions(+)

Comment 20 CFME Bot 2020-03-19 20:51:19 UTC
New commit detected on ManageIQ/manageiq-api/ivanchuk:

https://github.com/ManageIQ/manageiq-api/commit/e46a280ae9c0e173c9d9409367a8baa5f5cecb70
commit e46a280ae9c0e173c9d9409367a8baa5f5cecb70
Author:     Libor Pichler <lpichler>
AuthorDate: Wed Feb 26 14:02:18 2020 +0000
Commit:     Libor Pichler <lpichler>
CommitDate: Wed Feb 26 14:02:18 2020 +0000

    Merge pull request #743 from d-m-u/change_queue_call_to_vm_retirement

    Call instance method for vm retire queueing

    (cherry picked from commit 2c70d200e88e5b06b1a4585682fe0de4a4be4806)

    https://bugzilla.redhat.com/show_bug.cgi?id=1805119

 app/controllers/api/vms_controller.rb | 2 +-
 spec/requests/vms_spec.rb | 16 +
 2 files changed, 17 insertions(+), 1 deletion(-)

Comment 23 Parthvi Vala 2020-04-16 10:13:56 UTC
FIXED. Verified on 5.11.5.1.

Successfully retired the VM via `request_retire` action.

Question: Why do we still have `retire` action on the list?

Comment 24 drew uhlmann 2020-04-16 10:42:38 UTC
It's necessary for backwards compatibility, see http://talk.manageiq.org/t/retirement-as-a-request/4797

Comment 26 Parthvi Vala 2020-04-27 09:16:39 UTC
Any plans on backporting this to 5.10? OR is there a different fix in progress for this BZ?

Comment 27 drew uhlmann 2020-04-27 11:16:42 UTC
yeah, you're right. 
https://github.com/ManageIQ/manageiq-api/pull/662, which introduced this, got backported to hammer so the fix in an ideal world would as well.

Comment 29 errata-xmlrpc 2020-05-05 13:43:11 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, 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/RHBA-2020:2020

Comment 30 Yuri Rudman 2020-05-18 13:07:29 UTC
*** Bug 1834819 has been marked as a duplicate of this bug. ***

Comment 31 Neha Chugh 2020-06-10 06:29:50 UTC
Hello Team,

After upgrading the appliance to 5.11.5 and now we can retire the vm using below parameter i.e.

{
  "action" : "request_retire"
  
}

In the result, it is giving us the output like below:

{
  "success": true,
  "message": "VM id:<vmid> name:<vmname> request retire",
  "task_id": "1000000006444",
  "task_href": "https://<cfmeip>/api/tasks/1000000006444",
  "href": "https://<cfmeip>/api/vms/1000000000009"
}

When we check the status of task, it shows complete status 

Response: 
 "href": "https://<cfmeip>/api/tasks/1000000006444",
  "name": "VM id:<vmid> name:<vmname> request retire",
  "state": "Finished",
  "status": "Ok",
  "message": "Task completed successfully",

But the request is still is progress if we check the logs. 

Expected Behavior should be the state should not show "finished" when the retirement is still in progress.

Regards,
Neha Chugh

Comment 32 drew uhlmann 2020-06-10 10:36:08 UTC
Hey Neha, it's expected from our side that tasks complete before the request is finished. That's not a bug, nor did that change on any 5.11.

Comment 34 drew uhlmann 2020-06-22 13:14:28 UTC
Hey Neha, if I could ask you to please open a different bug for that, assign me, and provide a reproducer, that'd be great. Thanks.

Comment 35 Neha Chugh 2020-06-22 13:39:02 UTC
Hello Drew,

I have created different bug for the same i.e.

https://bugzilla.redhat.com/show_bug.cgi?id=1849671

and shared the reproducer in the BZ itself. 

Regards,
Neha Chugh


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