Bug 1302107

Summary: MIQ retirement statemachine processed in the zone that its triggered in
Product: Red Hat CloudForms Management Engine Reporter: Josh Carter <jocarter>
Component: AutomateAssignee: Tina Fitzgerald <tfitzger>
Status: CLOSED ERRATA QA Contact: Dmitry Misharov <dmisharo>
Severity: high Docs Contact:
Priority: high    
Version: 5.5.0CC: cpelland, dajohnso, jhardy, jprause, mfeifer, mkanoor, obarenbo, tfitzger
Target Milestone: GAKeywords: ZStream
Target Release: 5.6.0   
Hardware: All   
OS: All   
Whiteboard: retirement:automate:zone
Fixed In Version: 5.6.0.0 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1303096 (view as bug list) Environment:
Last Closed: 2016-06-29 15:33:32 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1303096    

Description Josh Carter 2016-01-26 19:30:45 UTC
Description of problem:

Retiring a service is not executed in the zone that the vm's ems belongs to. If this retirement state machine is executed from a "UI" zone that does not have automate enabled the request is queued for the wrong zone. 

[----] I, [2016-01-26T14:15:02.347015 #17018:689994]  INFO -- : MIQ(MiqQueue.put) Message id: [20000021243366],  id: [], Zone: [UI], Role: [automate], Server: [], Ident: [generic], Target id: [], Instance id: [], Task id: [], Command: [MiqAe
Engine.deliver], Timeout: [3600], Priority: [20], State: [ready], Deliver On: [], Data: [], Args: [{:object_type=>"Service", :object_id=>20000000000008, :attrs=>{:event_type=>"request_service_retire", :retirement_initiator=>"user", :service=
>#<Service id: 20000000000008, name: "blah-test-20160126-140912", description: "", guid: "45328664-c460-11e5-900d-005056be38a2", type: nil, service_template_id: 20000000000002, options: {:dialog=>{"dialog_option_0_vm_memory"=>"1024", "dialog
_option_0_owner_first_name"=>"Josh", "dialog_option_0_owner_email"=>"jocarter", "dialog_vm_memory"=>"1024", "dialog_owner_first_name"=>"Josh", "dialog_owner_email"=>"jocarter"}}, display: true, created_at: "2016-01-26 1
9:09:06", updated_at: "2016-01-26 19:13:05", evm_owner_id: 20000000000001, miq_group_id: 20000000000001, service_id: nil, retired: nil, retires_on: nil, retirement_warn: nil, retirement_last_warn: nil, retirement_state: nil, retirement_reque
ster: "admin", tenant_id: 20000000000001>, :user_id=>"admin", :type=>"Service", "MiqEvent::miq_event"=>20000000080703, :miq_event_id=>20000000080703, "EventStream::event_stream"=>20000000080703, :event_stream_id=>20000000080703}, :instance_n
ame=>"Event", :user_id=>20000000000001, :miq_group_id=>20000000000001, :tenant_id=>20000000000001, :automate_message=>nil}]

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


How reproducible:
very

Steps to Reproduce:
1. create two cfme zones UI & Worker
2. Only enable automate in worker zone 
3. attach EMS to worker zone.
4. retire a service when using the UI appliance

Actual results:
service & vm is not retired

Expected results:
service & vm should be retired. 

Additional info:

Comment 2 Shveta 2016-02-01 21:31:43 UTC
Assigning to add test case

Comment 4 CFME Bot 2016-02-25 19:10:54 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/d55ae0cae9797f7f4c93efa4a46ee3175ff40615

commit d55ae0cae9797f7f4c93efa4a46ee3175ff40615
Author:     Tina Fitzgerald <tfitzger>
AuthorDate: Mon Feb 22 17:05:13 2016 -0500
Commit:     Tina Fitzgerald <tfitzger>
CommitDate: Wed Feb 24 12:14:07 2016 -0500

    Clear zone if automate role not enabled.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1302107

 lib/miq_automation_engine/engine/miq_ae_engine.rb  |  2 +-
 .../miq_ae_state_machine_multi_spec.rb             |  2 ++
 .../miq_ae_state_machine_retry_spec.rb             |  2 ++
 .../miq_automation_engine/miq_ae_engine_spec.rb    | 35 +++++++++++++++++++++-
 spec/models/resource_action_spec.rb                |  2 ++
 5 files changed, 41 insertions(+), 2 deletions(-)

Comment 6 CFME Bot 2016-02-29 14:46:37 UTC
Detected commit referencing this ticket while ticket status is MODIFIED.

Comment 7 CFME Bot 2016-02-29 18:16:02 UTC
New commit detected on cfme/5.5.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=576a587cdf2254be520881846542e81c7adf6002

commit 576a587cdf2254be520881846542e81c7adf6002
Author:     Tina Fitzgerald <tfitzger>
AuthorDate: Mon Feb 22 17:05:13 2016 -0500
Commit:     Tina Fitzgerald <tfitzger>
CommitDate: Mon Feb 29 11:52:20 2016 -0500

    Clear zone if automate role not enabled.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1302107

 lib/miq_automation_engine/engine/miq_ae_engine.rb  |  2 +-
 .../miq_ae_state_machine_multi_spec.rb             |  4 +-
 .../miq_ae_state_machine_retry_spec.rb             |  4 +-
 .../miq_automation_engine/miq_ae_engine_spec.rb    | 43 +++++++++++++++++++---
 spec/models/resource_action_spec.rb                |  4 +-
 5 files changed, 48 insertions(+), 9 deletions(-)

Comment 8 Milan Falešník 2016-06-13 15:18:24 UTC
5.6.0.10

I followed the steps and the vm and service got retired.

Comment 10 errata-xmlrpc 2016-06-29 15:33:32 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-2016:1348