Bug 1416903 - power operations using REST API on parent service has no effect
Summary: power operations using REST API on parent service has no effect
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: API
Version: 5.7.0
Hardware: Unspecified
OS: Unspecified
Target Milestone: GA
: 5.9.0
Assignee: Drew Bomhof
QA Contact: Martin Kourim
Whiteboard: api:rest:power
Depends On:
TreeView+ depends on / blocked
Reported: 2017-01-26 18:26 UTC by Martin Kourim
Modified: 2018-03-01 13:09 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2018-03-01 13:09:24 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:

Attachments (Terms of Use)

System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2018:0380 0 normal SHIPPED_LIVE Moderate: Red Hat CloudForms security, bug fix, and enhancement update 2018-03-01 18:37:12 UTC

Description Martin Kourim 2017-01-26 18:26:06 UTC
Description of problem:
Service with vm has parent service defined ("ancestry": "<parent_id>").
When running power operation on parent service using REST API, it has no effect.
When running power operation on child service using REST API, it works.

Power actions on a service should be processed from the service it is initiated and child services, i.e. calling the action on the top-level service should work.

The top-level (parent) service is minimal service with just name and description.

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

How reproducible:

Steps to Reproduce:
1. create child service with vm
2. create minimal service, e.g.
POST /api/services
    "name" : "test_service_parent",
    "description" : "Test Service parent"
3. edit child vm to add ancestor:
POST /api/services/:child_id
    "action": "edit",
    "ancestry" : "<parent_id>"
4. run power operation on parent service:
POST /api/services/:parent_id
    "action": "stop"

Actual results:
No effect on the vm associated with child service.

Following is set in parent service:
"options": {"power_status": "stopping"}

Expected results:
The vm associated with child service is stopped.

Comment 2 Greg McCullough 2017-02-02 20:13:16 UTC
Martin - Please retest with the fix from https://github.com/ManageIQ/manageiq/pull/13232 which was created for Bug 1394202.  This change resolves a few issues and should correct this scenario.

Comment 3 Martin Kourim 2017-03-01 13:13:23 UTC
Tested on and the described issue is still there.

Comment 4 Drew Bomhof 2017-03-21 13:21:26 UTC

I was able to duplicate the problem yesterday (3/20/2017.) I'm working on a PR to resolve it.

Comment 5 Drew Bomhof 2017-03-28 20:49:07 UTC
PR: https://github.com/ManageIQ/manageiq/pull/14550

Comment 6 Drew Bomhof 2017-04-03 20:40:17 UTC
PR: https://github.com/ManageIQ/manageiq/pull/14550 - Refactored how atomic? and composite? services are clarified - now they are clarified (from the services level) simply as child_resources? and empty_child_resources?

Comment 7 CFME Bot 2017-04-18 20:16:47 UTC
New commit detected on ManageIQ/manageiq/master:

commit ec58361e4c0940d4dac70094fe3c00452d681f54
Author:     Drew Bomhof <dbomhof>
AuthorDate: Mon Apr 3 16:11:52 2017 -0400
Commit:     Drew Bomhof <dbomhof>
CommitDate: Tue Apr 18 14:48:55 2017 -0400

    Adjust power states to handle children
    1. Iterate through the children if there are no service_resources on the parent
    2. Iterate through the children for power states to adjust the power state and status for
    the entire service

 app/models/mixins/service_mixin.rb |  6 +++++-
 app/models/service.rb              | 28 +++++++++++++++++-----------
 2 files changed, 22 insertions(+), 12 deletions(-)

Comment 8 CFME Bot 2017-04-18 20:16:52 UTC
New commit detected on ManageIQ/manageiq/master:

commit 3daf3fe27f08a15605721eeb249c60a85793dc1e
Author:     Drew Bomhof <dbomhof>
AuthorDate: Mon Apr 3 16:12:25 2017 -0400
Commit:     Drew Bomhof <dbomhof>
CommitDate: Tue Apr 18 14:48:55 2017 -0400

    Add specs around the the all_states_match? method

 spec/models/service_spec.rb | 76 ++++++++++++++++++++++++++++++++++-----------
 1 file changed, 58 insertions(+), 18 deletions(-)

Comment 9 CFME Bot 2017-04-18 20:16:57 UTC
New commit detected on ManageIQ/manageiq/master:

commit a52d65d8895fe942750b15caaab80f4024889024
Author:     Drew Bomhof <dbomhof>
AuthorDate: Wed Apr 5 11:42:03 2017 -0400
Commit:     Drew Bomhof <dbomhof>
CommitDate: Tue Apr 18 14:48:55 2017 -0400

    Re use the composite? and atomic? method names

 app/models/service.rb       |  8 +++----
 spec/models/service_spec.rb | 55 +++++++++++++++++++++------------------------
 2 files changed, 30 insertions(+), 33 deletions(-)

Comment 10 CFME Bot 2017-04-18 20:17:03 UTC
New commit detected on ManageIQ/manageiq/master:

commit f2a06a87a849786153fa0589b18b4c546e793a4a
Author:     Drew Bomhof <dbomhof>
AuthorDate: Tue Apr 18 15:47:50 2017 -0400
Commit:     Drew Bomhof <dbomhof>
CommitDate: Tue Apr 18 15:47:50 2017 -0400

    Extract service actions list into a method

 app/models/service.rb       | 14 ++++++++------
 spec/models/service_spec.rb |  2 ++
 2 files changed, 10 insertions(+), 6 deletions(-)

Comment 11 Martin Kourim 2017-10-20 09:07:56 UTC
Verified using CFME QE test automation on

Comment 14 errata-xmlrpc 2018-03-01 13:09:24 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.


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