heat/heat/tests
Anant Patil 634c24ecfe Convergence: Concurrency subtle issues
To avoid certain concurrency related issues, the DB update API needs to
be given the traversal ID of the stack intended to be updated. By making
this change, we can void having following at all the places:

    if current_traversal != stack.current_traversal:
        return

The check for current traversal should be implicit, as a part of stack's
store and state_set methods, where self.current_traversal should be used
as expected traversal to be updated. All the state changes or updates in
DB to the stack object go through this implicit check (using
update...where).

When stack updates are triggered, the current traversal should be backed
up as previous traversal, a new traversal should be generated and the
stack should be stored in DB with expected traversal as the previous
traversal. This will ensure that no two updates can simultaneously
succeed on same stack with same traversal ID. This was one of our
primary goal.

Following example cases describe the issues we encounter:

1. When 2 updates, U1 and U2 try to update a stack concurrently:

    1. Current traversal(CT) is X
    2. U1 loads stack with CT=X
    3. U2 loads stack with CT=X
    4. U2 stores the stack and updates CT=Y
    5. U1 stores the stack and updates the CT=Z

    Both the updates have succeeded, and both would be running until
    one of the workers does stack.current_traversal == current_traversal
    and bail out.

    Ideally, U1 should have failed: only one should be allowed in case
    of concurrent update. When both U1 and U2 pass X as the expected
    traversal ID of the stack, then this problem is solved.

2. A resource R is being provisioned for stack with current traversal
   CT=X:

    1. An new update U is issued, it loads the stack with CT=X.
    2. Resource R fails and loads the stack with CT=X to mark it as FAILED.
    3. Update U updates the stack with CT=Y and goes ahead with sync_point
       etc., marks stack as UPDATE_IN_PROGRESS
    4. Resource marks the stack as UPDATE_FAILED, which to user means that
       update U has failed, but it actually is going on.

    With this patch, when Resource R fails, it will supply CT=X as
    expected traversal to be updated and will eventually fail because
    update U with CT=Y has taken over.

Partial-Bug: #1512343
Change-Id: I6ca11bed1f353786bb05fec62c89708d98159050
2015-11-26 09:45:49 +00:00
..
api Fix HTTP error codes due to invalid templates 2015-11-20 21:27:13 -05:00
autoscaling Change namespace for Nova resources and tests 2015-11-18 08:42:29 +08:00
aws Use EntityNotFound instead of PhysicalResourceNotFound 2015-11-19 22:58:01 +08:00
barbican Delete children handle_delete testing (Barbican) 2015-09-08 09:48:15 +03:00
ceilometer Fix [H405] pep rule in heat/tests 2015-10-12 14:08:16 +03:00
cinder Merge "Support 'multiattach' for cinder volume" 2015-11-19 03:28:21 +00:00
clients Fix variable 'url' referenced before assignment 2015-11-25 10:38:31 +08:00
constraints move ceilometer constraints to common constraint 2015-08-03 13:18:31 +08:00
convergence Fix [H405] pep rule in heat/tests 2015-10-12 14:08:16 +03:00
db Change namespace for Nova resources and tests 2015-11-18 08:42:29 +08:00
engine Convergence: Concurrency subtle issues 2015-11-26 09:45:49 +00:00
openstack Merge "Support shares in sahara clusters" 2015-11-25 14:18:33 +00:00
policy Add resource_type-specific policies 2015-08-25 15:37:26 +03:00
templates Fixes JSON to YAML conversion bug 2015-06-25 07:32:34 -07:00
__init__.py Switch to mox3 2015-10-02 13:05:51 +05:30
common.py LBaaS v2 custom constraints 2015-11-06 16:09:55 +00:00
fakes.py Add signal_transport property to Heat wait conditions 2015-10-13 12:27:05 -07:00
generic_resource.py Conditionally check for service extensions 2015-11-11 12:49:25 +00:00
test_attributes.py Support attributes with dynamic scheme 2015-08-10 12:17:01 +03:00
test_auth_password.py py34: test_auth_* 2015-08-05 10:29:16 +05:30
test_auth_url.py Merge "Correctly determine keystone v3 endpoint" 2015-08-13 03:37:24 +00:00
test_cloud_config.py Show deprecated warnings when import parser 2015-04-14 17:49:15 +08:00
test_cloudwatch.py Disable cloud-watch-lite by default 2015-05-31 17:36:13 +08:00
test_common_context.py Fix [H405] pep rule in heat/tests 2015-10-12 14:08:16 +03:00
test_common_exception.py Adds error_code in heat exceptions 2015-11-05 18:10:50 +05:30
test_common_param_utils.py Raise HTTPBadRequest instead of ValueError for API validation 2015-05-27 03:48:44 +00:00
test_common_policy.py Add resource_type-specific policies 2015-08-25 15:37:26 +03:00
test_common_serializers.py py34: heat.tests.test_common_serializers 2015-08-26 13:09:04 +05:30
test_common_service_utils.py datetime.datetime.utcnow() should be replaced 2015-11-10 17:24:51 +00:00
test_constraints.py Fix [H405] pep rule in heat/tests 2015-10-12 14:08:16 +03:00
test_convg_stack.py Convergence: Concurrency subtle issues 2015-11-26 09:45:49 +00:00
test_crypt.py Add a new crypt method using cryptography 2015-07-07 10:06:47 +02:00
test_cw_alarm.py Fix [H405] pep rule in heat/tests 2015-10-12 14:08:16 +03:00
test_dbinstance.py Fix [H405] pep rule in heat/tests 2015-10-12 14:08:16 +03:00
test_empty_stack.py Show deprecated warnings when import parser 2015-04-14 17:49:15 +08:00
test_engine_api_utils.py Fix [H405] pep rule in heat/tests 2015-10-12 14:08:16 +03:00
test_engine_service.py Split abandon into pre-abandon(export) and abandon 2015-11-20 09:17:41 -06:00
test_engine_service_stack_watch.py Fix [H405] pep rule in heat/tests 2015-10-12 14:08:16 +03:00
test_environment.py Fix [H405] pep rule in heat/tests 2015-10-12 14:08:16 +03:00
test_environment_format.py py34: test_environment* 2015-08-01 20:50:54 +05:30
test_event.py datetime.datetime.utcnow() should be replaced 2015-11-10 17:24:51 +00:00
test_exception.py Produce more meaningful exception messages in nested stacks 2015-06-24 08:52:08 +10:00
test_fault_middleware.py Use EntityNotFound instead of StackNotFound. 2015-11-19 14:51:22 +08:00
test_function.py Change assertTrue(isinstance()) by optimal assert 2015-11-02 12:23:22 +01:00
test_grouputils.py Move function for member_definitions to grouputil 2015-11-03 09:04:30 +05:30
test_hot.py Correct list_join function 2015-11-16 15:34:24 +08:00
test_identifier.py Use assertIn and assertNotIn 2015-10-26 22:40:14 +01:00
test_instance_group.py Make neutron resources available based on service extensions 2015-10-19 10:30:33 +05:30
test_instance_group_update_policy.py Change namespace for Nova resources and tests 2015-11-18 08:42:29 +08:00
test_lifecycle_plugin_utils.py Fix [H405] pep rule in heat/tests 2015-10-12 14:08:16 +03:00
test_loguserdata.py Remove spurious logs from test_loguserdata 2015-10-29 17:12:34 +01:00
test_metadata_refresh.py Replaced mox with mock in test_metadata_refresh 2015-10-16 12:07:11 -04:00
test_multi_part.py Fix unsupported format character error for multipart mime 2015-07-20 09:05:40 +05:30
test_nested_stack.py Convergence: Fix to use cache_data for FnGetRefId (1) 2015-09-30 21:38:33 +05:30
test_nokey.py Change namespace for Nova resources and tests 2015-11-18 08:42:29 +08:00
test_none_resource.py Use assertIsNone instead of assertEqual(None, ***) 2015-10-26 16:32:12 +01:00
test_notifications.py Reduce size of stack_identity in heat notifications 2015-06-29 13:14:50 +00:00
test_parameters.py Raise StackValidationFailed on parameter validation 2015-10-31 08:01:52 +00:00
test_plugin_loader.py Use HeatTestCase as parent instead of testtools 2015-03-31 15:17:29 +00:00
test_properties.py Use assertTrue/False instead of assertEqual(T/F) 2015-10-26 22:45:25 +01:00
test_provider_template.py Fix HTTP error codes due to invalid templates 2015-11-20 21:27:13 -05:00
test_random_string.py Convergence: Fix to use cache_data for FnGetRefId (2) 2015-09-30 21:41:35 +05:30
test_remote_stack.py Refactor unit tests to support ExceptionFilters in clients 2015-10-20 10:37:40 -04:00
test_resource.py Convergence: Load resource stack with correct template 2015-11-26 14:05:21 +05:30
test_resource_group.py Fix HTTP error codes due to invalid templates 2015-11-20 21:27:13 -05:00
test_restarter.py Stop monkey-patching global namespace 2015-05-28 13:05:15 +00:00
test_rpc_client.py Fix [H405] pep rule in heat/tests 2015-10-12 14:08:16 +03:00
test_rpc_listener_client.py Move listener rpc client to rpc/listener_client.py 2015-06-19 08:24:19 +05:30
test_rpc_worker_client.py Remove return for rpc casts in rpc worker client 2015-03-24 23:17:19 +05:30
test_rsrc_defn.py Make ResourceDefinition round-trip stable to avoid extra writes 2015-09-11 14:27:55 -04:00
test_server_tags.py Change namespace for Nova resources and tests 2015-11-18 08:42:29 +08:00
test_short_id.py Port short_id to return unicode 2015-07-09 07:15:49 +00:00
test_signal.py Add signal_transport property to Heat wait conditions 2015-10-13 12:27:05 -07:00
test_software_component.py Improve StackValidationFailed response in properties 2015-04-10 15:42:21 +03:00
test_software_config.py Use assertIsNone instead of assertEqual(None, ***) 2015-10-26 16:32:12 +01:00
test_software_deployment.py Use rsrc_defn_from_snippet for ResourceGroup 2015-11-03 09:03:41 +05:30
test_stack.py Convergence: Concurrency subtle issues 2015-11-26 09:45:49 +00:00
test_stack_collect_attributes.py Add get_attr which returns all attributes 2015-09-01 17:32:17 +03:00
test_stack_delete.py Refactor timeout calculation to utility 2015-07-18 08:51:59 +05:30
test_stack_lock.py Fix stack lock ActionInProgress in the admin case 2015-11-17 16:16:18 +13:00
test_stack_resource.py Fix HTTP error codes due to invalid templates 2015-11-20 21:27:13 -05:00
test_stack_update.py Add tests for pre-create hooks 2015-11-10 11:10:50 +01:00
test_stack_user.py Move registration of resources to HeatTestCase 2015-06-15 02:43:15 -04:00
test_structured_config.py Use rsrc_defn_from_snippet for ResourceGroup 2015-11-03 09:03:41 +05:30
test_support.py Replace tag 2015.2 to 5.0.0 2015-08-06 06:29:09 -04:00
test_swiftsignal.py Convergence: Fix to use cache_data for FnGetRefId (2) 2015-09-30 21:41:35 +05:30
test_template.py Don't force Fn::Select index to integer 2015-11-20 16:17:03 +01:00
test_template_format.py Merge "Use assertIsNone instead of assertEqual(None, ***)" 2015-10-27 16:38:31 +00:00
test_timeutils.py Round the elapsed time to the nearest second 2015-09-09 06:59:56 +00:00
test_urlfetch.py py34: Fix integration tests 2015-09-26 20:27:54 +05:30
test_validate.py Define engine service in setUp() 2015-11-19 01:15:46 +00:00
test_version.py Coverage: Additional test case for better coverage 2015-06-16 13:01:30 +05:30
test_vpc.py Show deprecated warnings when import parser 2015-04-14 17:49:15 +08:00
test_watch.py Replaced mox with mock in test_watch 2015-10-14 13:49:44 -04:00
testing-overview.txt Add alternative way to use debugger for unittets 2015-08-20 16:28:51 +00:00
utils.py Convergence: Fix to use cache_data for FnGetRefId (1) 2015-09-30 21:38:33 +05:30