Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1416903 - power operations using REST API on parent service has no effect
power operations using REST API on parent service has no effect
Status: CLOSED ERRATA
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: API (Show other bugs)
5.7.0
Unspecified Unspecified
high Severity medium
: GA
: 5.9.0
Assigned To: Drew Bomhof
Martin Kourim
api:rest:power
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-01-26 13:26 EST by Martin Kourim
Modified: 2018-03-01 08:09 EST (History)
6 users (show)

See Also:
Fixed In Version: 5.9.0.1
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2018-03-01 08:09:24 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2018:0380 normal SHIPPED_LIVE Moderate: Red Hat CloudForms security, bug fix, and enhancement update 2018-03-01 13:37:12 EST

  None (edit)
Description Martin Kourim 2017-01-26 13:26:06 EST
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):
5.7.1.0


How reproducible:
100%


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 15:13:16 EST
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 08:13:23 EST
Tested on 5.8.0.2 and the described issue is still there.
Comment 4 Drew Bomhof 2017-03-21 09:21:26 EDT
Martin,

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 16:49:07 EDT
PR: https://github.com/ManageIQ/manageiq/pull/14550
Comment 6 Drew Bomhof 2017-04-03 16:40:17 EDT
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 16:16:47 EDT
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/ec58361e4c0940d4dac70094fe3c00452d681f54

commit ec58361e4c0940d4dac70094fe3c00452d681f54
Author:     Drew Bomhof <dbomhof@redhat.com>
AuthorDate: Mon Apr 3 16:11:52 2017 -0400
Commit:     Drew Bomhof <dbomhof@redhat.com>
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
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1416903

 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 16:16:52 EDT
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/3daf3fe27f08a15605721eeb249c60a85793dc1e

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

    Add specs around the the all_states_match? method
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1416903

 spec/models/service_spec.rb | 76 ++++++++++++++++++++++++++++++++++-----------
 1 file changed, 58 insertions(+), 18 deletions(-)
Comment 9 CFME Bot 2017-04-18 16:16:57 EDT
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/a52d65d8895fe942750b15caaab80f4024889024

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

    Re use the composite? and atomic? method names
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1416903

 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 16:17:03 EDT
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/f2a06a87a849786153fa0589b18b4c546e793a4a

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

    Extract service actions list into a method
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1416903

 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 05:07:56 EDT
Verified using CFME QE test automation on 5.9.0.2
Comment 14 errata-xmlrpc 2018-03-01 08:09:24 EST
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/RHSA-2018:0380

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