Bug 1176689

Summary: State Machine progresses when state instance is not found.
Product: Red Hat CloudForms Management Engine Reporter: Tina Fitzgerald <tfitzger>
Component: AutomateAssignee: mkanoor
Status: CLOSED ERRATA QA Contact: Milan Falešník <mfalesni>
Severity: medium Docs Contact:
Priority: low    
Version: 5.4.0CC: jhardy, mfalesni, obarenbo, xlecauch
Target Milestone: GA   
Target Release: 5.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.4.0.0.11 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
bz_monday 020215
Last Closed: 2015-06-16 12:46:41 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:

Description Tina Fitzgerald 2014-12-22 20:24:24 UTC
Description of problem:

The state machine progresses when it encounters a state that points to a non-existent instance, it incorrectly reports the class is not found, and continues to the next state.      

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

How reproducible:

Steps to Reproduce:
1.  Replace the first state in the VM or service state machine with an non-existent instance name, ensuring the path is valid up to the class.
(The log snippet below shows service provisioning with a 'not_there' instance)
0
2.  Execute the state machine.

3.  Check the automation.log for the " ERROR -- : Class [xxxxxx] not found in 
MiqAeDatastore" error.

4.  Check the automation.log for the state machine continuing to the next state. (See log below)

[----] I, [2014-12-18T19:20:30.867206 #94069:3ff20d463be4]  INFO -- : Following Relationship [miqaedb:/service/provisioning/statemachines/methods/not_there#create]

[----] E, [2014-12-18T19:20:31.201207 #94069:3ff20d463be4] ERROR -- : Class [service/provisioning/statemachines/methods] not found in MiqAeDatastore

[----] I, [2014-12-18T19:20:31.201252 #94069:3ff20d463be4]  INFO -- : Followed  Relationship [miqaedb:/service/provisioning/statemachines/methods/not_there#create]

[----] I, [2014-12-18T19:20:31.201323 #94069:3ff20d463be4]  INFO -- : Processed  State=[pre1] with Result=[ok]

[----] I, [2014-12-18T19:20:31.201538 #94069:3ff20d463be4]  INFO -- : Next State=[pre2]

[----] I, [2014-12-18T19:20:31.201620 #94069:3ff20d463be4]  INFO -- : In State=[pre1], invoking [on_exit] method=[update_serviceprovision_status(status => 'Processed Pre1')]

[----] I, [2014-12-18T19:20:31.202100 #94069:3ff20d463be4]  INFO -- : Updated namespace [service/provisioning/statemachines/serviceprovision_template/update_serviceprovision_s

Actual results:
The state machine continues.

Expected results:
The state machine should report the instance is not found and should stop and/or abort the state machine.

Comment 2 CFME Bot 2015-02-13 21:25:47 UTC
New commit detected on manageiq/master:
https://github.com/ManageIQ/manageiq/commit/104d657eabc79c8f0b9551970b8a5d172a138134

commit 104d657eabc79c8f0b9551970b8a5d172a138134
Author:     Madhu Kanoor <mkanoor>
AuthorDate: Mon Feb 2 17:46:35 2015 -0500
Commit:     Madhu Kanoor <mkanoor>
CommitDate: Mon Feb 2 17:46:35 2015 -0500

    During state machine fail if the instance is missing
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1176689
    
    If an instance is missing and we are processing a state machine
    raise a MiqAeDatastoreError and fail the state machine.

 .../miq_automation_engine/engine/miq_ae_object.rb  |  1 +
 .../miq_ae_state_missing_relation_spec.rb          | 83 ++++++++++++++++++++++
 2 files changed, 84 insertions(+)
 create mode 100644 vmdb/spec/lib/miq_automation_engine/miq_ae_state_missing_relation_spec.rb

Comment 3 Milan Falešník 2015-03-04 16:07:48 UTC
Verified in 5.4.0.0.10.

Comment 6 errata-xmlrpc 2015-06-16 12:46:41 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://rhn.redhat.com/errata/RHBA-2015-1100.html