neutron/neutron/tests/unit/db
dukhlov 1cafff0871 Remove threading before process forking
Forking a process when multiple threads are running is an unsafe
operation and could cause a lot of problems because only current
thread will continue working in child thread. Any locked by other
thread resource will remain locked forever.

We faced with this problem during oslo.messaging development and
added workaround to hide this problem:
https://review.openstack.org/#/c/274255/

I tried to fix this problem in oslo.service:
https://review.openstack.org/#/c/270832/

but oslo folks said that this fix is ugly and it is wrong way to add
workarounds to common libraries because projects use them incorrectly.
I think that is fair.

So this patch fixes incorrect usage of oslo libraries. In this patch
I extended functionality of NeutronWorker and add there
`worker_process_count` parameter which determines how many processes
should be spawned for this worker. If `worker_process_count` = 0 - don't
create process and spawn thread in scope of current process for worker

Then I moved all background tasks to workers and return them by
`get_workers` method. start_plugin_workers collects plugin's workers
using `get_workers` method and starts in ProcessLauncher first workers
with `worker_process_count` > 0 and only after this starts threaded
workers by simple Launcher

Closes-bug: #1569404

Change-Id: I0544f1d47ae53d572adda872847a56fa0b202d2e
2016-05-03 21:54:23 +03:00
..
metering Use constants from neutron-lib 2016-04-23 21:23:56 -04:00
quota Use exceptions from neutron-lib 2016-04-21 21:29:44 -04:00
__init__.py Empty files should not contain copyright or license 2014-10-20 00:50:32 +00:00
test_agents_db.py Use constants from neutron-lib 2016-04-23 21:23:56 -04:00
test_agentschedulers_db.py Remove threading before process forking 2016-05-03 21:54:23 +03:00
test_allowedaddresspairs_db.py Use converters and validators from neutron-lib 2016-04-24 19:13:10 -04:00
test_api.py Retry port create/update on duplicate db records 2016-01-14 20:40:49 -08:00
test_common_db_mixin.py L3HA: Do not wrap create/delete in transaction 2016-03-11 23:59:10 +00:00
test_db_base_plugin_common.py Replace to_dict() calls with a function decorator 2015-08-03 11:42:25 +03:00
test_db_base_plugin_v2.py Use constants from neutron-lib 2016-04-23 21:23:56 -04:00
test_dvr_mac_db.py Use constants from neutron-lib 2016-04-23 21:23:56 -04:00
test_ipam_backend_mixin.py Use constants from neutron-lib 2016-04-23 21:23:56 -04:00
test_ipam_non_pluggable_backend.py Use constants from neutron-lib 2016-04-23 21:23:56 -04:00
test_ipam_pluggable_backend.py Use constants from neutron-lib 2016-04-23 21:23:56 -04:00
test_l3_db.py Use exceptions from neutron-lib 2016-04-21 21:29:44 -04:00
test_l3_dvr_db.py Use constants from neutron-lib 2016-04-23 21:23:56 -04:00
test_l3_hamode_db.py Use constants from neutron-lib 2016-04-23 21:23:56 -04:00
test_migration.py Remove deprecated methods from migration CLI file 2016-03-25 17:28:31 +00:00
test_portsecurity_db.py port security: gracefully handle resources with no bindings 2016-03-24 22:27:31 +01:00
test_portsecurity_db_common.py port security: gracefully handle resources with no bindings 2016-03-24 22:27:31 +01:00
test_securitygroups_db.py Use constants from neutron-lib 2016-04-23 21:23:56 -04:00
test_sqlalchemytypes.py Add custom SQLAlchemy type for MACAddress 2016-03-15 17:31:55 +01:00