Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1215990 - [RFE] Allow the on_entry and on_error methods of a state machine to be able to advance (bump) state to allow processing to continue
[RFE] Allow the on_entry and on_error methods of a state machine to be able t...
Status: CLOSED ERRATA
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Automate (Show other bugs)
5.3.0
Unspecified Unspecified
medium Severity medium
: GA
: 5.5.0
Assigned To: mkanoor
Milan Falešník
: FutureFeature
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-04-28 06:15 EDT by Peter McGowan
Modified: 2015-12-08 08:06 EST (History)
7 users (show)

See Also:
Fixed In Version: 5.5.0.1
Doc Type: Enhancement
Doc Text:
The new version of CloudForms Management Engine enhances the Automate engine to allow the on_entry and on_error methods of a state machine to advance to the next state under valid conditions. For on_entry methods, it checks if the method is required to run. For on_error methods, it handles and recovers from errors.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-12-08 08:06:21 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-2015:2551 normal SHIPPED_LIVE Moderate: CFME 5.5.0 bug fixes and enhancement update 2015-12-08 12:58:09 EST

  None (edit)
Description Peter McGowan 2015-04-28 06:15:36 EDT
Description of problem:

It would be useful for the on_entry and on_error methods in a state machine to be able to advance the ae_state of the state machine. 

For an on_entry method, this would be useful if the method checked pre-conditions for the running of the main state method, and determined that the method was not required to run. (e.g. if a VM is already powered off, don't run the shutdown_vm main method)

For the on_error method, it would be useful to be able to handle and recover from an error, and continue the state machine processing. (e.g. if vm.shutdown_guest times out because the guest agent isn't installed, perform a vm.stop and continue the state machine)
Comment 2 Oleg Barenboim 2015-05-06 15:31:07 EDT
https://github.com/ManageIQ/manageiq/pull/2860
Comment 3 CFME Bot 2015-06-26 13:31:27 EDT
New commit detected on manageiq/master:
https://github.com/ManageIQ/manageiq/commit/7d2bf40a3753547d026af62a955a58dec2686672

commit 7d2bf40a3753547d026af62a955a58dec2686672
Author:     Madhu Kanoor <mkanoor@redhat.com>
AuthorDate: Fri Jun 19 15:54:14 2015 -0400
Commit:     Madhu Kanoor <mkanoor@redhat.com>
CommitDate: Fri Jun 26 09:53:06 2015 -0400

    Refactoring of Automate Engine code
    
    Separated State Machine specific code into a separate module
    Moved the state machine spec into engine_validation directory
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1215990

 .../miq_automation_engine/engine/miq_ae_object.rb  | 123 +-------------------
 .../engine/miq_ae_state_machine.rb                 | 124 +++++++++++++++++++++
 .../miq_ae_state_machine_retry_spec.rb             | 105 +++++++++++++++++
 .../miq_ae_state_machine_retry_spec.rb             | 105 -----------------
 4 files changed, 231 insertions(+), 226 deletions(-)
 create mode 100644 vmdb/lib/miq_automation_engine/engine/miq_ae_state_machine.rb
 create mode 100644 vmdb/spec/automation/unit/engine_validation/miq_ae_state_machine_retry_spec.rb
 delete mode 100644 vmdb/spec/lib/miq_automation_engine/miq_ae_state_machine_retry_spec.rb
Comment 4 CFME Bot 2015-06-26 13:31:33 EDT
New commit detected on manageiq/master:
https://github.com/ManageIQ/manageiq/commit/8afedec1ae688f6de9e88bde88f0d25fa29acd2b

commit 8afedec1ae688f6de9e88bde88f0d25fa29acd2b
Author:     Madhu Kanoor <mkanoor@redhat.com>
AuthorDate: Mon Jun 22 11:37:23 2015 -0400
Commit:     Madhu Kanoor <mkanoor@redhat.com>
CommitDate: Fri Jun 26 09:53:30 2015 -0400

    Automate State Machine enhancements
    
        (1) Optionally allow for methods to set the next state to execute
            using a new attribute in the root object called 'ae_next_state'
            e.g. $evm.root['ae_next_state'] = state_name
        (2) Allow for a state to be skipped by setting the method result
            attribute 'ae_result' to be skip in the root object.
            e.g. $evm.root['ae_result'] = 'skip'
            The next state in the instance is used when you use skip. You
            dont have to know the state name like with
            $evm.root['ae_next_state']
        (3) Allow for continuation of a state machine in case of errors
            by setting the method result attribute 'ae_result' to continue
            int the root object.
            e.g. $evm.root['ae_result'] = 'continue'
    
        https://bugzilla.redhat.com/show_bug.cgi?id=1215990

 .../engine/miq_ae_state_machine.rb                 |  55 +++-
 .../miq_ae_state_machine_retry_spec.rb             |  97 +++++--
 .../miq_ae_state_machine_steps_spec.rb             | 311 +++++++++++++++++++++
 vmdb/spec/support/automation_spec_helper.rb        |  15 +
 4 files changed, 438 insertions(+), 40 deletions(-)
 create mode 100644 vmdb/spec/automation/unit/engine_validation/miq_ae_state_machine_steps_spec.rb
Comment 5 CFME Bot 2015-06-26 13:31:38 EDT
New commit detected on manageiq/master:
https://github.com/ManageIQ/manageiq/commit/ddcbfcbb260fb88c610eaee94cc1d2e2d6c12fe4

commit ddcbfcbb260fb88c610eaee94cc1d2e2d6c12fe4
Author:     Madhu Kanoor <mkanoor@redhat.com>
AuthorDate: Tue Jun 23 16:16:58 2015 -0400
Commit:     Madhu Kanoor <mkanoor@redhat.com>
CommitDate: Fri Jun 26 09:53:50 2015 -0400

    PR review changes
    
    Use Timecop in spec
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1215990

 .../engine/miq_ae_state_machine.rb                   |  9 +++++----
 .../miq_ae_state_machine_retry_spec.rb               | 20 ++++++++++++++------
 2 files changed, 19 insertions(+), 10 deletions(-)
Comment 6 Milan Falešník 2015-12-03 04:36:21 EST
Verified in 5.5.0.13. I will include the exported AE things I used.
Comment 9 errata-xmlrpc 2015-12-08 08:06:21 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-2015:2551

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