Execution error when running with the same workflow in parallel

Bug #1448403 reported by Lingxian Kong
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mistral
Fix Released
Critical
Nikolay Makhotkin
Kilo
Fix Released
Critical
Nikolay Makhotkin
Liberty
Fix Released
Critical
Nikolay Makhotkin

Bug Description

my workflow:

---
version: '2.0'

create_vm:
  type: direct
  input:
    - vm_name
    - image_ref
    - flavor_ref
  output:
    vm_id: <% $.vm_id %>

  tasks:
    create_server:
      action: nova.servers_create name=<% $.vm_name %> image=<% $.image_ref %> flavor=<% $.flavor_ref %>
      publish:
        vm_id: <% $.create_server.id %>
      on-success:
        - check_server_exists

    check_server_exists:
      action: nova.servers_get server=<% $.vm_id %>
      publish:
        server_exists: True
      on-success:
        - wait_instance

    wait_instance:
      action: nova.servers_find id=<% $.vm_id %> status='ACTIVE'
      retry:
        delay: 5
        count: 15

create 2 executions with the workflow, run in parallel, 1 of the 2 executions will be ERROR, the trace log:

2015-04-25 05:51:36.990 14491 DEBUG mistral.actions.openstack.base [-] method:<bound method ServerManager.get of <novaclient.v2.servers.ServerManager object at 0x6673910>>, params:{u'image': u'cfba9e7f-5dbd-4efb-bd1b-6c9d7093f540', u'name': u'test', u'flavor': u'1'}, method run /usr/local/lib/python2.7/dist-packages/mistral/actions/openstack/base.py:74
2015-04-25 05:51:36.992 14491 ERROR mistral.engine.default_executor [-] Failed to run action [action_execution_id=f4bc2720-f653-4c94-8483-5362bfba49b6, action_cls='<class 'mistral.actions.openstack.actions.NovaAction'>', attributes='{u'client_method_name': u'servers.create'}' params='{u'image': u'cfba9e7f-5dbd-4efb-bd1b-6c9d7093f540', u'name': u'test', u'flavor': u'1'}']
 NovaAction.servers.get failed: <type 'exceptions.TypeError'>: get() got an unexpected keyword argument 'image'
2015-04-25 05:51:36.992 14491 TRACE mistral.engine.default_executor Traceback (most recent call last):
2015-04-25 05:51:36.992 14491 TRACE mistral.engine.default_executor File "/usr/local/lib/python2.7/dist-packages/mistral/engine/default_executor.py", line 53, in run_action
2015-04-25 05:51:36.992 14491 TRACE mistral.engine.default_executor result = action.run()
2015-04-25 05:51:36.992 14491 TRACE mistral.engine.default_executor File "/usr/local/lib/python2.7/dist-packages/mistral/actions/openstack/base.py", line 82, in run
2015-04-25 05:51:36.992 14491 TRACE mistral.engine.default_executor (self.__class__.__name__, self.client_method_name, e_str)
2015-04-25 05:51:36.992 14491 TRACE mistral.engine.default_executor ActionException: NovaAction.servers.get failed: <type 'exceptions.TypeError'>: get() got an unexpected keyword argument 'image'
2015-04-25 05:51:36.992 14491 TRACE mistral.engine.default_executor

or

2015-04-25 05:34:38.163 14175 ERROR mistral.engine.default_executor [-] Failed to run action [action_execution_id=43690fa4-3911-43bc-9dc6-9bdeb5565162, action_cls='<class 'mistral.actions.openstack.actions.NovaAction'>', attributes='{u'client_method_name': u'servers.get'}' params='{u'server': u'a9aab6ad-989f-41ad-bed5-ac143aa4e7df'}']
 NovaAction.servers.create failed: <type 'exceptions.TypeError'>: create() takes at least 4 arguments (1 given)
2015-04-25 05:34:38.163 14175 TRACE mistral.engine.default_executor Traceback (most recent call last):
2015-04-25 05:34:38.163 14175 TRACE mistral.engine.default_executor File "/usr/local/lib/python2.7/dist-packages/mistral/engine/default_executor.py", line 53, in run_action
2015-04-25 05:34:38.163 14175 TRACE mistral.engine.default_executor result = action.run()
2015-04-25 05:34:38.163 14175 TRACE mistral.engine.default_executor File "/usr/local/lib/python2.7/dist-packages/mistral/actions/openstack/base.py", line 78, in run
2015-04-25 05:34:38.163 14175 TRACE mistral.engine.default_executor (self.__class__.__name__, self.client_method_name, e_str)
2015-04-25 05:34:38.163 14175 TRACE mistral.engine.default_executor ActionException: NovaAction.servers.create failed: <type 'exceptions.TypeError'>: create() takes at least 4 arguments (1 given)
2015-04-25 05:34:38.163 14175 TRACE mistral.engine.default_executor

root cause:
client_method_name is OpenStackAction class variable, it will be overrided by other executors during action class construction.

def construct_action_class(action_class_str, attributes):
    # Rebuild action class and restore attributes.
    action_class = importutils.import_class(action_class_str)

    for name, value in attributes.items():
        setattr(action_class, name, value) # here is the magic

Lingxian Kong (kong)
Changed in mistral:
assignee: nobody → Lingxian Kong (kong)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to mistral (master)

Fix proposed to branch: master
Review: https://review.openstack.org/177739

Changed in mistral:
status: New → In Progress
Changed in mistral:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to mistral (master)

Reviewed: https://review.openstack.org/177739
Committed: https://git.openstack.org/cgit/stackforge/mistral/commit/?id=f8d2d5c164fd193c8d97cd35c046f512a070352b
Submitter: Jenkins
Branch: master

commit f8d2d5c164fd193c8d97cd35c046f512a070352b
Author: Nikolay Mahotkin <email address hidden>
Date: Mon Apr 27 15:18:06 2015 +0300

    Fix bug with action class attributes

     * Need to write an integration test for it.

    Closes-Bug: #1448403

    Change-Id: I7f477f6c87b21ff0f8c9a31ae72086830c7fa9b4

Changed in mistral:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to mistral (stable/kilo)

Fix proposed to branch: stable/kilo
Review: https://review.openstack.org/178634

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to mistral (stable/kilo)

Reviewed: https://review.openstack.org/178634
Committed: https://git.openstack.org/cgit/stackforge/mistral/commit/?id=16eeb9f09921767eb5ed24ca325dfd5a74344792
Submitter: Jenkins
Branch: stable/kilo

commit 16eeb9f09921767eb5ed24ca325dfd5a74344792
Author: Nikolay Mahotkin <email address hidden>
Date: Mon Apr 27 15:18:06 2015 +0300

    Fix bug with action class attributes

     * Need to write an integration test for it.

    Closes-Bug: #1448403

    Change-Id: I7f477f6c87b21ff0f8c9a31ae72086830c7fa9b4
    (cherry picked from commit f8d2d5c164fd193c8d97cd35c046f512a070352b)

Changed in mistral:
milestone: 1.0.0 → none
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.